Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-28976

windows master, mac slave, polling fails trying to launch windows GIT_SSH program

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Blocker Blocker
    • git-plugin
    • None
    • Windows Master
      MacOS slave
      Jenkins ver. 1.509.4
      jenkins-git plugin 2.2.12
      jenkins git client plugin 1.17.1

      When I have a Mac slave node attached to the Windows master node, it always fails git polling with a message like this:

      On my Windows master, the environment variable GIT_SSH is set to C:\Program Files\TortoiseSVN\bin\TortoisePlink.exe (we also have subversion installed and this plink executable has been verified as working properly with github and our SSH key).

      When we have the same job configured to run on a schedule, it always works. It only fails with this error when we use git polling.

      I had previously encountered a similar problem that the Mac slave was attempting to run git.exe which I fixed by configuring the local tool location for the node to /usr/local/bin/git.

      Started on Jun 18, 2015 2:46:52 PM
      Using strategy: Default
      [poll] Last Built Revision: Revision ce3c4ab9a700abf4d4874ff9116c49f68e3905c9 (refs/remotes/origin/master)
       > /usr/local/bin/git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repositories
       > /usr/local/bin/git config remote.origin.url git@github.com:daz3d/Scruffy # timeout=10
      Fetching upstream changes from git@github.com:daz3d/Scruffy
       > /usr/local/bin/git --version # timeout=10
       > /usr/local/bin/git -c core.askpass=true fetch --tags --progress git@github.com:daz3d/Scruffy +refs/heads/*:refs/remotes/origin/*
      FATAL: Failed to fetch from git@github.com:daz3d/Scruffy
      hudson.util.IOException2: Failed to fetch from git@github.com:daz3d/Scruffy
      	at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:496)
      	at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:356)
      	at hudson.scm.SCM.poll(SCM.java:373)
      	at hudson.model.AbstractProject.pollWithWorkspace(AbstractProject.java:1549)
      	at hudson.model.AbstractProject._poll(AbstractProject.java:1521)
      	at hudson.model.AbstractProject.poll(AbstractProject.java:1455)
      	at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:439)
      	at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:468)
      	at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      	at java.util.concurrent.FutureTask.run(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      	at java.lang.Thread.run(Unknown Source)
      Caused by: hudson.plugins.git.GitException: Failed to fetch from git@github.com:daz3d/Scruffy
      	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:668)
      	at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:575)
      	at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:494)
      	... 14 more
      Caused by: hudson.plugins.git.GitException: Command "/usr/local/bin/git -c core.askpass=true fetch --tags --progress git@github.com:daz3d/Scruffy +refs/heads/*:refs/remotes/origin/*" returned status code 128:
      stdout: 
      stderr: error: cannot run C:\Program Files\TortoiseSVN\bin\TortoisePlink.exe: No such file or directory
      fatal: unable to fork
      
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1591)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1379)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:86)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:324)
      	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:118)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      	at hudson.remoting.Request$2.run(Request.java:326)
      	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
      	at java.lang.Thread.run(Thread.java:695)
      Done. Took 0.14 sec
      No changes
      

          [JENKINS-28976] windows master, mac slave, polling fails trying to launch windows GIT_SSH program

          Mark Waite added a comment -

          The GIT_SSH environment variable on the master seems to have the same value on the Mac slave. You'll need to find a way to either set GIT_SSH only on the master node, or to set it on the master node, and also set it (with a different value) on the slave.

          This is not a git plugin bug. I propose to close this as "Not a Defect". If my suggestion does not resolve the issue, please send your question to the Jenkins mailing list where more users are available to help you. Bug reports are reviewed by far fewer people than read messages on the mailing list.

          Mark Waite added a comment - The GIT_SSH environment variable on the master seems to have the same value on the Mac slave. You'll need to find a way to either set GIT_SSH only on the master node, or to set it on the master node, and also set it (with a different value) on the slave. This is not a git plugin bug. I propose to close this as "Not a Defect". If my suggestion does not resolve the issue, please send your question to the Jenkins mailing list where more users are available to help you. Bug reports are reviewed by far fewer people than read messages on the mailing list.

          Richard added a comment -

          Thanks for the reply, Mark.

          However, what you describe (only set it on the master and don't set it on the slave) is what I am already doing. Jenkins appears to be using this environment variable on the slave by getting it from the master. This is the source of the whole problem. Because it is happening during polling and not during the build, I don't know how to insert some sort of command to override the faulty setting.

          The Mac slave doesn't even need this environment variable because it already has ssh which is what git will use when the environment variable is not set. When I go to a terminal window on my Mac slave, the environment variable is not set.

          In other words, the polling log is writing out information as if it were running on the Windows machine. Why else would it try to use git.exe? That makes absolutely no sense. I had to override that on the node configuration:

          Setting the environment variable here made no difference, I get the same polling log error and the value for GIT_SSH doesn't appear in the environment variables for the node configuration.

          The reason I think this is a git plugin defect is because the exception trace prints out that the location of the problem is in the git plugin. I'm not that familiar with the jenkins API, but when I looked at the java code, it seemed that there was some code in there to deal with environment variables from the master.

          The exception dump has all the earmarks of "master has GIT_SSH=C:\Program Files\TortoiseSVN\bin\TortoisePlink.exe, slave is attempting to use this environment variable value when invoking the git client to poll the master repository".

          Richard added a comment - Thanks for the reply, Mark. However, what you describe (only set it on the master and don't set it on the slave) is what I am already doing. Jenkins appears to be using this environment variable on the slave by getting it from the master. This is the source of the whole problem. Because it is happening during polling and not during the build, I don't know how to insert some sort of command to override the faulty setting. The Mac slave doesn't even need this environment variable because it already has ssh which is what git will use when the environment variable is not set. When I go to a terminal window on my Mac slave, the environment variable is not set. In other words, the polling log is writing out information as if it were running on the Windows machine. Why else would it try to use git.exe ? That makes absolutely no sense. I had to override that on the node configuration: Setting the environment variable here made no difference, I get the same polling log error and the value for GIT_SSH doesn't appear in the environment variables for the node configuration. The reason I think this is a git plugin defect is because the exception trace prints out that the location of the problem is in the git plugin. I'm not that familiar with the jenkins API, but when I looked at the java code, it seemed that there was some code in there to deal with environment variables from the master. The exception dump has all the earmarks of "master has GIT_SSH=C:\Program Files\TortoiseSVN\bin\TortoisePlink.exe , slave is attempting to use this environment variable value when invoking the git client to poll the master repository".

          Alex Earl added a comment -

          Did you restart the slave after adding the property for the node?

          Alex Earl added a comment - Did you restart the slave after adding the property for the node?

          Richard added a comment -

          I went to the mac slave and killed the jenkins runner and the jenkins runner restarted.

          Richard added a comment - I went to the mac slave and killed the jenkins runner and the jenkins runner restarted.

            Unassigned Unassigned
            legalize Richard
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: