I would love to add another "build" on my own from within a pipeline.
On a pull request, the UI shows on the right top hand a summary of the builds (e.g. "3 of 3 passed")
When clicking, there is more detail:
Builds number one and two are created by Bitbucket Cloud Pipelines Plugin itself for tow piplines: Pull Request and Branch.
Build number three is from a remote service, here SonarCloud.
Similar to what SonarCloud does here, I would like to learn which APIs there are to create a build entry here from within my pipelines.
I've looked into the REST API but was a bit lost as I couldn't find anything useful. Maybe this is for Webhooks? But then I didn't know where to find Webhooks (and I guess these are the other way round).
Any pointers would be great. I can imagine it's as easy as just firing some curl calls.
Thanks for the hint, this looks promising, I'll mark it as answer and hope I can give more feedback soon.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@mkleint Thanks for your answer, this works like a charm after I found out I had an issue with the JSON payload.
/edit: Here an example curl I use. I also tried w/o any request body:
curl -X POST -ivs -u "${BITBUCKET_API_USER}:${BITBUCKET_API_PASSWORD}" \
-H 'Content-Type: application/json' \
"https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/commit/${REVISION}/statuses/build" \
-d '
{
"key": "merge-ci-build",
"state": "INPROGRESS",
"name": "Merge CI Build",
"description": "Description text of the merge CI build"
}'
The ${REVISION} is an existing reference. I already use it to identify the pull request which caused the build on the merge successfully via the API. Can be the full hash or shortened.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.