I have a public Github repo and an on-prem Jenkins server (this could not be changed)
I want a Jenkins job to start every time a PR is opened in the github repo.
Now, if my Jenkins had public access I will simply set up a webhook on github, but since github can not access my Jenkins what can I do to trigger the job?
Is there an option to set a webhook the other way around? meaning the Jenkins will check every few seconds/minutes if a PR was opened and if so it will trigger the job.
CodePudding user response:
You can configure the GitHub Pull Request Builder Plugin to poll for PR refspecs, although it works somewhat differently than using webhooks.
Alternatively, assuming you have connectivity from the on-premise environment to the outside, you can setup ngrok / webhook relay / smee to have a publicly-accessible address that forwards GitHub webhooks. CloudBees have a video on forwarding webhooks using ngrok.
If a DMZ is possible then using tunnels such as GitWebhookProxy, stunnel, or SSH are also good options.