简体   繁体   English

Github 本地 Jenkins 服务器上的 Webhook

[英]Github Webhook on Local Jenkins Server

I would like to know is it possible to set a Github Webhook on Local Jenkins Server?我想知道是否可以在本地 Jenkins 服务器上设置 Github Webhook? Is there any Jenkins plugin to solve this kind of problem?有没有Jenkins插件可以解决这种问题? Thanks.谢谢。

Yes, it is possible , however you'll need to connect your local Jenkins server to the inte.net, using a tool like ngrok . 是的,这是可能的,但是您需要使用 ngrok 之类的工具将本地 Jenkins 服务器连接到inte.net

I have searched a lot to configure my local jenkins server with Github Webhook and finally with the help of serveo.net make it work by following below steps -我搜索了很多以使用Github Webhook配置我的本地jenkins server ,最后在serveo.net的帮助下按照以下步骤使其工作 -

  1. Open terminal and paste command: ssh -R 80:<localhost_with_port_number> serveo.net打开终端并粘贴命令: ssh -R 80:<localhost_with_port_number> serveo.net

    eg ssh -R 80:127.0.0.1:8080 serveo.net例如 ssh -R 80:127.0.0.1:8080 serveo.net

  2. It will give you an accessible url -它会给你一个可访问的 url -

    在此处输入图像描述

  3. Your local jenkins server will be accessible on given url -您的本地 jenkins 服务器将可以在给定的 url 上访问 -

    在此处输入图像描述

  4. Use this url in your webhook configuration -在您的 webhook 配置中使用此 url -

    在此处输入图像描述

    Now your local jenkins server is ready to test any CICD activity...现在您的本地 jenkins 服务器已准备好测试任何 CICD 活动...

    Note: Each time it may generate a different url and in that case you have to update webhook configuration.注意:每次它都可能生成不同的 url,在这种情况下,您必须更新 webhook 配置。

    Happy learning!快乐学习!

In your Jenkins server, Go to “Manage Jenkins” -> “Manage Plugins” as shown below:在你的Jenkins服务器,Go到“Manage Jenkins”->“Manage Plugins”如下图:在此处输入图像描述

Search for GitHub plugin in the available list of plugins and install it, as shown below.在可用插件列表中搜索GitHub插件并安装,如下图。

在此处输入图像描述

Next go to your GitHub project's settings, click the webhooks tab on the left as shown below and add the Jenkins GitHub plugin's webhook URL there.接下来 go 到您的 GitHub 项目设置,单击左侧的 webhooks 选项卡,如下所示,然后在其中添加 Jenkins GitHub 插件的 webhook URL。

在此处输入图像描述

Everytime, a Git pull or Git push event happens, GitHub will send a HTTP Post notification to your Jenkins server via the GitHub plugin.每次发生 Git 拉取或 Git 推送事件时,GitHub 都会通过 GitHub 插件向您的 Jenkins 服务器发送 HTTP 发布通知。

You need a service like SocketXP to interconnect online GitHub or GitLab or Bitbucket project with your Jenkins server running in your local.network or in your private cloud.您需要像SocketXP这样的服务来将 GitHub 或 GitLab 或 Bitbucket 项目与在本地网络或私有云中运行的 Jenkins 服务器互连。

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

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