Reputation: 45
We are using JIRA cloud for issue handling. Our source code is in Azure Devops Repos, and we use Azure Devops Pipelines for build and release.
Is it possible to set it up, so that a JIRA issue is automatically transitioned into another status, when Azure Pipelines has completed a deployement to a specific environment? The issue number is references in the Pull Request title.
Upvotes: 3
Views: 2269
Reputation: 30313
If manually add a variable to define the issue number in your pipeline is workable. You can try below to add a bash task at the end of your release pipeline and call Jira api to transition the issue status.
Assume you know your transition ids. You can use below script. click here to get your api token for your Jira.
curl -D- -u "username:APIToken" -X POST --data '{"transition":{"id":"transitionid"}}' -H "Content-Type: application/json" https://[accouint].atlassian.net/rest/api/2/issue/[issue-no]/transitions?transitionId?expand=transitions.fields
(To get transitionids use below api):
curl -D- -u "username:APIToken" -X GET https://[accouint].atlassian.net/rest/api/2/issue/[issue-no]/transitions?transitionId?expand=transitions.fields
Update:
Pull request title can be retrieved via below rest api.
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/pullrequests/{pullRequestId}?api-version=5.1
Hope above is helpful to you.
Upvotes: 3