简体   繁体   中英

jenkins github webhook error

i'm trying to trigger builds on jenkins when ever a pull request is merged, and trying to add the webhook, which is throwing me the below error.

payload url: http://localhost:8080/job/hook-test/

error: "We couldn't deliver this payload: Couldn't connect to server "

The URL for the webhook is localhost . GitHub is trying call the webhook on itself.

You need to deploy Jenkins in a publicly accesible URL. It won't work with a local Jenkins install in your PC.

localhost refers to the address of the current machine. When you type localhost in the browser and you access Jenkins, that works because you have Jenkins installed and running in your PC. Access localhost from a different machine and you won't be able to access Jenkins. When you tell github to send the webhook to localhost it will not try to send it to your machine, instead, it will send the webhook to the same machine in which github server is running, and that machine doesn't have Jenkins installed.

The problem here is localhost means something different for you and for github.

To solve this problem, you'll either need to install Jenkins in a public server accesible from internet (so that github can send the webhooks) or use some online service which provides hosted Jenkins servers .

You could also just get a domain and configure it to point to your PC. You would probably need to do some networking configuration but once it's done you (and github) will be able to access your jenkins via some-domain.example.io instead of localhost . Be careful, you would be making your (I asume personal) PC accesible from the internet, and that has security risks.

If you can afford it I recommend using a server in the cloud to run this. Many cloud platforms even provide a quite long free trial period (I know Amazon and Google Cloud do).

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