Transition JIRA issue within TeamCity
Hello,
As part of a TeamCity build, I would like to transition the JIRA issues in scope for that build using the JIRA REST API.
I can't seem to find a parameter/variable that contains the list of issues in scope for a given build.
Can someone point me to where that information is stored or, suggest a better way to transition JIRA issues as part of a TeamCity build?
Thanks,
- Joe
Please sign in to leave a comment.
Hi Joe,
You have some instructions here: https://stiltsoft.com/blog/2015/11/get-%D0%BCaximum-from-teamcity-integration-through-rest-api/
One of the steps is "getting the related issues for a build". The URL is this one: http://localhost:8111/httpAuth/app/rest/builds/id:898/relatedIssues.
Be mindful of this issue though: https://youtrack.jetbrains.com/issue/TW-20025. On the last comment, it's noted that since 8.0 EAP5 this only contains a link to another request that will actually retrieve the information, and also be aware that this is a CPU intensive task that might take a while to complete.
Hope this helps.
Thanks - using the information above, I was able to build a little utility to transition my JIRA items using a TeamCity build step.
Is there a way to get all issues were in scope for build IDs < 898 (rather than build ID = 898)?
Hi Joe,
Partially yes, but you should be careful when using this. As the ticket points out, calculating the issues for a single build is already an expensive operation. Calculating all of them for a large set of builds might have a serious performance impact. You might want to cache this data somehow.
Partially, because as the issue mentions, the "relatedIssues" end point for builds was changed so that it only returns a URL to get the specific issues for a build. You can get all the builds' links directly by using this URL:
http://<address>/app/rest/builds?locator=untilBuild:(id:<id>,<additional_search_parameters>)&fields=build(relatedIssues(*)), that will give you all the related builds with a link to their issues, that you can then collect. Again, please take into account the impact this would have on the server before doing it for large batches.
Hi Joe.
Can you share your utility? I am seeking to write a script to update the JIRA issues linked to the build (via JIRA Rest API) to be called as a TeamCity build step.
Thanks,
Steve