I try to configure Jenkins. I want a simple behavior: trigger a build on new pull request.
So, I created a job and configured it, but I checked the checkbox for:
And as you can see nothing is dropped down.
If I click the question mark on the right side, I see:
If jenkins will receive PUSH GitHub hook from repo defined in Git SCM section it will trigger Git SCM polling logic. So polling logic in fact belongs to Git SCM.
But where is the "Git SCM section"?
The Github Integration plugin will add the “Github hook trigger for GITScm polling” option for you. Which means that every time Jenkins receives a PUSH GitHub hook (from the repository you defined in the Source Code Management section) it will trigger the polling login you previously defined.
Click the GitHub hook trigger for GITScm polling checkbox on the build job. Create and copy a Jenkins API token for the Jenkins user who will run the build job. Create a trigger in your GitHub repository's settings page. Set the GitHub payload URL to be your Jenkins' IP address with /github-webhook/ appended to it.
You need to configure the webhook on your GitHub repository. Then, on every commit push, Jenkins will be notified.
So, open your repository in the browser, then go to Settings > Webhooks
and add a new one.
Then, enter the URL of your Jenkins instance followed by /github-webhook
and select the other options depending on your needs:
I was also frustrated with this topic, this was needed for me to get job triggering working from GitHub MERGE:
GitHub repo -> Settings -> Webhooks -> push type webhook with URL:
http(s)://host:<port>/github-webhook/
For me, last slash was REQUIRED, did not work without it
In Jenkins System Settings, add GitHub Server, credential for it and [x] Manage hooks
Use Test settings button to test it works
In Job configuration, Source Code Management -> Git, add repo and credentials
Under Build triggers: [x] GitHub hook trigger for GITScm polling
In GitHub webhook settings, click webhook and it shows logs how it worked under "Recent Deliveries" title
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With