2014-09-18 67 views
7

我有一個jenkins實例,它連接了一個windows從屬機器。我也有一個運行在github上的工作,我有觸發器 - 「將更改推送到GitHub時創建」。Github-Jenkins從屬觸發問題

當我向github推送更改時,jenkins上沒有觸發構建。我檢查,看看有效載荷也獲得tranferred在「Github的鉤日誌」詹金斯,但我得到了以下錯誤:

Started on Sep 18, 2014 3:57:06 PM 
Using strategy: Default 
[poll] Last Built Revision: Revision ce6a183e834a3e31afa0eb83a4418b0619c8642b (origin/master) 
> "C:\Program Files (x86)\Git\cmd\git.exe" ls-remote -h https://xx/xx/xx master # timeout=10 
FATAL: hudson.plugins.git.GitException: Error performing command: "C:\Program Files (x86)\Git\cmd\git.exe" ls-remote -h https://xx/xx/xx master 
hudson.util.IOException2: hudson.plugins.git.GitException: Error performing command: "C:\Program Files (x86)\Git\cmd\git.exe" ls-remote -h https://xx/xx/xx master 
    at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:462) 
    at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:357) 
    at hudson.scm.SCM.poll(SCM.java:374) 
    at hudson.model.AbstractProject._poll(AbstractProject.java:1428) 
    at hudson.model.AbstractProject.poll(AbstractProject.java:1331) 
    at com.cloudbees.jenkins.GitHubPushTrigger$1.runPolling(GitHubPushTrigger.java:73) 
    at com.cloudbees.jenkins.GitHubPushTrigger$1.run(GitHubPushTrigger.java:98) 
    at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118) 
    at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
    at java.lang.Thread.run(Thread.java:744) 
Caused by: hudson.plugins.git.GitException: Error performing command: "C:\Program Files (x86)\Git\cmd\git.exe" ls-remote -h https://xx/xx/xx master 
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1444) 
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1225) 
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1138) 
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1129) 
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getHeadRev(CliGitAPIImpl.java:2059) 
    at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:495) 
    at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:460) 
    ... 13 more 
Caused by: java.io.IOException: Cannot run program ""C:\Program Files (x86)\Git\cmd\git.exe"": error=2, No such file or directory 
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041) 
    at hudson.Proc$LocalProc.<init>(Proc.java:244) 
    at hudson.Proc$LocalProc.<init>(Proc.java:216) 
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:780) 
    at hudson.Launcher$ProcStarter.start(Launcher.java:360) 
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1433) 
    ... 19 more 
Caused by: java.io.IOException: error=2, No such file or directory 
    at java.lang.UNIXProcess.forkAndExec(Native Method) 
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:135) 
    at java.lang.ProcessImpl.start(ProcessImpl.java:130) 
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1022) 
    ... 24 more 

基本上抱怨不能夠運行命令C:\Program Files (x86)\Git\cmd\git.exe" ls-remote -h https://xx/xx/xx master

但作爲我手動進入我的奴隸機器並運行命令,它工作正常。

請注意, 1.我做了調整jenkins奴隸服務作爲管理員登錄,因此它具有所有權限。 2.我的默認詹金斯服務器是一個Linux機箱,從機是一個窗口框。顯然,兩者都有不同的git可執行文件路徑。所以我想知道如果jenkins因爲某些原因在我的linux機器上運行這個命令。

我有項目設置,讓系統只從窗戶框運行,因爲它建立罰款(所以它是能夠找到適合工作的git的可執行文件)

任何指針工作正常?

也沒有人知道jenkins的github插件如何與slave機器一起工作(它是否在奴隸中尋找git或者它是否去jenkins駐留的地方,因爲這可能是源,儘管不知道解決方案是什麼那奇怪的情況是?)

回答

5

我嘗試了一個解決方法,在我的git SCM定義的Windows作業中添加「強制使用工作區輪詢」作爲「其他行爲」。這解決了我的問題 - 不是最好的方法但有效。

如果輪詢在Linux節點(主服務器)上運行,但以某種方式決定需要使用Windows git配置來輪詢主服務器,這可能會導致Linux主服務器嘗試從Windows git位置執行git,而是Linux git位置(這是我的項目中發生的情況)。這將是一個bug,我對這個bug感到驚訝,因爲有許多安裝了Jenkins git的應用程序,它們使用Linux和Windows從屬組合。 我並不知道這樣的錯誤,但由於「使用工作區強制輪詢」爲您解決了問題,因此可能暗示這是一個需要進一步調查的區域。