2015-04-03 112 views
0

我在windows機器上安裝了Jenkins,配置了一個使用git repo的項目。我的目標是在有人進入github時自動構建項目。爲了實現這個目標,我更新了.git/hooks目錄下的「Post-Receive」(沒有分機)文件。 代碼看起來像這樣Jenkins構建不是用git post-receive鉤子觸發的

#!/bin/bash 
curl http://localhost:9090/job/MyProject/build?token=mytoken 

當我執行curl http://localhost:9090/job/MyProject/build?token=mytoken命令或sh post-receive,詹金斯作業將被觸發。

當我將變化推入git repo(從另一臺機器)時,詹金斯的作業沒有被觸發。請分享你的想法,這將幫助我解決這個問題。

回答

1

首先,GitHub supports Webhooks, not post-receive hooks

您可以配置在您的GitHub存儲庫設置網絡掛接:github.com/[owner]/[repository]/settings/hooks

不過,如果你想把火關詹金斯的工作,你應該查看Jenkins的現有服務鉤子。

enter image description here

相關問題