[英]Git Post Hook to Kick Off Jenkins Job
I would like to setup a post hook in git to kick off a jenkins job everytime someone does a push to the git server. 每当有人推送到git服务器时,我想在git中设置一个post hook来启动一个jenkins工作。 The issue is that some of the projects are on Linux, some are on windows and others on mac. 问题是一些项目在Linux上,一些在Windows上,另一些在mac上。
Everytime someone does a push into my git repo I would like the following code called: 每当有人推进我的git repo时,我想要以下代码:
cURL http://jenkins:8080/job/WebComm%20-%20Common%20Project%20for%20Communications/build?token=webcomm
But if I am right this will NOT work on the windows users right? 但如果我是对的,这对Windows用户不起作用吗?
can someone please tell me if I am right and how can I get around this? 有人可以告诉我,如果我是对的,我怎么能绕过这个?
I made a post-receive file with the following: 我用以下内容制作了一个收到后的文件:
#!/bin/sh
curl "http://jenkins:8080/job/WebComm%20-%20Common%20Project%20for%20Communications/build?token=webcomm"
but the job is not getting kicked off? 但工作没有开始?
Put it as a server-side post-receive hook and it won't matter what the user is using. 将它作为服务器端的post-receive挂钩,用户使用的内容无关紧要。 It will be what the server is running which matters. 这将是服务器运行的重要事项。
Read about all the hooks here . 阅读这里的所有钩子。
Using this as a post-recieve hook should do the trick: 使用它作为后接收钩应该可以做到这一点:
#!/bin/sh
curl http://jenkins:8080/job/WebComm%20-%20Common%20Project%20for%20Communications/build?token=webcomm
If you are on github, you can take advantage of their web hooks feature. 如果您使用的是github,则可以利用其Web挂钩功能。 It is quite reliable. 它非常可靠。
If not, you can use the server-side hooks on your own server. 如果没有,您可以在自己的服务器上使用服务器端挂钩 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.