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?

8 answers

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).

Actually, never mind that - a search reveals no current issue open on the subject, so I created one:

please vote it if you'd like this feature.


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?

Update: I have funnelled the feedback about the expense of up to date deploys back to the Bitbucket Pipelines team.

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.

Like 2 people like this

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.

+1 for this feature, and exactly for the reasons stated above.

If someone has made a feature request, could you please post the link, so we can upvote it?

This. It's a bit short-sighted to assume that every team has enough money for 'unlimited' build minutes. 

Like 1 person likes this

@Robert Massaioli The points mentioned above are nice but I'd like it for my deploy section. I want everything in master to be deployed automatically. If I merge a PR, this is new code that I need deployed.

Like 1 person likes this

Build everything = $$. Plus there may be times where I only want to perform certain actions on a PR but not a typical feature branch push. For example, when Joe is checking in code to remote feature branch for the weekend, I don't necessarily want to burn build time running static code analysis on incomplete code, but on a PR, I absolutely do.

Like 1 person likes this

This sort of ignorance of financial factors is the same sort of thinking that causes Atlassian to think that it's appropriate to skyrocket their Jira seat price if I dare wish to enforce on Two Factor Authentication for my users.

I digress.

3 votes

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 telling us what you'd like in this feature. 

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 :

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. 

We also want to have this feature and came up with a workaround outlined here:

as a workaround, you can push an empty commit

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

437 views 6 9
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