Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Deployment is not triggered on pull-requests when using bitbucket-pipelines

Bram van Dooren December 21, 2018

I am trying to do a deploy when a pull request is merged into the master branch using bitbucket-pipelines however the deploy is not triggered. If I change from pull-requests to branches it does work. 

The bitbucket-pipelines.yml look like:

image: 'ruby:2.4.0'
pipelines:
pull-requests:
master:
- step:
name: 'Deploy to production'
deployment: production
caches:
- bundler
script:
- 'bundle install'
definitions:
caches:
bundler: ./vendor

Any help is appreciated. 

3 answers

1 accepted

1 vote
Answer accepted
Aneita
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 1, 2019

Hey @Bram van Dooren,

 

Thanks for reaching out.

Pipelines that are defined for pull requests will run only if there is a pull request open for the branch defined. i.e. in your example above, the pull-requests pipeline will run when a PR is open from the master branch (not when a PR is merged into the master branch).

Branch pipelines run on every push to the branch, so if you'd like your deployment to run when you merge to master, you should define that as a branch pipeline for the master branch. That way, every push to the master branch will trigger the pipeline and the deployment will run. 

For more information about pull request pipelines, you can check out our documentation

Hope this info helps! 

Bram van Dooren January 2, 2019

Hello @Aneita,

 

Thank you for the clarification, I will use the branch pipeline instead.

Like • Aneita likes this
nickcub
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 4, 2019

Hello, I ran into this problem as well.
I modified my bitbucket-pipelines .yml this way:

pipelines:
pull-requests:
'**':
- step:
script:
{script code}

My goal is to trigger pipeline, when someone creates PR into master, but this is not working.
I have tried other combinations, but it still didn't work.

Thanks for any help.

Like • 3 people like this
Aneita
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 6, 2019

Hey @nickcub,

 

Thanks for reaching out. Can you please raise a support ticket so that we can look at your repository in more details? 

 

Thanks, 

Aneita

Volodymyr T
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 21, 2025

This behaviour is unintuitive.

I have the same issue and I don't understand why pipeline trigger should be source branch, not the destination branch.

General use case across all projects across all git system (like GitHub, Azure DevOps and others) is that pipeline in pr should check that project is valid to be merged into destination branch. Because it's the destination branch that is critical, if something wrong is merged there, it will be automatically deployed by another pipeline and will crash production. 
Hence usually branch protection rules are made to block pull requests in critical branches, that do not pass the specified condition.

Why this behavior is unintuitive? Because it runs pr pipeline for pull request from the specified branch. So to protect critical branch, i need to run pr pipeline for all pull requests across the project, even if they do not target the critical branch. And this is wastefull for resources and burns down pipeline minutes.

Like • Phạm Huy Phát likes this
Phạm Huy Phát
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 27, 2025

I agree, I don't know what lead to the decision to choose SOURCE_BRANCH as pipeline reference. Most developers does not think this way.

 

1 vote
Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 28, 2018

Hello @Bram van Dooren,

I was able to reproduce a similar scenario with my repository when the bitbucket-pipelines.yml file is not in synch between branches.

We opened a bug report for this problem: https://bitbucket.org/site/master/issues/17873/pipelines-yml-file-for-pull-requests

Let's wait for the outcome of our developers on this, but until there, please try to make all bitbucket-pipelines.yml files in synch across branches and that should fix the issue.

Bram van Dooren January 2, 2019

Hello @Daniel Santos,

Thank you for your response.

The file bitbucket-pipelines.yml was already in sync across the branches. The issue was as mentioned by @Aneita that I assumed the deployment would be triggered when a pull-request was merged into the master branch.

Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 2, 2019

Hey @Bram van Dooren, I didn't understand you correctly. I got that you wanted the pull request merging to master, but didn't get that you wanted the trigger only when the merge was happening. Your write was clear, but I managed to understand the way I wanted =|
I'm glad the @Aneita was able to jump in and clarify this for us. At least I was able to find another issue that needed to be reported.

See you in the next thread!

Like • Bram van Dooren likes this
0 votes
Myrat Altyyev
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 22, 2023

I had a similar issue. It worked before, but suddenly nothing worked (neither pull-request nor merge).

I had to manually trigger the pipeline (from pipelines menu on the right side press "run pipeline", then select the branch and the pipeline you want to run).

Not sure what the problem is and when it will be solved.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events