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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

What does Bitbucket consider a "build" for merge checks?

What does Bitbucket count as a "build" when doing a merge check for "# of passed builds" on pull requests?

We have Bamboo build plans tied to various branches of our repositories, which are kicked off when new commits are pushed to those branches. The Bamboo build plan is responsible for building Docker images, etc. These builds show up in Bitbucket.

I would like to create a Bitbucket Pipeline that runs some code linting when a pull request is created or updated. If the linting fails, I want to block the PR from being merged, even if a Bamboo build succeeded. Does a successful run of a pipeline count as a "build"?

How do I get the PR to block merging if the linting script exits with a non-zero status code? Can I make Bitbucket distinguish between a Bamboo build and a Pipeline run?

1 answer

0 votes
seanaty Atlassian Team Oct 29, 2020

Does a successful run of a pipeline count as a "build"?

Yes. Ultimately these tools use Bitbucket's commit status API to set a status for a commit (pending, successful, failed) and these appear throughout bitbucket wherever commits appear.

If you have > 1 build you would want to configure the '# of builds passed' to be the number of expected builds. Say 1 for linting with Pipelines and 1 for the Bamboo build.

 

Can I make Bitbucket distinguish between a Bamboo build and a Pipeline run?

Not in terms of satisfying merge checks, however these tools set the name and URL of the commit status which could be used to determine what it is.

So, just to confirm, there is no way to ensure that a failed Pipeline, specifically, would block a PR from being able to be merged? Someone could just re-run the Bamboo build and that would bump the "# of builds passed" +1 and then they could merge the PR anyway?

It sounds like there is nothing I need to do specifically with the Bitbucket exit code of the pipeline, e.g.

image: node:12.18.3

pipelines:
pull-requests:
'**':
- step:
name: Build and Lint
script:
- npm install
- npm run lint

 If either of the npm scripts fail, the pipeline fails and is counted as a failing "build"?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,776 views 10 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you