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

Max DeCurtins October 29, 2020

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
Atlassian Team members are employees working across the company in a wide variety of roles.
October 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.

Max DeCurtins October 30, 2020

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
AUG Leaders

Atlassian Community Events