Archive Multiple Versions in a JIRA Project

Michael Roff
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.
November 14, 2011

Is there a way to archive multiple versions in a JIRA project all in one go?

We have MANY versions in JIRA due to autumatically adding each version after a new build is complete. We now want to be able to efficiently go through and clean this up as quickly and easily as possible.

Any ideas?

1 answer

1 accepted

2 votes
Answer accepted
Bob Swift OSS (Bob Swift Atlassian Apps)
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.
November 14, 2011

You can use JIRA Command Line Interface archiveVersion aciton. It does a single version. If you have a query that determines the versions to be archived, use runFromSql action. Otherwise you can script the archiveVersion in your automation. There is also an unarchiveVersion action. Example: jira --action archiveVersion --project XXXX --version v1234. getVersionList may also be helpful. You will need 2.4.0-SNAPSHOT or higher - https://bitbucket.org/bob_swift/jira-cli/downloads.

Michael Roff
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.
November 14, 2011

Thanks Bob.

I will give this a go once we have upgraded to v4.4.3 OR do you think the existing issues in v4.4.0 won't be a problem for this specific function?

Bob Swift OSS (Bob Swift Atlassian Apps)
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.
November 14, 2011

That is an old SOAP API, should work on almost any JIRA release.

Michael Roff
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.
November 15, 2011

I had a few struggles getting CLI working - ended up being I had a % symbol in my password which was doing nasty things to the jira.bat script. Now I have that sorted, I have been able to extract the Version information from the project I want to work on.

Is there a way I can create a file which contains all the versions I want to archive and then pass this into the archiveVersion action?

Im still finding my feet with CLI [obviously :(] so would appreciate any guidance you can offer. BTW - I am beginning to have evil thoughts about all the customisation and automation I can do with this tool - it's very neat! :)

Bob Swift OSS (Bob Swift Atlassian Apps)
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.
November 15, 2011

Yes, run, runFromCsv, and runFromSql actions allow you to run other actions in bulk depending on what information you have. Respectively a file of actions, a csv file of actions or a sql statement that produces lines of actions. Example:

jira --action runFromSql --common "--action archiveVersion" --sql "select version as "version" from ... where ..." --database jira --driver postgresql --dbUser admin --dbPassword admin --host dbserver

Michael Roff
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.
November 16, 2011

Thanks for the guidance Bob.

Looking at JIRA help file, I can't find archiveVersion. There is a releaseVersion option but not archive. I tried using archiveVersion but this isn't recognise. Does this action actually exist yet?

I have been trying to work out how to use a CSV file which would hold each version I want archived but it is a little difficult for me to work out.

Ideally, the CSV file will contain a list of the versions such as"

"v1.1"
"v1.2"
"v1.3"

etc.

The command line I am trying to use (which I know is wrong but not sure how to fix it) is...

jira --action runFromCSV --file "versions to archive.csv" --common "--action releaseVersion --project "Test Project" --version "

Am I on the right track with this?

Are there any runFromCSV examples I can look at?

Thanks.

Bob Swift OSS (Bob Swift Atlassian Apps)
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.
November 16, 2011

archiveVersion is only in the 2.4.0-SNAPSHOT level - make sure you are using that. Your CSV looks close, you need a column header line: version - that is how it knows what parameter to fill in from the data lines.

Michael Roff
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.
November 16, 2011

I was wondering how the runFromCSV picked up the variables - but a header makes sense. Thanks for the heads up on 2.4.0-SNAPSHOT - worked a treat.

After a bit of trial and error, I managed to get everything working. For those who come across this thread the CSV file I used was:

<colgroup><col style="width: 60pt;" width="80"/> <col style="width: 48pt;" width="64"/> </colgroup>
project version
Test Project v1.5
Test Project v1.6

the command line I used was:

jira --action runFromCSV --file "versions to archive.csv" --common "--action archiveVersion"

Thanks Bob. Would be still scrating my head without your support.

........................,,-~*~,,
......................./:.:.:.:.:.|
......................|;.;.;.;.;./
......................|.;.;.;.;.|
............._,,,,,_.).;.;.;.;.|
.........,,-":.:.:.:."~-,;.;.;.|
........(_,,,,---,,_:.:.);.;.;..",,
......,-":.:.:.:.:.""-,,/;.;.;.;.;.",
.....(:.__,,,,,,,,,___);.;.;.;.;.;|
...../"":.:.:.:.:.:.:¯""\;.;.;.;.;.,"
....\",__,,,,,,,,,,,__/;;;;;;;;;/\
.....\.::.:.:.:.:.:.:.;.);;;;;;;;;/:\
.......\,,,,,---~~~~;;;;;;;;,"::::\
.........."""~~--,,,,,,,,,,-"::::::::::\
...................\::::::::::::::::::::::\

Bob Swift OSS (Bob Swift Atlassian Apps)
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.
November 16, 2011

Good to hear :). Still need more documentation to help with this. But your question and posting of solution helps in that direction!

Michael Roff
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.
November 17, 2011

There can always be more documentation ... but I think what is there is great!

I get disheartened when someone asks a question on a forum and then they reply with "worked it out - thanks!" without providing the actual answer - a little extra efforts helps a lot of people - I know I have been helped hundreds of times - we all have I'm sure.

Suggest an answer

Log in or Sign up to answer