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

Git Polling with keys fails for Windows master and OSX slave

    Details

    • Similar Issues:

      Description

      The job is configured to use the git command for unix.
      Git authentication is key based.
      When manually triggering the job, it works.
      Git Polling does not work.

      The Jenkins master is a windows machine, the slave is OS X 10.9

      Started on Nov 11, 2014 7:26:49 PM
      Using strategy: Default
      [poll] Last Built Revision: Revision 4dd28ae36ea5534d2ad666e70edbcb22b412b3ff (refs/remotes/origin/develop)
      using GIT_SSH to set credentials MobileDaily GitHub key
      > git ls-remote -h git@bitbucket.org:alexmx/en-ios-internship.git develop # timeout=10
      FATAL: hudson.plugins.git.GitException: Error performing command: git ls-remote -h git@bitbucket.org:alexmx/en-ios-internship.git develop
      hudson.util.IOException2: hudson.plugins.git.GitException: Error performing command: git ls-remote -h git@bitbucket.org:alexmx/en-ios-internship.git develop
      at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:475)
      at hudson.scm.SCM.poll(SCM.java:401)
      at hudson.model.AbstractProject._poll(AbstractProject.java:1429)
      at hudson.model.AbstractProject.poll(AbstractProject.java:1332)
      at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:515)
      at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:544)
      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.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
      Caused by: hudson.plugins.git.GitException: Error performing command: git ls-remote -h git@bitbucket.org:alexmx/en-ios-internship.git develop
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1442)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1223)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1136)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1127)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getHeadRev(CliGitAPIImpl.java:2057)
      at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:509)
      at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:473)
      ... 12 more
      Caused by: java.io.IOException: Cannot run program "git": CreateProcess error=2, The system cannot find the file specified
      at java.lang.ProcessBuilder.start(Unknown Source)
      at hudson.Proc$LocalProc.<init>(Proc.java:244)
      at hudson.Proc$LocalProc.<init>(Proc.java:216)
      at hudson.Launcher$LocalLauncher.launch(Launcher.java:803)
      at hudson.Launcher$ProcStarter.start(Launcher.java:381)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1431)
      ... 18 more
      Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
      at java.lang.ProcessImpl.create(Native Method)
      at java.lang.ProcessImpl.<init>(Unknown Source)
      at java.lang.ProcessImpl.start(Unknown Source)
      ... 24 more
      Done. Took 22 ms
      No changes

        Attachments

          Activity

          Hide
          markewaite Mark Waite added a comment -

          It is unlikely to be attempting to use the ssh from the Windows master. That would require changes to the git compiled executable on your mac. The "ssh: command not found" is a message from command line git. Command line git is invoked by the Jenkins git plugin, then command line git decides (within the compiled git program) that it needs to invoke the ssh command.

          My guess is that the PATH environment variable on the machine hosting the workspace (the mac) is wrong. It does not have ssh in the path.

          Show
          markewaite Mark Waite added a comment - It is unlikely to be attempting to use the ssh from the Windows master. That would require changes to the git compiled executable on your mac. The "ssh: command not found" is a message from command line git. Command line git is invoked by the Jenkins git plugin, then command line git decides (within the compiled git program) that it needs to invoke the ssh command. My guess is that the PATH environment variable on the machine hosting the workspace (the mac) is wrong. It does not have ssh in the path.
          Hide
          xfreebird Nicolae Ghimbovschi added a comment -

          Putting git.exe in PATH solved the issue when using windows Master - mac Slave.

          But when using "Require workspace for polling" option, I still get the "ssh: command not found". Which is weird, because the mac has ssh in PATH. Is it trying to use ssh from the windows Master ?

          Show
          xfreebird Nicolae Ghimbovschi added a comment - Putting git.exe in PATH solved the issue when using windows Master - mac Slave. But when using "Require workspace for polling" option, I still get the "ssh: command not found". Which is weird, because the mac has ssh in PATH. Is it trying to use ssh from the windows Master ?
          Hide
          markewaite Mark Waite added a comment -

          Nicolae Ghimbovschi the message

          ssh: command not found
          fatal: Could not read from remote repository.
          
          Please make sure you have the correct access rights
          and the repository exists.
          

          indicates that the git program did not have its PATH correctly configured to find the ssh executable which it uses for authenticated access to the remote server. If that job was configured with "Force polling using workspace", then that means the machine on which the workspace exists does not have the ssh command in its PATH.

          You can check that by creating a job which runs on that same machine and reports the value of the PATH environment variable.

          You can also review the environment variables of the slave through the "nodes" panel in Jenkins (http://localhost:8080/computer/). Each node has a "System Information" link which shows a page of the various settings used as defaults on that node. Those are defaults, and can be overridden by jobs, but it may be worth checking that the defaults are what you expect for that computer and operating system.

          Show
          markewaite Mark Waite added a comment - Nicolae Ghimbovschi the message ssh: command not found fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. indicates that the git program did not have its PATH correctly configured to find the ssh executable which it uses for authenticated access to the remote server. If that job was configured with "Force polling using workspace", then that means the machine on which the workspace exists does not have the ssh command in its PATH. You can check that by creating a job which runs on that same machine and reports the value of the PATH environment variable. You can also review the environment variables of the slave through the "nodes" panel in Jenkins ( http://localhost:8080/computer/ ). Each node has a "System Information" link which shows a page of the various settings used as defaults on that node. Those are defaults, and can be overridden by jobs, but it may be worth checking that the defaults are what you expect for that computer and operating system.
          Hide
          xfreebird Nicolae Ghimbovschi added a comment -

          Hi Mark, the master has git installed. But it is git.exe, not git as on osx.

          > the work around is to add the "Advanced clone behaviour" and "Require workspace for polling".
          I did try that, but I get a different error. See below.

          Is there a way to tell the Jenkins master to use the windows git instead of unix git for polling ? Because the job is configured with the unix git, since it is not possible to use git.exe in unix.

          Polling SCM changes on MobileDaily
          Using strategy: Default
          [poll] Last Built Revision: Revision 4dd28ae36ea5534d2ad666e70edbcb22b412b3ff (refs/remotes/origin/develop)
          > git rev-parse --is-inside-work-tree # timeout=10
          Fetching changes from the remote Git repositories
          > git config remote.origin.url git@bitbucket.org:alexmx/en-ios-internship.git # timeout=10
          Cleaning workspace
          > git rev-parse --verify HEAD # timeout=10
          Resetting working tree
          > git reset --hard # timeout=10
          > git clean -fdx # timeout=10
          Fetching upstream changes from git@bitbucket.org:alexmx/en-ios-internship.git
          > git --version # timeout=10
          using GIT_SSH to set credentials MobileDaily GitHub key
          > git fetch --tags --progress git@bitbucket.org:alexmx/en-ios-internship.git +refs/heads/:refs/remotes/origin/
          FATAL: hudson.plugins.git.GitException: Failed to fetch from git@bitbucket.org:alexmx/en-ios-internship.git
          hudson.util.IOException2: hudson.plugins.git.GitException: Failed to fetch from git@bitbucket.org:alexmx/en-ios-internship.git
          at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:475)
          at hudson.scm.SCM.poll(SCM.java:401)
          at hudson.model.AbstractProject.pollWithWorkspace(AbstractProject.java:1450)
          at hudson.model.AbstractProject._poll(AbstractProject.java:1421)
          at hudson.model.AbstractProject.poll(AbstractProject.java:1332)
          at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:515)
          at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:544)
          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.runWorker(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@bitbucket.org:alexmx/en-ios-internship.git
          at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:647)
          at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:554)
          at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:473)
          ... 13 more
          Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress git@bitbucket.org:alexmx/en-ios-internship.git +refs/heads/:refs/remotes/origin/" returned status code 128:
          stdout:
          stderr: /var/folders/xk/rth1rtgd6v96z_fvhq71vvvh0000gq/T/ssh4470835490524156079.sh: line 2: ssh: command not found
          fatal: Could not read from remote repository.

          Please make sure you have the correct access rights
          and the repository exists.

          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1435)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1223)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:85)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:280)
          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: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$Sync.innerRun(FutureTask.java:334)
          at java.util.concurrent.FutureTask.run(FutureTask.java:166)
          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:724)
          at ......remote call to MobileDaily(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:146)
          at sun.reflect.GeneratedMethodAccessor232.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
          at java.lang.reflect.Method.invoke(Unknown Source)
          at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132)
          at com.sun.proxy.$Proxy56.execute(Unknown Source)
          at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:645)
          ... 15 more
          Done. Took 0.48 sec
          No changes

          Show
          xfreebird Nicolae Ghimbovschi added a comment - Hi Mark, the master has git installed. But it is git.exe, not git as on osx. > the work around is to add the "Advanced clone behaviour" and "Require workspace for polling". I did try that, but I get a different error. See below. Is there a way to tell the Jenkins master to use the windows git instead of unix git for polling ? Because the job is configured with the unix git, since it is not possible to use git.exe in unix. Polling SCM changes on MobileDaily Using strategy: Default [poll] Last Built Revision: Revision 4dd28ae36ea5534d2ad666e70edbcb22b412b3ff (refs/remotes/origin/develop) > git rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repositories > git config remote.origin.url git@bitbucket.org:alexmx/en-ios-internship.git # timeout=10 Cleaning workspace > git rev-parse --verify HEAD # timeout=10 Resetting working tree > git reset --hard # timeout=10 > git clean -fdx # timeout=10 Fetching upstream changes from git@bitbucket.org:alexmx/en-ios-internship.git > git --version # timeout=10 using GIT_SSH to set credentials MobileDaily GitHub key > git fetch --tags --progress git@bitbucket.org:alexmx/en-ios-internship.git +refs/heads/ :refs/remotes/origin/ FATAL: hudson.plugins.git.GitException: Failed to fetch from git@bitbucket.org:alexmx/en-ios-internship.git hudson.util.IOException2: hudson.plugins.git.GitException: Failed to fetch from git@bitbucket.org:alexmx/en-ios-internship.git at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:475) at hudson.scm.SCM.poll(SCM.java:401) at hudson.model.AbstractProject.pollWithWorkspace(AbstractProject.java:1450) at hudson.model.AbstractProject._poll(AbstractProject.java:1421) at hudson.model.AbstractProject.poll(AbstractProject.java:1332) at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:515) at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:544) 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.runWorker(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@bitbucket.org:alexmx/en-ios-internship.git at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:647) at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:554) at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:473) ... 13 more Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress git@bitbucket.org:alexmx/en-ios-internship.git +refs/heads/ :refs/remotes/origin/ " returned status code 128: stdout: stderr: /var/folders/xk/rth1rtgd6v96z_fvhq71vvvh0000gq/T/ssh4470835490524156079.sh: line 2: ssh: command not found fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1435) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1223) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:85) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:280) 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: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$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) 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:724) at ......remote call to MobileDaily(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:146) at sun.reflect.GeneratedMethodAccessor232.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132) at com.sun.proxy.$Proxy56.execute(Unknown Source) at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:645) ... 15 more Done. Took 0.48 sec No changes
          Hide
          markewaite Mark Waite added a comment - - edited

          The message says:

          Cannot run program "git": CreateProcess error=2, The system cannot find the file specified

          That usually means the git program cannot be found by the Jenkins process. Since you say that Jenkins is configured to use git on Unix, I assume you do not have git installed on the windows master.

          Since it works when started without polling, I assume the job is using the default of fast remote polling. That means the job attempts to execute the git program on the master to poll for changes, rather than requiring a workspace on the slave. The system cannot find the file specified probably indicates that the git program is not available on the master, but is available on the slave.

          If that is the case, the work around is to add the "Advanced clone behaviour" and "Require workspace for polling". That will prevent the master server from performing the poll.

          Another work around would be to install git on the windows master server and tell Jenkins where to find the Windows git installation.

          Show
          markewaite Mark Waite added a comment - - edited The message says: Cannot run program "git": CreateProcess error=2, The system cannot find the file specified That usually means the git program cannot be found by the Jenkins process. Since you say that Jenkins is configured to use git on Unix, I assume you do not have git installed on the windows master. Since it works when started without polling, I assume the job is using the default of fast remote polling. That means the job attempts to execute the git program on the master to poll for changes, rather than requiring a workspace on the slave. The system cannot find the file specified probably indicates that the git program is not available on the master, but is available on the slave. If that is the case, the work around is to add the "Advanced clone behaviour" and "Require workspace for polling". That will prevent the master server from performing the poll. Another work around would be to install git on the windows master server and tell Jenkins where to find the Windows git installation.

            People

            • Assignee:
              ndeloof Nicolas De Loof
              Reporter:
              xfreebird Nicolae Ghimbovschi
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: