0
votes

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.

1

1 Answers

2
votes

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.

  1. First define a variable for issue number, and one for transitionid if neccessary. enter image description here

  2. Second add a bash task at the end of your release pipeline. enter image description here

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.