Multibranch pipeline job not showing open pull requests
Asked Answered
D

4

17

I have configured a multibranch pipeline job in Jenkins linked to our GitHub repo which is working nicely, feeding back the status of checks to the pull request in our GitHub so we know if the branch is good for merging in.

What I don't see are any open pull requests listed against the Job in Jenkins:

enter image description here

We also have the Blue Ocean plugin in installed and no PR's are shown there either.

Anyone know why this is the case? Am I missing another plugin\config?

Distribution answered 27/4, 2017 at 8:48 Comment(1)
I have the same problem. Scan Repository does detect the pull request but no Job is created. I tried what @burnettk suggested but without success. The Pull request is detect - I see it in the "scan repository log" - but no Job is created.Hienhieracosphinx
M
24

I had this issue as well. I tried what joey suggested, but that did not work. I found out that if you add PR-.+ (or PR-* as a wildcard) to your regex filter for branches to include, the pull requests "magically" appear. The documentation of this was found here. It's very frustrating that the "official" documentation for this plugin does not explain this (at least from what sparse documentation I could find). The configuration for my project, which works, is here: Picture.Jenkins.MultiBranch.Pipeline.PullRequests.addTo.Github.FilterDiscover.And.BlueOcean.png

I'm not sure if this is a recommended way to use this plugin for this use case, but Jenkins never seems to have ample documentation.

Mcdade answered 18/3, 2018 at 17:7 Comment(4)
re magic constant word PR-*, which are not the name of our branches nor the name of the url for github for a pull : I found this explanation: " the name of the PR (which will always be PR-... unless the SCMSource uses a different prefix for its change request concept (wink))" on Changelog for Version 2.2.4 (Nov 2, 2017) wiki.jenkins.io/display/JENKINS/SCM+API+PluginCalycle
Thank you! This is why I love stackoverflow. So obvious, of course there was a second list of magic identifiers, that only correspond to the internal Pull Request ID on Bitbucket. So obvious in hindsight. You just saved me a lot of pain!Avaunt
In my case adding PR-* regex did not work for some of the pipelines. Removing the filter itself let PR be shown on the list. This is just FYI. I do not encourage this path.Wrinkle
I used Bitbucket Branch Source Plugin, and it turned out I had to add pull-requests/*/from in Branch Sources > Add > Discover other refs, and if you are using Filter by name (with regular expression) then you will have to append |pull-requests-.* to it.Nike
G
3

I was getting the same issue. But this time within Blue Ocean UI as shown below

enter image description here

The fix was to switch from using Git to GitHub Branch Source at the job level and configure GitHub Branch Source. The job type was Multibranch pipeline.

Gamma answered 4/8, 2017 at 5:23 Comment(8)
Why would I create an entirely new question when the context of the question I was trying to have answer is in this same post? Besides, I ended up answering my own question, so there was really not point ever in me removing my post.Gamma
Why would you create an entirely new question? Because it is an entirely new question. It's definitely not an answer. But now that you've edited into an answer, all is fineLookin
The fix for the author is the same fix for me. Therefore, the fix should be contained here. Otherwise we are just creating duplicates lol. Also, if we could post images into comments, that would be nice.Gamma
I am also having this problem in blue ocean. I created the job with the "GitHub Organization" type which scans a github organisation. Everything else works except the pull request page. Did you still need to install the github pull request builder plugin?Quoit
Yes I definitely had that pluggin installed as well when it was working for me. again, the only issue was the job level configurationGamma
This does not seem to work form me :( I am using the "GitHub Organization" job jype. Is that the job type you mean? Where are you changing your settings?Quoit
The author for this particular post was having problems with "Multibranch Pipeline" job type. This allows a job to be configured with github repository and build/deploy on checkin, etcGamma
Ah. I missed the job type in the title. Thanks for pointing it out. Blue ocean seemed to create using the "GitHub Organization" job type automatically. I will see if i can swap it. If not, i'll start a new stackoverflow question... i bit silly to hijack this one :)Quoit
H
0

One possible cause could be that GitHub is unable to connect to Jenkins directly due to a firewall. This is likely the case if GitHub never reports the status check as completed, in other words, it hangs forever.

In this case, polling is an easy solution. Go to http://_jenkins_ip_:8080/job/_job_name_/configure and select the "Scan Repository Triggers" tab. Tick the "Periodically if not otherwise run" checkbox and select an interval. I have 15 minutes on mine.

The first time this is done, there should be an immediate scan and it should detect the pull request, otherwise, there might be something else going on. Check the "Scan Repository Log" page on the job, as it might have useful info.

By the way, I did not install the "GitHub Pull Request Builder Plugin" as the page says that it has a security issue. Instead, the "GitHub Branch Source Plugin" is being used. Some other related plugins installed:

Git client plugin
Git plugin
GitHub API Plugin
GitHub Authentication plugin
GitHub Integration Plugin
GitHub plugin

I'm also using Blue Ocean, but this is not required, it simply provides a different UI.

Hayman answered 23/7, 2018 at 14:55 Comment(0)
D
0

I know that this is an old topic, but I had the same issue while I was trying to visualize my Pull Requests from Bitbucket and I hope this answer will help other people in need. In my case, I was using Bitbucket Push and Pull Request Plugin, which is pretty similar to other GitHub Plugins for Jenkins. My problem came from the fact that I selected Git instead of Bitbucket in Branch Sources >> Add Source section. I suspect the same thing happened in this case, where the two options Git and GitHub are even easier to confuse.

Dissected answered 13/12, 2021 at 13:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.