Jenkins Multibranch Pipeline:在Mac节点上找不到git-lfs命令

时间:2019-09-22 19:04:55

标签: macos jenkins jenkins-pipeline git-lfs multibranch-pipeline

我已经配置了Jenkins多分支管道,以在通过javaws配置的mac 10.14节点上运行测试和声纳扫描。结帐时,在scm结帐期间,失败:

[Pipeline] End of Pipeline
[Bitbucket] Notifying commit build result
[Bitbucket] Build result notified
hudson.plugins.git.GitException: Command "/usr/local/bin/git checkout -f 7dca678ce3a4a8f93fe8ed4bb4920db40c417839" returned status code 128:
stdout: 
stderr: git-lfs filter-process: git-lfs: command not found
fatal: the remote end hung up unexpectedly

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2172)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$1000(CliGitAPIImpl.java:78)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2453)
Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from platform-e2e-mac.mynetwork.com/10.1.4.49:49175
        at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1741)
        at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
        at hudson.remoting.Channel.call(Channel.java:955)
        at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:146)
        at sun.reflect.GeneratedMethodAccessor761.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132)
        at com.sun.proxy.$Proxy102.execute(Unknown Source)
        at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1242)
        at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:124)
        at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
        at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
        at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
Caused: hudson.plugins.git.GitException: Could not checkout AUTH-58-pipeline with start point 7dca678ce3a4a8f93fe8ed4bb4920db40c417839
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2493)
    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:153)
    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:146)
    at hudson.remoting.UserRequest.perform(UserRequest.java:211)
    at hudson.remoting.UserRequest.perform(UserRequest.java:54)
    at hudson.remoting.Request$2.run(Request.java:369)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:97)
    at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE

我尝试过:

  1. 通过Homebrew安装并初始化git-lfs。
  2. 删除了自制版本并手动安装了git-lfs,但是将git-lfs二进制文件放入/ usr / local / bin并使用git lfs install对其进行了初始化。 (包含在我节点的$ PATH中)
  3. 通过自制程序(而不是apple dev工具)安装git本身,并将其配置为节点的TOOL配置中的默认git工具(确认已使用)
  4. 在系统和本地级别初始化git-lfs。

我找到了几篇文章,但尚未解决问题。它只是在结帐时找不到git-lfs。

由于由于OSX系统完整性保护,我无法将git-lfs移到/usr/bin中,因此这里缺少步骤或配置吗?

让我知道我是否可以提供更多详细信息。

2 个答案:

答案 0 :(得分:0)

在詹金斯(Jenkins)问题的另一个线程的帮助下解决了此问题:This SO question(特别是杰夫·梅阿多(Jeff Meador)和拉尔斯·比尔克(Lars Bilke)的评论)

要解决此问题,我通过自制软件安装了git和git-lfs。然后,我做了一个git --exec-path来确定我正在使用的git版本的安装路径,对我来说这是/usr/local/Cellar/git/2.23.0_1/libexec/git-core/git

我将git-lfs二进制文件从其Cellar位置复制到上述git-core文件夹中,然后通过以下方式将其链接到该位置: ln -s /usr/local/Cellar/git/2.23.0_1/libexec/git-core/git-lfs /usr/local/bin/git-lfs。一旦安装到位,我就重新运行该构建,并且不再收到指示找不到git-lfs的错误消息。

希望这对某人有帮助。

答案 1 :(得分:0)

如果您使用自制软件安装了git-lfs,并将可执行文件安装到/usr/local/bin中,则一个简单的解决方法是通过在其中创建/usr/local/bin文件来向$PATH中添加~/.bashrc jenkins通过ssh连接到的用户的主目录:

export PATH=/usr/local/bin:$PATH

在那之后,您必须断开连接并重新启动代理。更改后的$PATH应该显示在节点日志中。

在Jenkins节点配置中更改$PATH似乎无效,$PATH在管道中打印时已正确设置,但似乎未在checkout上设置