Hello,
While developing features for my product I've been adding Jira issue keys to the Git commits. After a successful deployment via bitbucket-pipelines.yml I can see the linked issues in the "Deployments" section in my repository.
What I'm trying to achieve is to get a list of these issues as a part of my pipeline (I'm running a custom JS script). That script is making an API request to the:
https://api.bitbucket.org/rest/api/2.0/projects/${PROJECT_KEY}/repos/${REPOSITORY_SLUG}/pipelines/${PIPELINE_UUID}/issues
All of the variables are accessible via the environment variables of the pipeline itself. The authorization that is used is:
Authorization: 'Basic ${username:appPassword}' as Base64
Content-Type: 'application/json'
The response that I'm getting back is:
"type": "error","error": {"message": "Resource not found","detail": "There is no API hosted at this URL.\n\nFor information about our API's, please refer to the documentation at: https://developer.atlassian.com/bitbucket/api/2/reference/"}
While the response is quite self-explanatory I'm struggling to find out the needed API in the documentation.
Thanks in advance.
Hi Vladimir and welcome to the community!
I'm afraid that we don't have an API endpoint for getting the Jira issues associated with a deployment.
We have a feature request in our issue tracker that you can vote for to express your interest:
You are more than welcome to leave feedback on that ticket and you can also add yourself as a watcher (by selecting the Start watching this issue link) if you'd like to get notified via email on updates. Implementation of new features is done as per our policy here and any updates will be posted in the feature request.
In the meantime, if you want to get this info during a Pipelines build, you would need to do some additional scripting.
If the pipelines build runs on a pull-requests definition, the variable BITBUCKET_PR_ID will be available during the build. You could get the PR's commits with the following API endpoint:
Then, you could parse the commit messages of the PR's commits for the referenced Jira issues.
If the build runs on branches, the process would be a bit more complicated. Please also note that it won't be foolproof. You could do the following:
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.