Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Trigger pipeline on pull request from fork

ramesh-chainyard January 6, 2019

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
Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 9, 2019

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.

Ramesh January 9, 2019

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.

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

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.

Shane M February 1, 2019

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
Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 4, 2019

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?

Shane M February 5, 2019

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.

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

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 =]

cdsb June 25, 2019

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
Federico Vidueiro November 21, 2019

@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 :-(

Like Gaurang Pansare likes this
Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 21, 2019

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 # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events