Automate JIRA Refresh Process Between Environments(Prod/Dev)

Luis Mayora
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 22, 2013

Hi,

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='http://testenv.jira.mycompany.com' 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)

Question
----------

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

1 answer

0 votes
Denis Cabasson April 22, 2013

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.

Luis Mayora
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 23, 2013

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.navigate.to 'http://jira.mycompany.com/secure/Dashboard.jspa'

driver.switch_to.frame "gadget-0"

puts "Title: #{driver.title}"

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

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

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

wait = Selenium::WebDriver::Wait.new(:timeout => 10)
wait.until { driver.title.start_with? "CM/Quality" }

puts "Title: #{driver.title}"

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

wait = Selenium::WebDriver::Wait.new(:timeout => 10)
wait.until { driver.title.start_with? "JIRA Administration" }

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

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

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

wait = Selenium::WebDriver::Wait.new(:timeout => 10)
wait.until { driver.title.start_with? "Application Links" }

#driver.click("css=a[class=app-delete-link]")
#element = driver.find_element(:link_text,'Delete')
#element.click

driver.save_screenshot("jira.png")

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