简体   繁体   English

Git Post Hook将揭开Jenkins的职位

[英]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.

相关问题 如何使用Java发布经过身份验证的Jenkins作业 - How to POST an authenticated Jenkins job using Java 如何使用具有相关git存储库和多个分支的Jenkins作业 - How to use Jenkins job(s) with dependent git repositories and multiple branches 将DXL与月食/便笺相关联并开始处理 - Associate DXL with eclipse/notes and kick off handling 有什么办法以编程方式启动数据存储备份吗? - Is there any way to kick off a datastore backup programatically? 如何在构建后操作中保持当前的 Jenkins 作业执行,直到依赖作业完成 - How to hold the current Jenkins job execution until the dependency job completion in post build action jenkins挂钩不工作 - jenkins bitbucket - jenkins hook not working - jenkins bitbucket 是否可以使用java接口或bean启动camel路由? - Is it possible to kick off a camel route using a java interface or bean? JMeter-启动一定数量的作业,然后监视状态 - JMeter - kick off a set number of jobs and then monitor state 从Google App Engine后台任务启动外部可执行文件 - Kick off an external executable from a Google App Engine background task EJB 3.1:在无状态Bean中启动异步任务 - EJB 3.1: Kick off asynchronous task in stateless bean
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM