我有一个jenkins实例,它附带了一个windows slave机器.我还有一个运行的作业,它驻留在github中,我有触发器 - "当一个更改被推送到GitHub时设置".
当我将更改推送到github时,jenkins上没有触发任何构建.我检查并看到有效负载确实在"Github挂钩日志"中转移到jenkins但我收到以下错误:
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.(Proc.java:244) at hudson.Proc$LocalProc. (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. (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 slave服务以admin身份登录,以便它拥有所有权限.我的默认jenkins服务器是一个linux盒子,奴隶机器是一个windows盒子.显然两者都有不同的git可执行路径.所以我想知道jenkins是否出于某种原因在我的linux机器上运行此命令.
我确实有项目设置只在windows slave盒子上运行,并且工作正常,因为它构建正常(因此它能够找到作业的git可执行文件)
有什么指针吗?
也有人知道jenkins的github插件如何与slave机器一起工作(它是否在奴隶中寻找git或者它是去jenkins所在的地方,因为它可能是源,但不知道这个奇怪案例的解决方案会是什么是?)
我试着在我的git SCM定义的windows作业中添加"强制轮询使用工作区"作为"附加行为".这解决了我的问题 - 不是最好的方法,但有效.
如果轮询在Linux节点(主节点)上运行,但不知何故决定它需要使用Windows git配置来轮询主节点,这可能导致Linux主机尝试从Windows git位置执行git,而不是Linux git location(这是我项目中发生的事情).这将是一个错误,我对这个错误感到惊讶,因为有许多Jenkins git的安装使用了大量的Linux和Windows奴隶.我不知道这样的错误,但由于"使用工作空间强制轮询"为您解决了问题,它可能暗示这是一个需要更多调查的领域.