I have Pipelines configured to run for all `feature/**` branches and also for PR's.
When I create a PR, 2 pipelines are triggered: one for the PR, one for the source branch.
The reason for my setup is that I want development feedback asap when developing in a `feature/**` branch. Then, once the developer creates as PR, only that pipeline should run (otherwise it's just a waste to run 2 almost identical pipelines).
Any suggestions?
Hi George,
I am not on the Bitbucket team, but I will try to help.
When you say you have configured pipelines to run "for a PR" do you mean for the target branch?
Eg. Let's say your target branch is called master. Then you create a feature branch called feature/123. You do some work on the feature branch, add some commits, push the changes and then create a Pull Request from feature/123 -> master. When does a pipeline get triggered?
Let me show you my `bitbucket-pipelines.yml`:
image: thecodingmachine/php:7.3-v2-cli-node10
stepdefinitions:
- Build: &Build
name: 'Build'
# etc
pipelines:
feature/*:
- step: *Build
# etc
pull-requests:
'**':
- step: *Build
# etc
branches:
master:
- step: *Build
# etc
So, as you can see, we have 3 triggers: a one for `feature/*`, one for pull-requests (all branches) and one for master specific.
When I start developing on a `feature/my-awesome-feature`, for every push I do, it will run the pipeline for `feature/*`, as expected.
Then, when I create a pull request to merge that feature into master, it will run 2 pipeline: the `feature/*` one and also the pull-request one.
What I want to archive, is keep on running the `feature/*` one during dev, but for the PR, it should only run the PR one.
Will that be possible?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi George,
I think you can just remove the
pull-requests:
'**':
- step: *Build
# etc
from your pipelines and you will get the desired behaviour.
I hope that helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Martyn,
I don't think thats exactly the same.
The branch pipeline only tests the code in the branch as it is, whereas the pr pipelines performs a merge into the destination branch and then runs the pipeline. Meaning, it will test the situation that will exist after the merge. Or at least, that is my understanding of it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You're right, TIL!
https://bitbucket.org/blog/faster-feedback-on-merges-with-pull-request-pipelines
That sounds like a very useful build to run.
Why do you need branch builds then?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.