-
Bug
-
Resolution: Unresolved
-
Minor
-
None
In using the Jira Steps plugin we have a case, where multiple concurrent Jenkins builds start and all hit the Jira Step EditIssue call at the same time. Since each job is running independently and will be creating different versions, there is no way to make each call wait for another to finish the updates. We are seeing a Dirty Writes because of this.
This issue seems to be with Jira itself. To cause the problem in Jira, load an issue in two separate browser windows. Create a unique version in the first and click save. Then on the other window without reloading create a different version and click save. Jira will report in the change history that the first windows version has been removed while the second windows version is now bound.
Since this problem exists, we have found that the Jira Steps plugin doesn't handle this case well either and we are losing versions when the concurrent jobs all create their version. Through a lot of research it was found that the Jira REST API supports a method to Add/Remove versions using a slightly different syntax. A curl example I have confirm works is to call the issue end point but with an "update: fixVersions: add" body.
curl --request PUT \
-u ${user_pass} \
--data '
{
"update": {
"fixVersions": [
{"add":
{"name": "${version}"}
}
]
}
}' \
-H "Content-Type: application/json; charset=utf-8" \
${jira_site_url}/rest/api/2/issue/${jiraIssue}
My thoughts on this would be to add a new api call addFixVersionToIssue(key, version). The inverse could also be added removeFixVersionFromIssue(key, version). In this case the calls would use the body in the above to perform the update. I have confirmed with the curl call, running it concurrently all version get added and nothing is removed.
Reviewing the code base it doesn't seem to complicated to be added and would be a nice addition to the already awesome collection of Jira api calls.