Builds not appearing in pull requests
Asked by Yak Hawkes:

I have setup a build system in Google Cloud Build which is triggered on Commit.

The status of the build is sent back to BitBucket using the API   
'<https://api.bitbucket.org/2.0/repositories>/${username}/${repo_slug}/commit/${commitSha}/statuses/build\`

This is working great and I can see the status and link back to the builds from main repo page and the branches page. But when I create a Pull Request from the link on the branches page it always shows 0 builds. Including when pushing new commits to the branch, which do appear on the branches page.

In the same Workspace there were already repo configured to use Bamboo for builds.

Can there be a conflict between the repos even though Bamboo nor any pipelines have been configured on my repos?


Answers:
author: seanaty
body: Hi [@Yak Hawkes](/t5/user/viewprofilepage/user-id/4514992)

For commit statuses to show on the pull request page the following criteria needs to be met:

* the commit has of the commit status matches the current commit has of the source PR branch
* if the commit status refname is null or it matches the branch name of the source branch.

Double check that the refname you're using to create the commit status are either null or that if they are set, the match the branch names that the correspond to.

comments: author: Yak Hawkes
body: Yep, the script I was using was setting the refname to \`buildTriggerId: ${message.buildTriggerId}\`  
As soon as I changed it to the branch name the build status appeared on the Pull Request :D


author: Yak Hawkes
body: .


author: Mark C
body: Hi [@Yak Hawkes](/t5/user/viewprofilepage/user-id/4514992),  

Thank you for reaching out to the community.  

The API endpoint you've provided is updating your commit's build status.  
For this, there shouldn't be a conflict when you update your commit's build status.  
Because regardless of what you integrate into your repository (e.g. Bamboo, Pipelines, or Google Cloud Build) all statuses will be listed in your commit's status.  

Would it be possible for you to check if you're successfully sending the API endpoint to update your Bitbucket Cloud's repository commit after creating a PR from the **Branch** page and making a commit?  

Regards,  
Mark C

comments: author: Yak Hawkes
body: Hi Mark,

<br />

I created a test branch with a commit and pushed that to one of our repositories. I could see the successful build in the branches page and on the list of commits on Create Pull Request page.

<br />

One the PR was created there are 0 builds shown to the right of the page and none in the list of commits.

<br />

I made another commit, push that to the same branch and can see the in-progress and successful build status appear on the repository's commits page.

<br />

But still on the test PR it show 0 builds on the right on the page and no build status in the list of commits (nor is there a heading for Builds in the commits list on the PR page.

Thanks for your help  

Yak


author: Mark C
body: Hi [@Yak Hawkes](/t5/user/viewprofilepage/user-id/4514992)  

Thank you for that information.  
For us to fully investigate and check the issue, I went ahead and created a support request on your behalf.  
You should receive an email with this and we'll contact you to work on this case.  

Please let me know if you have any questions.  

Regards,  
Mark C


Tags: bitbucket-cloud

cloud