Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to Update Bitbucket Build Status from Azure Pipeline with Custom Message and Values?

sajo September 14, 2023

How can I update the build status from Azure Pipeline to Bitbucket with a custom message and custom values? I've tried below APIs, but they didn't update the build status as expected. My goal is to see the build status reflected in commits and pull requests in Bitbucket.

`

curl -X POST -is -u <USER_NAME>:<APP_PASSWORD> \
-H 'Content-Type: application/json' \
https://api.bitbucket.org/2.0/repositories/<USER_NAME>/<REPOSITORY_SLUG>/commit/<COMMIT>/statuses/build \
-d '{
"state": "SUCCESSFUL",
"name": "Build key - description",
"url": "https://<AZURE_URL_REFERENCE>",
"description": "A general description"
}'

`

1 answer

1 accepted

1 vote
Answer accepted
Saxea _Flowie_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 14, 2023

Try adding the key attribute to the payload. It's just an arbitrary value.

curl -X POST -is -u <USER_NAME>:<APP_PASSWORD> \
-H 'Content-Type: application/json' \
https://api.bitbucket.org/2.0/repositories/<USER_NAME>/<REPOSITORY_SLUG>/commit/<COMMIT>/statuses/build \
-d '{
"key": "my-build",
"state": "SUCCESSFUL",
"name": "Build key - description",
"url": "https://<AZURE_URL_REFERENCE>",
"description": "A general description"
}'
sajo September 16, 2023

I tried setting the 'key' but didn't get updated in bitbucket with custom message 

Saxea _Flowie_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 17, 2023

@sajo What's the response you get from the request? Any errors?

sajo September 17, 2023

IMG_20230918_103342.jpg

 

I attempted to set 'key' but bitbucket didn't display any status code and didn't update the custom message as shown in the screenshot 

sajo September 17, 2023

IMG_20230918_103131.jpg

Saxea _Flowie_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 17, 2023

Have you tried to run curl via cmd line directly on your machine? Then you can inspect the output and see what the issue is? 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events