Automating the look and feel of JIRA

Hi, I'm doing a semi-automated setup of JIRA v6.x with dev, staging and production instances on a single server with different context paths. I have it all working nicely and would very much like to automate the setting of different looks and feels for the UI for each instance, for instance dev = green, staging = orange, production = company logo colors (grey and green)

We want it to be very clear to users what instance they are working in and setting the colors is a good way to do this in my experience.

Our intention is to update the staging and dev instances on a regular basis (every two weeks or so) with a backup from the production instance. However if we have to manually set the colors each time this becomes a chore that no-one will want to do and will obviously diminish the usefulness of the staging and dev instances as people may be unsure which environment they are working in.

According to the page: https://confluence.atlassian.com/display/JIRA/Advanced+JIRA+Configuration

this can be easily done by adding the necessary settings to the <jira.home>/jira-config.properties file and restarting JIRA.

Here are the contents of my dev instance properties file:

cat /jira/dev/jira.home/jira-config.properties 
jira.lf.gadget.color1 = #006910 
jira.lf.gadget.color2 = #900925 
&lt;snip&gt;
jira.lf.top.textcolour = #ffffff 
jira.lf.top.texthilightcolour = #f0f0f0

However when I do so however I only get the first gadget color set, if I want the rest of the colors to stick I have to go into the look and feel page and manually edit each value and then refresh the page so that they get updated in the MySQL database. Note that only some of the color swatches in the Look and Feel page are set with the correct values in this case.

JIRA support told me that this method was very old and wasn't necessarily up to date with JIRA v6.x

I've tried inserting the values directly into the database (after consulting the schema to make sure I wasn't missing anything) but I got the same result. Note that all of the color swatches in the Look and Feel page are set with the correct values in this case but they simply aren't being acted upon.

So ultimately my questions here are:

Is there some other way that I should be automating the setting of the look and feel colors instead of through the <jira.home>/jira-config.properties file or the propertyentry/propertrystring tables in the database?

If I insert the values into the database is there some way to force the UI to re-read them? JIRA is obviously doing this somehow when I press CTRL+R after updating a color swatch.

Is there a better way to do what I'm looking to do? (Ultimately any very obvious visual indicator should work for us)

2 answers

1 accepted

3 votes
Accepted answer

You can achieve that by setting the colors using the JIRA rest api and then restarting JIRA.

So here's a sample rest request ( done using JavaScript, but you can do it with any other rest client) that sets the header background color:

$.ajax({url:'http://jiraserver/rest/api/2/application-properties/jira.lf.top.bgcolour',type:'PUT',dataType: 'json' , 'contentType': 'application/json', data: JSON.stringify({"value": "#F64823"}) })

Then restart JIRA and you're done.

Thanks for the pointer. I haven't used the JIRA API before but your answer gave me the necessary pointers to figure it out.

I'm not really familiam with JavaScript so I used cURL working from the API samples from Atlassian at: https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Edit+issues

The following command will set the header background color on my dev JIRA site to magenta:

curl -k -D- -u username:password -X PUT --data '{"value" : "#ff00ff"}' -H "Content-Type: application/json" https://jira.mycompany.com/dev/rest/api/2/application-properties/jira.lf.top.bgcolour

(Note that the /dev in the URL is a context path on the server, there are multiple instances running)

The JIRA bug tracker for this issue is here:

 

https://jira.atlassian.com/browse/JRA-29904

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,708 views 17 21
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you