简体   繁体   English

github-jenkins 网络钩子问题

[英]github-jenkins webhook issue

i am trying to integrate github with jenkins.我正在尝试将 github 与 jenkins 集成。 while doing this i added github webhook with below jenkins address在执行此操作时,我添加了带有以下 jenkins 地址的 github webhook

http://xxx.xxx.1.103:8080/github-webhook/ http://xxx.xxx.1.103:8080/github-webhook/

however on adding it in github, i get below message(as shown in screenshot-red warning) "Last delivery was not successful, could not connect to server"但是在将它添加到 github 时,我收到以下消息(如屏幕截图红色警告所示)“上次交付未成功,无法连接到服务器”

When i do any commit/push jenkins build is not getting triggered.当我做任何提交/推送时,jenkins 构建没有被触发。 Please refer to attached screenshots.请参考附件截图。

Is there any settings i am missing here?我在这里缺少任何设置吗?

I tried couple of things here however could not succeed: 1.have opened my ports 8080 on internet and tried to do the push event.我在这里尝试了几件事,但是没有成功: 1.在互联网上打开了我的端口 8080 并尝试执行推送事件。 2.copied "override hook url" specified in jenkins 3.instead of webhook i tried to add it as service too, but it didnot work 2. 复制 jenkins 中指定的“覆盖钩子 url” 3. 而不是 webhook 我也尝试将其添加为服务,但它没有用在此处输入图片说明

I still can see you actually use 192.168.1.103我仍然可以看到你实际上使用了 192.168.1.103

... It cannot be reached by GitHub since private IPs are not rooted in the internet. ... GitHub 无法访问它,因为私有 IP 未植根于互联网。

You have to use an external IP you can reach from the Internet.您必须使用可以从 Internet 访问的外部 IP。 If you are connected to the internet using a gateway/router than you will have to setup some kind of forwarding.如果您使用网关/路由器连接到互联网,则必须设置某种转发。

The issue over here is that your GitHub cannot find the IP address that you have set.这里的问题是您的 GitHub 找不到您设置的 IP 地址。 To find your IP address you can use ngrok and then find your IP on the port where your jenkins is running example:要查找您的 IP 地址,您可以使用 ngrok,然后在您的 jenkins 运行示例的端口上查找您的 IP:

ngrok http 8080 ngrok http 8080

To know how ngrok works refer : https://ngrok.com/product要了解 ngrok 的工作原理,请参阅: https ://ngrok.com/product

You will then get your IP address on port 8080, which will look something like https://228b9f82.ngrok.io/github-webhook/ .然后,您将在端口 8080 上获得您的 IP 地址,该地址类似于https://228b9f82.ngrok.io/github-webhook/ Write this as your Payload URL.将此作为您的有效负载 URL。 At this point when you save it, it will send a post request to ngrok server, got redirected to localhost and you will see a green tick.此时当你保存它时,它会向 ngrok 服务器发送一个 post 请求,被重定向到 localhost,你会看到一个绿色的勾号。

Also for complete integration process(Setting up) of jenkins github webhook refer this : https://dzone.com/articles/adding-a-github-webhook-in-your-jenkins-pipeline对于 jenkins github webhook 的完整集成过程(设置),请参考: https ://dzone.com/articles/adding-a-github-webhook-in-your-jenkins-pipeline

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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