【发布时间】:2016-05-10 20:12:54
【问题描述】:
场景
- 我们有两个构建从站(
xcode7和xcode2)运行完全相同的 Mac OS X El Capitan 实例,并且都使用相同的构建工具 (Xcode 7.3)。 - 在 Jenkins SSH 从属插件凭据中设置了一个名为“superbuilder”的用户帐户,它在通过私钥和密码启动 SSH 时提供凭据。
superbuilder是两个构建从站上都存在的用户,并且在两台机器上都有匹配的私钥和公钥。 - 其中一个从属服务器 (
xcode2) 可以克隆我们的存储库,而另一个 (xcode7) 则不能,因为git init失败with status code 1:(请参阅下面的堆栈跟踪)。
事物的不同版本
- Jenkins 版本:
1.580.1 - Git 插件版本:
1.13.3 - SSH 从站插件版本:
1.9 - 两台机器上的 Git 版本:
2.6.4 (Apple Git-63)
我在 xcode7 上尝试过什么
- 广泛搜索 Jenkins 错误和“状态代码 1:”。
- 确保
superbuilder用户拥有与xcode2上完全相同的公钥、私钥和已知主机。 - SSH 直接进入
xcode7并在本地调用完全相同的 git clone 命令。这成功了,我可以手动克隆 repo。 - 确保
git二进制文件在其$PATH 上对superbuilder可见。 - 确保
buildmaster对 jenkins 工作区目录具有读/写/执行权限。 - 确保
DEVELOPER_DIR被注入一个环境变量并指向/Applications/Xcode
问题
-
xcrun error是否相关?我的意思是 是我的问题的根源还是其他原因? -
status code 1指的是什么? - 为什么
git init在通过 Jenkins SSH 从属插件运行时会失败? - 如果你能帮忙,我可以给你买杯啤酒吗?
- 这是真实的生活吗?
来自 Jenkins 构建作业的堆栈跟踪
[EnvInject] - Mask passwords passed as build parameters.
Started by user anonymous
[EnvInject] - Loading node environment variables.
Building remotely on xcode7-xcode (xcode7) in workspace /var/jenkins/workspace/mobile.iphone-app-xcode7.ci
Cloning the remote Git repository
Cloning repository git@git.somecorp.com:mobile/iphone-app.git
> git init /var/jenkins/workspace/mobile.iphone-app-xcode7.ci # timeout=10
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Could not init /var/jenkins/workspace/mobile.iphone-app-xcode7.ci
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:656)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:463)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:152)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:145)
at hudson.remoting.UserRequest.perform(UserRequest.java:121)
at hudson.remoting.UserRequest.perform(UserRequest.java:49)
at hudson.remoting.Request$2.run(Request.java:324)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
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:745)
at ......remote call to xcode7-xcode(Native Method)
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1356)
at hudson.remoting.UserResponse.retrieve(UserRequest.java:221)
at hudson.remoting.Channel.call(Channel.java:752)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:145)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:131)
at com.sun.proxy.$Proxy81.execute(Unknown Source)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1057)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1097)
at hudson.scm.SCM.checkout(SCM.java:488)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1253)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:622)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:528)
at hudson.model.Run.execute(Run.java:1745)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
Caused by: hudson.plugins.git.GitException: Command "git init /var/jenkins/workspace/mobile.iphone-app-xcode7.ci" returned status code 1:
stdout:
stderr: xcrun: error: missing DEVELOPER_DIR path: /Applications/Xcode
...
【问题讨论】:
-
这看起来很相关:
error: missing DEVELOPER_DIR path: /Applications/Xcode -
/Applications/Xcode是否存在于 xcode7 上? -
它没有。但我也从
xcode7-codeJenkins 配置屏幕上删除了那个 ENV 变量。 -
我也不确定这是否是我的问题。
-
@mkasberg 我认为您对那个奇怪的 ENV 变量可能是正确的。以前,每当我们与该从属设备建立连接时,我都会注入它,但我停止注入它,但我从未重新启动机器。我循环了从机,现在之前注入的 ENV 变量已经消失了。如果您放弃与此相关的答案,我会将其标记为已接受。