3

I've got a Jenkins multibranch pipeline configured to run tests and sonarqube scans on a mac 10.14 node thats configured via javaws. At checkout, it fails during scm checkout with:

[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

I've tried:

  1. installed and initialized git-lfs via Homebrew.
  2. removed the homebrew version and installed git-lfs manually, but placing the git-lfs binary into /usr/local/bin and initializing it with git lfs install. (which is included in my node's $PATH)
  3. installed git itself via homebrew (instead of the apple dev tools) and configured it as the default git tool in the node's TOOL configuration (confirmed it's used)
  4. Initialized git-lfs at the system and local level.

I have found several articles but haven't resolved the issue. It just cannot find git-lfs during checkout.

Since I cannot move git-lfs into /usr/bin due to OSX System Integrity Protection, is there a step or configuration I'm missing here?

Let me know if i can provide further details.

jcarverqa
  • 91
  • 1
  • 6

2 Answers2

6

Resolved this with help from another thread in Jenkins issues: https://issues.jenkins-ci.org/browse/JENKINS-52857 (Specifically Jeff Meador and Lars Bilke's comments)

To work around this, I installed git and git-lfs via homebrew. I then did a git --exec-path to determine the installed path of the version of git i was using, which for me was /usr/local/Cellar/git/2.23.0_1/libexec/git-core/git.

I copied the git-lfs binary out of its Cellar location and into the git-core folder mentioned above, and then did linked it to this location with: ln -s /usr/local/Cellar/git/2.23.0_1/libexec/git-core/git-lfs /usr/local/bin/git-lfs. Once this was in place, I re-ran the build and I no longer received the error message indicating git-lfs was not found.

Hope this helps someone.

jcarverqa
  • 91
  • 1
  • 6
0

If you installed git-lfs with homebrew, which installs the executable into /usr/local/bin, a simple workaround is adding /usr/local/bin to the $PATH by creating a ~/.bashrc file in the home directory of the user to which jenkins connects to via ssh:

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

After that, you have to disconnect and restart he agent. The changed $PATH should show up in the node log.

Changing the $PATH inside the Jenkins node configuration does not seem to work, $PATH is correctly set when printing it inside the pipeline, but it seems like it is not set on checkout.

fotcorn
  • 311
  • 3
  • 8