Can I trigger Bitbucket pipeline with pull request?

Normally the pipeline is triggered by push. There is the possibility to configure an 'on pull request' webhook, but how to connect it with a pipeline and disable or reconfigure the default 'Pipelines' webhook which triggers on push?

6 answers

4 votes

Yeah, I would love this feature. The ideal workflow in my mind is to have the build pass as a requirement before merging the Pull Request. This keeps your deployment branches clean. After the PR is merged, the current feature set is nice to watch master/development branches and deploy them as changes are made (ie PRs are merged).

Hi Marian,

At the moment it is not possible to trigger a pipeline on a pull request being created. However, pipelines run on the source branch will be displayed along with the pull request. If this is something you would like in the product please create a feature request at https://bitbucket.org/site/master/ telling us what you'd like in this feature. 

1 votes

I needed to trigger bitbucket pipeline for every created pull requests. As this is not available by default, I've managed to do it with a simple zapier zap, here is the tutorial :
https://medium.com/@kyann/how-to-launch-a-bitbucket-pipeline-on-pull-request-creation-aka-launch-sonar-on-pull-request-efc7e93679fc

0 votes

So the idea here is that, instead of running your pipeline on every push you run it on every PR creation?

Is it not more convenient to build and test your code ASAP?

yes, you are right, it is more convenient to test code ASAP but for a small private or open source project you quickly run out of your 50 minutes if you build on every push.

Exactly @Jan Steinke. Developers on any team should be encouraged to push their branches to remote often, even before raising a PR, without worrying about consuming build minutes on unnecessary builds. They can add [skip ci] to commit messages, but will often forget to do so.

It would be, but when we start having to pay for minutes to build, I think I will want this feature too. That way I could setup pipelines to only run tests on the master branch, and if anyone creates a pull request to the master branch, those also get run through pipelines. This might help save some minutes.

totally agree with you. Just for info, there is a cache feature now that should save some seconds on each pipeline run. 

0 votes

We also want to have this feature and came up with a workaround outlined here: https://bitbucket.org/site/master/issues/13438/add-specific-pipelines-configuration-for#comment-40276332

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

683 views 0 4
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot