It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Trigger pipeline on pull request from fork

When I create a pull request from the forked repository, the pipeline builds are not triggering. Someone please explain how pipeline works in bitbucket?

1 answer

2 votes

Hi @ramesh-chainyard,

I'll need your confirmation on what type of pull request you are doing to better address your question.

  • Are you creating a pull request from a branch to another branch in the same forked repo? or creating it from forked repo to original repo?
  • Can you describe more what is the process you follow and the expected behavior you want? 

Someone please explain how pipeline works in bitbucket?

A pipeline build will be triggered if the feature is enabled, you have minutes to build and your bitbucket-properties.yml file properly configured.

More details can be found in:

The documents above will explain general details for pipeline builds on any repository which will help you to get a general understanding of the feature. Once you answer my questions above I'll be able to better address your main question.

Thanks for the response. I am creating a "pull request from forked repo to original repo".

We have a original repo and a user forked it from it. After his/her work, submitted a pull request from a forked repo to a original reposiotry. I have enabled pipeline to develop branch and .yaml is available.

 

Could you please let me know what is the process to trigger pipelines on pull request? If this is not possible, what is the approach we have to follow to verify the changes before merge them in the original repository.

I'm sorry I didn't know this off the top of my head and like you I also ran into the same issue. A pull request from a forked repository to the main repository will not trigger any pipeline build.

IMO It makes sense that a pull request from a remote repository will not trigger any build on the main one. I say this because it would cost pipeline minutes for every strange code submission attempted (not even reviewed).

Could you please let me know what is the process to trigger pipelines on pull request? 

Pipelines pull request for the same repository will trigger builds when the pull request is created or updated but only if it is a pull request for the same repository. So in your forked repository you can create a pull request from a branch to another, and the build should be triggered if the pull request is configured according to Configure bitbucket-pipelines.yml - Atlassian Documentation (pull-requests section).

In the same section you will see the information we were looking for about the forked repositories.

"This only applies to pull requests initiated from within your repository; pull requests from a forked repository will not trigger the pipeline."

Let me know if this answers your question.

Can this be enabled somehow? We have a private repo so not worried about unwanted commits and we usually use a fork, work on fork, make pull request to upstream workflow?

Like # people like this

It cannot be enabled, but thinking about this I believe that you could possibly use the following approach:

  1. Create a new branch just for submitting pull requests from fork to the main repository
  2. Accept all the pull requests without testing them
  3. Create pull requests from this branch to the main branch. This will trigger the pipeline build which will be used to check the pull request.

Is it a possible approach for you?

Thanks for taking the time to reply. I believe your solution could work I'll try it out and see how it works, I think it still may require an additional manual step which I'm trying to avoid but maybe this can be automated too.

I'm glad I could help you at least with some ideas to move on.
If you think this question is answered/resolved, please accept this answer.

If you don't mind sharing the results of your tests, that would also be great to help others with the same issue =]

In the same position, private repo, want users to be able to submit branches from forks that trigger the pipeline.

@Daniel Santos, that solution doesn't scale to more than a single open pr at a time.

Like # people like this

@Daniel Santos same issue here. We need a way to allow triggering pipelines from forks, at least allowed users/repos. This is making us rolling back to jenkins :-(

Hi @cdsb,

I understand your point, yes, that approach is not considering pull requests from multiple branches coming from a forked repo. My suggestion was an attempt to minimize the effect of this design in your workflow. 

Somehow I forgot to mention the feature request we have to improve this behavior:

I guess the best course of action is to vote in this feature request to increase the chances of its implementation.

@Federico Vidueiro I encourage you and other users to also vote in that feature request. It is the best way to show this issue to our developers and Product managers. 

Like Federico Vidueiro likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,055 views 0 3
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you