简体   繁体   中英

How to configure GitHub Web Hook for Jenkins for inhouse server?

I have a Jenkins instance on an in-house server. There is no public IP or domain name for the server at this time. Can I still configure a webhook? I don't see how GitHub would ever be able to see and send any kind of message to this server. Do I need to set up a port forward on my top-level router? Is there a secure way to approach this?

I'm following the steps in this tutorial :

Open the “Webhooks & Services” tab -> choose “Configure Services” -> find the Jenkins (GitHub plugin option) and fill it in with a similar URL to the following: http://<Name of Jenkins server>:8080/github-webhook/

You can check your current public ip by browsing to www.whatismyip.com. then you can configure the webhook to your public ip. since this address is not really you ip address, but instead the router address - you will have to configure port forwarding on that router back to your Jenkins host. The main problem is that your ip address probably get changed when you reconnects your router - you can use a dynamic dns to have a dns record points to your current ip address.

From chenchuk 's answer

you will have to configure port forwarding on that router back to your Jenkins host

There is also an alternative approach (in Nov. 2022, 6 years later)

Webhook forwarding in the GitHub CLI (public beta) (Nov. 2022)

We've launched a limited public beta of a new feature in the GitHub CLI: webhook forwarding.

Webhook forwarding makes it easy to test your webhooks integration in your local environment without having to worry about port forwarding .

All it takes to start receiving webhooks locally is one simple command:

gh webhook forward --repo monalisa/hello-world --events issues,pull_request --url http://localhost:4000/webhooks

With webhook forwarding, you can iterate quickly on your integration without having to deploy your code to a test environment.

For more details on this new feature, head over to the docs – see "Receiving webhooks with the GitHub CLI" .

To request access to the beta program, post in our GitHub Community discussion .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM