Details
-
Bug
-
Resolution: Fixed
-
Low
-
5.15.7
-
2
-
Severity 3 - Minor
-
Description
Issue
Adding label to build result from REST API (/plan/{projectKey}-{buildKey}/label) does not have the same result as when adding it from Bamboo's UI.
Documentation
Extracted from Linking Jira application issues to a build:
Bamboo will automatically link an issue to a build if you specify a Jira issue key in a Bamboo build comment or label, or in a code commit message.
The issue key must be of the default Jira issue key format (that is, two or more uppercase letters ([A-Z][A-Z]+), followed by a hyphen and the issue number, for example
BAM-123).
How to Replicate
By having Atlassian Bamboo and Atlassian Jira connected through Application Link:
- create an issue in Jira, e.g LABEL-1
- run a build in Bamboo, resulting on PROJ-PLAN-JOB1-1
- run the following cURL command to add a label:
curl -k -u admin:admin \ -H "Content-type: application/json" \ -H "Accept: application/json" \ -d '{"name":"LABEL-1"}' \ -X POST http://localhost:8085/rest/api/latest/result/PROJ-PLAN-1/label
Expected Result
Label should be added and linked to existent Jira issue key.
Actual Result
Bamboo seems not to communicate with Jira as the remote-link-aggregation is not called.
Workaround
Use the comment API to add a comment to the build result instead of a label. Comments are correctly processed and will link the Jira issue:
curl --user admin -H 'Content-Type: application/xml' -X POST 'http://bamboo-url/rest/api/latest/result/{PROJ}-{PLAN}-{RESULT}/comment' --data '<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <comment> <content>JRA-100</content> </comment>'