GitHub required status checks from Jenkins for forks vs local branches
Asked Answered
W

2

13

I have a GitHub repository established with a Multibranch Pipeline job in Jenkins, and until now have been content to require the continuous-integration/jenkins/branch status check, as Jenkins posts when building a local branch from the repo. However, I've now got a pull request from an external fork, and Jenkins has posted a continuous-integration/jenkins/pr-merge status check for that. And because the continuous-integration/jenkins/branch status check is required, the PR is blocked from being merged.

What's the expected approach here, for a project that will have a combination of local branches (from its primary maintainers) and forks (from occasional outside contributors)? Must I forgo having either of the status checks be required on the GitHub side? Or is there some other way to get Jenkins to post a stable status check context regardless of the PR's source?

Worley answered 12/10, 2017 at 20:51 Comment(0)
U
3

I had the same issue, with thanks to a helpful colleague I found that, by default, the branch source plugin builds branches that aren't necessarily associated with any pull request.

This behaviour is controlled by the "Build origin branches" tickbox in the GitHub Branch Source Plugin settings: GitHub Branch Source Plugin settings (source (currently inaccessible), WebArchive version)

This is what creates the status check of "continuous-integration/jenkins/branch".

I unticked that option and ticked the "Build origin PRs (merged with base branch)" option, and both status checks now have the same context "continuous-integration/jenkins/pr-merge" and PRs both from forks and branches now trigger the same status check.

In my setup, the tickboxes are in the organisation configuration (since I am also using the GitHub organisation plugin), under Projects > GitHub organisation > Advanced, hopefully on yours, the same options show in your multibranch pipeline config.

Hope this helps

Ushijima answered 24/10, 2017 at 14:39 Comment(4)
That cloudbees lick has been replace with a "no longer supported buy our stuff" message. Any additional references, screenshots, etc. would be appreciated in its absence.Gerladina
Related Jenkins issue - issues.jenkins-ci.org/browse/JENKINS-47434.Oxonian
@BrunoBronosky web.archive.org/web/20180722083154/https://go.cloudbees.com/…Elata
How can I rename it to just always be named "Jenkins"?Doiron
B
0

If you don't have access to the global settings of the GitHub Branch Source plugin you can change settings for the specific Jenkins folder. Set "Discover pull requests from origin" and "Discover pull requests from forks" (Configure > Projects > GitHub Organization > Within repository) to the "merging the pull request with the current target branch revision":

enter image description here

Brayer answered 15/9, 2023 at 17:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.