3

I have a powershell build script which checks out code and increments a build number in SVN (nightly) in our Version.h file.

What I need is some way to set that build number in JIRA (or have JIRA read it from SVN) so that when a story is marked as resolved, it sets a "Last Version" field to that build number so QA knows which build an issue was resolved in.

What's the best way to do this? I could potentially use some combination of the JIRA CLI and a custom field or something, but I was wondering what suggestions were? Are there any scripts/plugins written for this already? I was thinking of using a custom option field and then somehow populating the dropdown with the new build number or something, but that seems like a dirty solution and I don't really know how to do it anyway.

The build number is different from the version that we have in JIRA since those versions we're using for sprints.

Thanks!

Jordan
  • 9,014
  • 8
  • 37
  • 47

1 Answers1

1

The best way is probably to use Jira's REST API (assuming you're using Jira v4.x onwards, I think). Jira supports SOAP as well, but I think that is going to be more bother than it is worth.

Then assuming your proxy is set correctly, you can use code similar to this Stackoverflow question: Call REST API from PowerShell Script.

Lastly, since the Jira REST api needs authentication, I'd suggest you do not include the password for obvious reasons, but read it from a secure store, or permissioned system file or some other appropriate alternative.

Community
  • 1
  • 1
Barry
  • 606
  • 7
  • 13
  • Hmm, interesting, thanks. But how would I change the JIRA workflow to set a custom field like that when moving from In progress->Resolved? It would seem that I need my script to set something global or project-wide field and then have the workflow grab that value when changing or something. – Jordan Feb 15 '12 at 15:12
  • There seems to be a workflow transition REST call: [http://docs.atlassian.com/jira/REST/latest/#id2474418](http://docs.atlassian.com/jira/REST/latest/#id2474418), so it should be possible to add that into a script as well. – Barry Feb 15 '12 at 18:04
  • Yeah, but I don't want to transition workflows from the build script, I want to update a (global?) field from the build script and then have the workflow post action grab that value and set it when someone does a transition. – Jordan Feb 15 '12 at 19:34
  • I see. In that case, I'm not too sure. It might be better to post the question to the atlassian forums and someone there may be able to answer. I have a suspicion that Jira can't do that unless you write a plugin. – Barry Feb 15 '12 at 21:15
  • Yeah, that might be the case. I was thinking of using a combination of either the REST API or a CLI to set some global variable and then use a plugin (which one?) to grab that information and set a custom field or label or something. – Jordan Feb 15 '12 at 22:22