Automate JIRA Refresh Process Between Environments(Prod/Dev)


We have 2 JIRA environments(test,production). We would like to automate the process of refreshing the test environment using different values for example(application links, general URL, delete mail server).

I came up with the following process...

1. Create a backup of JIRA prod database (Powershell with SQL Server Module)
2. Store backup file in shared location
3. Stop services for JIRA Training Environment
4. Restore database using (Powershell SQL Server Module)
5. Archive log files (Shared Location)
6. Perform specific training instance updates

6.a Delete the Mail Server (DELETE FROM dbo.mailserver where ID in (10010, 10031);)
6.b UPDATE dbo.propertystring SET propertyvalue='' WHERE ID=10012;
6.c DELETE FROM dbo.notificationscheme where ID in(10000, 10021, 10032, 10040, 10171, 10270, 10370, 10371);

7. Update Application Link for Confluence Test Environment (PENDING)
8. Reindex (PENDING)


How do we reindex or update the application link if there is no API or Database Table that holds this data.

1 answer

We have the same type of situation there, and we usually don't bother re-indexing.

I am not sure whether it's missing in your steps or if it's implied, but JIRA is using some file system storage as well (in the Applicaiotn Data\JIRA folder for us).

In those folders, you will have things such as :

  • Attachments
  • Plugins
  • Indexes
  • Avatars

So we are usually copying this folder (a zipped version) from production to test environment as well.

As well, in your point 6b, I believe you need to repoint the database in the dbconfig.xml file (part of that famous folder) rather than changing it in the database. It's kind of a chicken and egg problem, the configuration for the database accessed by JIRA cannot be in the database, because JIRA needs this information before accessing the database.

Copying the folder will take care of your indexing, as the indexes will be copied over from production, so we usually don't bother rebuilding them (since it's test, not too many people are using it and load is not an issue).

No advice for application links, as we are not using those.

I was trying to remove an application link using the selenium-webdriver ruby gem.

require "selenium-webdriver"

driver = Selenium::WebDriver.for :chrome, :switches => %w[--ignore-certificate-errors --disable-popup-blocking --disable-translate --ash-immersive-fullscreen ] ''

driver.switch_to.frame "gadget-0"

puts "Title: #{driver.title}"

element = driver.find_element(:id, 'login-form-username')
element.send_keys "myusername"

element = driver.find_element(:id,'login-form-password')
element.send_keys "mypassword"

element = driver.find_element(:name,'login')

wait = => 10)
wait.until { driver.title.start_with? "CM/Quality" }

puts "Title: #{driver.title}"

element = driver.find_element(:link_text,'Administration')

wait = => 10)
wait.until { driver.title.start_with? "JIRA Administration" }

element = driver.find_element(:link_text,'Application Links')

element = driver.find_element(:id,'login-form-authenticatePassword')
element.send_keys "mypassword"

element = driver.find_element(:name,'authenticate')

wait = => 10)
wait.until { driver.title.start_with? "Application Links" }"css=a[class=app-delete-link]")
#element = driver.find_element(:link_text,'Delete')


puts driver.inspect

Still need to figure out the Delete click and Add a new application link.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Monday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

692 views 6 13
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