I'm working with Jirret Python script to integrate Gerrit code reviews into our Jira workflow. I can apply a comment to the Jira issue, which is the defauilt behavior of Jirret. What I need is for the issues status to be moved to 'Resolved' as well. I cannot find complete examples of the propper use of progressWorkflowAction(). Here is a snippet from the original Jirret code, with my partial attempt included commented out.
for i in issues: print 'Updating issue: ' + i rpc.jira1.addComment(auth, i, message) # if status == 'merged': # print 'Moving issue to Resolved: ' + i # rpc.jira1.progressWorkflowAction(auth, i, 'Resolved', [{}]) if len(status) > 0 and len(custom_field) > 0: rpc.jira1.updateIssue(auth, i, {'customfield_' + custom_field: [status]})
Can anyone help?
Community moderators have prevented the ability to post new answers.
If you don't have resolution on the workflow screen, you need to set the resolution separately on the issue object and store it.
Else, you can do something like this:
RemoteFieldValue[] actionParams = new RemoteFieldValue[] { new RemoteFieldValue("resolution", new String[] { "5" }) }; RemoteIssue remoteIssue = getJiraSoapService().progressWorkflowAction(getToken(), issueKey, "5", actionParams);
The snippet is in Java ;)
I know that there are two things, status and resolution. When a developer submits the code in Gerrit, it is merged. I want the status in Jira to be changed to 'Resolved'. If the change passes QA, then they set it to 'Closed'.
So yes, I may need to set the resulution, but how do I set the status? I guess what you are saying is that I need to set both?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to do both, yes. If you have resolution on screen, you can do both using a single step as shown above. if not, it will be 2 calls, onle to change status and another to update issue with resolution.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, then can you explain the first one? What is issueKey, and where does the value of "5" come from?
Thanks for the help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
issue key is the issue key of the issue you are trying to progress in the workflow! "TEST-1" for example.
"5" is the id of the resolution you are trying to set. You can get from database or find it in the browser url while editing the resolution on UI!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So, then it is possible that this would work in my scenario:
... rpc.jira1.progressWorkflowAction(auth, i, "5", {'resolution': "5"}) ...
Where i = "MYISSUE-21", for example, whould set MYISSUE-21 to resolved and fixed?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah, OK! So, in my case status is 'Resolved' = "5", and resolution is 'Fixed' = "1". So it would be:
rpc.jira1.progressWorkflowAction(auth, i, "5", {'resolution': "1"})
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh wait, there are 2 '5's. One is the actionId which is id of the transition in the workflow. And the last parameter should be an aray of RemoteFieldValue. I don't know python syntax.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is not the status id. It is the transition id. If you go to the workflow steps, you will find an id for each transition.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When I view a resolved/fixed issue in XML, the value of status is "5" and resolution is "1". So, my thinking now is below:
rpc.jira1.progressWorkflowAction(auth, i, {'status': "5"}, {'resolution': "1"})
Do you agree?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
value of status is "5"
What is the value of transition? Status is not transition.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<item> <title>[RELEASE-5] Move Debian files for Network</title> <link>http://jira.swenglab.internap.com/browse/RELEASE-5</link> <project id="10400" key="RELEASE">Cloud Release</project> <description/> <environment/> <key id="11156">RELEASE-5</key> <summary>Move Debian files for Network</summary> <type id="8" iconUrl="http://jira.swenglab.internap.com/images/icons/ico_task.png">Technical task</type> <parent id="11152">RELEASE-1</parent> <priority id="1" iconUrl="http://jira.swenglab.internap.com/images/icons/priority_blocker.gif">Blocker</priority> <status id="5" iconUrl="http://jira.swenglab.internap.com/images/icons/status_resolved.gif">Resolved</status> <resolution id="1">Fixed</resolution> <assignee username="slavender">Scott Lavender</assignee> <reporter username="slavender">Scott Lavender</reporter> <labels></labels> <created>Tue, 12 Jun 2012 09:27:15 -0400</created> <updated>Wed, 20 Jun 2012 15:23:52 -0400</updated> <resolved>Thu, 14 Jun 2012 08:29:57 -0400</resolved> <version>Q3-Dirt</version> <fixVersion>Q3-Dirt</fixVersion> <due/> <votes>0</votes> <watches>0</watches> <timeoriginalestimate seconds="0">0 minutes</timeoriginalestimate> <timeestimate seconds="0">0 minutes</timeestimate> <timespent seconds="3600">1 hour</timespent> <attachments></attachments> <subtasks></subtasks>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In the wokflow XML, it will be action id.
<action id="2" name="Close Issue" view="resolveissue">
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok found it:
<action id="5" name="Resolve Issue" view="resolveissue">
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah, "5" again! That's the one.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK, this is not posible with rpc-xml, only when using soap. Thanks for the help...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.