git commit 完成后运行 Jenkins build
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36936521/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Run Jenkins build when git commit is done
提问by user3021914
I know that this question is posted in different topic.But my case is a little bit different.
我知道这个问题发布在不同的主题中。但我的情况有点不同。
I want to trigger my test goal when a commit is detected by Jenkins. Most tutorials in the internet show how to do this using WebHook.
我想在 Jenkins 检测到提交时触发我的测试目标。互联网上的大多数教程都展示了如何使用 WebHook 做到这一点。
In my case I have two problems :
就我而言,我有两个问题:
1) I did not find the option "Trigger build when a commit is detected"
1)我没有找到“检测到提交时触发构建”选项
2) All tutorials speak about configuring webhook, from Git URL.in my case, my git repository is local and I did not have access to the web interface. So how to do the same thing manually ?
2) 所有教程都从 Git URL 开始讨论配置 webhook。在我的情况下,我的 git 存储库是本地的,我无法访问 Web 界面。那么如何手动做同样的事情呢?
Thank ou in advance
提前谢谢你
Configuration :
配置 :
- Jenkins Server 1.651.1
- Git Plugin 2.4.4,
- 詹金斯服务器 1.651.1
- Git插件2.4.4,
采纳答案by CodeWizard
You do it in a little bit different way:
你以一种稍微不同的方式做到这一点:
You do use a web-hook to capture when new git commit was made and in the hook you start the Jenkins job with the rest API.
您确实使用网络钩子来捕获何时进行新的 git 提交,并在钩子中使用其余 API 启动 Jenkins 作业。
https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API
https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API
Read all about it in here:
在这里阅读所有相关信息:
http://kohsuke.org/2011/12/01/polling-must-die-triggering-jenkins-builds-from-a-git-hook/
http://kohsuke.org/2011/12/01/polling-must-die-triggering-jenkins-builds-from-a-git-hook/