-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
Windows master, Mac slave
-
Powered by SuggestiMate
I have defined two installations of git on our Windows master node:
Default: git.exe (found in the PATH)
Mac: /usr/local/bin/git (not found in the PATH)
I have certain jobs that must run on a Mac. For those jobs, I have selected "Mac" for the git executable.
When those jobs try to poll github for changes, they get errors like this:
Started on Aug 5, 2014 6:38:03 PM
Using strategy: Default
[poll] Last Built Revision: Revision 33ce43e454fd2447f548f18dc3bc404ff1a2b021 (origin/release)
> /usr/local/bin/git ls-remote -h git@github.com:everyscape/Mobile.git release # timeout=10
FATAL: hudson.plugins.git.GitException: Error performing command: /usr/local/bin/git ls-remote -h git@github.com:everyscape/Mobile.git release
hudson.util.IOException2: hudson.plugins.git.GitException: Error performing command: /usr/local/bin/git ls-remote -h git@github.com:everyscape/Mobile.git release
at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:459)
at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:357)
at hudson.scm.SCM.poll(SCM.java:374)
...
Caused by: hudson.plugins.git.GitException: Error performing command: /usr/local/bin/git ls-remote -h git@github.com:everyscape/Mobile.git release
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1414)
...
Caused by: java.io.IOException: Cannot run program "/usr/local/bin/git": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
...
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
...
I presume this fails because it is looking for /usr/local/bin/git on the Windows master node.
When I manually build the job with that configuration - git works fine.
If I switch the job's configuration to use the "Default" git executable (git.exe), then polling works fine, but when the job tries to run on the Mac then the git commands fail (since git.exe is not found on the Mac).
So, until this issue is resolved somehow, either
a) no jobs are started automatically, but they all build successfully when launched manually, or
b) jobs are started automatically - but then they all fail to build.
The job in question clones a specific branch of a repository from github.
It is restricted to work on a slave node with the label of "iOS".
There is a mac slave node with that label.
We are running the latest LTS version (1.565.1) of Jenkins on a Windows server.
FYI - this behavior worked fine on an older (1.x) version of this plugin.
Thanks,
Chuck
[JENKINS-24125] Git Polling fails for job restricted to Mac OS X slave (with Windows master)
I can confirm that the name and paths of the git executables are correctly specified for the various platforms on the Git installations section of the Jenkins configuration page.
Apparently I could override those tool locations on the OS/X slave node configuration page (I was not aware of this) - but why do I need to do that?
Please explain to me how I can specify the proper git executable to use for both polling and building if they each use the same git executable specified by the job but polling runs on the master node but the job is built on the specified slave node?
Thanks,
Chuck
The master Jenkins git location is the default and is applied to the master and all slaves (as the default). That usually leads to me preferring to have the default be "git", and then if I'm running a Windows master, I assure that the Jenkins process includes the C:\Program Files(x86)\Git\bin directory in its path.
In your case, I suspect your default is "git.exe", and when that is attempted as the default on OS/X, there is no "git.exe". Thus, if you want the system wide default for the git program to be "git.exe" (possibly because most of your machines will be Windows based), then you'll need to define the git location for each slave that is not Windows.
You need to override tool locations if the default tool location does not work for that slave. You defined the default as "git.exe" and that only work for Windows.
So is it expected that all git installations will work on all platforms, even if the job can only be built on certain platforms? I didn't think so - so I assumed that the polling etc. would occur only on the appropriate node(s). If that is the case, then it seems as if the only appropriate path to the git executable would be "git" as you suggested (assuming the git executable will be found in the path and that the ".exe" suffix for windows is implicit/not-necessary).
For some reason, the PATH variable defined on the OS/X slave for the user running Jenkins didn't seem to be used - thus "git" was not found and therefore we defined an alternate (platform specific) installation of git for Mac with an explicit directory instead of overriding the default installation just for the slave (which I didn't know I could/should do).
The git plugin defaults to use "fast remote polling" to reduce the disc and I/O overhead of polling for updates. That fast remote polling is performed on the master.
If you would rather not use fast remote polling, you can add "Additional Behaviours" to "Force polling using workspace". That will then require a workspace before performing a poll, and will heed the platform restrictions of the job definition.
That restriction will cause polling to be significantly slower in certain cases, but it will assure the job restriction is honored by the polling process.
I had exactly the same issue for months. Since Jan 2013 we were using a OSX restricted job with a windows master; the polling never worked and we had to launch the build manually. The workaround works fine for us too
I am currently having the same issue on a Windows Master, Ubuntu Slave Jenkins ver. 1.626
The default git is C:\Cygin64\bin\git.exe, which works on the windows master.
A second definition for linux, /usr/bin/git, is set in configure system, and for the Linux slave.
The slave is ignoring this in the pre-build SCM step, and using the default windows git from windows.
[EnvInject] - Loading node environment variables.
[EnvInject] - Preparing an environment for the build.
[EnvInject] - Keeping Jenkins system variables.
[EnvInject] - Keeping Jenkins build variables.
[EnvInject] - Executing and processing the following script content:
printenv
[jenkins-slave-61] $ bash -xe /tmp/hudson1628961445242564055.sh
+ printenv
BUILD_URL=http://192.168.29.61:8080/job/ambiqtools-eclipse-installer/6/
XDG_SESSION_ID=42
HUDSON_SERVER_COOKIE=7b724dbd927d388d
SHELL=/bin/bash
SSH_CLIENT=192.168.29.61 51590 22
BUILD_TAG=jenkins-ambiqtools-eclipse-installer-6
ROOT_BUILD_CAUSE=MANUALTRIGGER
JOB_URL=http://192.168.29.61:8080/job/ambiqtools-eclipse-installer/
USER=rfoos
executor label=kvm-u1504-mars
JENKINS_HOME=C:\jenkins
MAIL=/var/mail/rfoos
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
_=/usr/bin/printenv
BUILD_CAUSE_MANUALTRIGGER=true
PWD=/home/rfoos/jenkins-slave-61
HUDSON_URL=http://192.168.29.61:8080/
LANG=en_US.UTF-8
JOB_NAME=ambiqtools-eclipse-installer
BUILD_DISPLAY_NAME=#6
JENKINS_URL=http://192.168.29.61:8080/
BUILD_CAUSE=MANUALTRIGGER
BUILD_ID=6
SHLVL=2
HOME=/home/rfoos
EXECUTOR_NUMBER=0
JENKINS_SERVER_COOKIE=7b724dbd927d388d
NODE_LABELS=jenkins-slave-61 kvm-u1504-mars
LOGNAME=rfoos
SSH_CONNECTION=192.168.29.61 51590 192.168.29.153 22
HUDSON_HOME=C:\jenkins
NODE_NAME=kvm-u1504-mars
BUILD_NUMBER=6
XDG_RUNTIME_DIR=/run/user/1000
ROOT_BUILD_CAUSE_MANUALTRIGGER=true
HUDSON_COOKIE=f54968a0-ef1a-4adc-9ef9-f21caec71a68
[EnvInject] - Script executed successfully.
[EnvInject] - Injecting contributions.
Building remotely on kvm-u1504-mars (jenkins-slave-61) in workspace /home/rfoos/jenkins-slave-61/sharedspace/ambiqtools-eclipse-installer
Cloning the remote Git repository
Cloning repository http://git.eclipse.org/gitroot/oomph/org.eclipse.oomph.git
> C:\Cygwin64\bin\git.exe init /home/rfoos/jenkins-slave-61/sharedspace/ambiqtools-eclipse-installer # timeout=10
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Could not init /home/rfoos/jenkins-slave-61/sharedspace/ambiqtools-eclipse-installer
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$4.execute(CliGitAPIImpl.java:606)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:462)
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:326)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at ......remote call to kvm-u1504-mars(Native Method)
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1413)
at hudson.remoting.UserResponse.retrieve(UserRequest.java:221)
at hudson.remoting.Channel.call(Channel.java:778)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:145)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.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:131)
at com.sun.proxy.$Proxy68.execute(Unknown Source)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1003)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1043)
at org.jenkinsci.plugins.multiplescms.MultiSCM.checkout(MultiSCM.java:129)
at hudson.scm.SCM.checkout(SCM.java:485)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1277)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532)
at hudson.model.Run.execute(Run.java:1741)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:408)
Caused by: hudson.plugins.git.GitException: Error performing command: C:\Cygwin64\bin\git.exe init /home/rfoos/jenkins-slave-61/sharedspace/ambiqtools-eclipse-installer
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1647)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1616)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1612)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1254)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$4.execute(CliGitAPIImpl.java:604)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:462)
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:326)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Cannot run program "C:\Cygwin64\bin\git.exe" (in directory "/home/rfoos/jenkins-slave-61/sharedspace/ambiqtools-eclipse-installer"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:816)
at hudson.Launcher$ProcStarter.start(Launcher.java:382)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1636)
... 15 more
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 20 more
ERROR: null
Archiving artifacts
Finished: FAILURE
rickfoosusa does it have the same behavior if you assign the tool location as part of the slave node definition, rather than assigning it as part of a separate system-wide installation of git?
I tried the following steps and did not see the problem (note, these steps are different than the steps I believe you used to show the problem):
- Configure a Windows Jenkins with git plugin 2.4.0 and git client plugin 1.19.0 using Windows git 2.5.0
- Define the git location as C:\Program Files\Git\bin\git.exe in the system wide tools definition
- Add a Linux slave node
- Define a git based job which runs only on the Linux slave node
- Run the job, confirm it fails because the slave node by default uses the git location specified by the master node
- Modify the slave node configuration to define a git location as "/usr/bin/git"
- Run the job, confirm it now succeeds because the git location can be found
If you can confirm that work around, that will help show that the problem is specific to alternate git implementations (as defined by the plugin) rather than alternate git locations.
I believe the steps you took to show the problem were:
- Configure a Windows Jenkins with git plugin 2.4.0 and git client plugin 1.19.0 using Windows git 2.5.0
- Define the git location as C:\Program Files\Git\bin\git.exe in the system wide tools definition
- Add a Linux slave node
- Define a git based job which runs only on the Linux slave node
- Run the job, confirm it fails because the slave node by default uses the git location specified by the master node
- Add a git installation called "Mac" with git location as "/usr/bin/git"
- Configure the job to use the Mac git instead of the default git
- Run the job, confirm it fails with the same message when it should succeed because the git location can be found (this is the bug)
I have seemed to hit the same issue but in reverse, my master is on Ubuntu and my slaves are Windows. Fetching submodules or even using the
Source Code Management |
Configuration system to load common groovy scripts with the LoadLibrary()_ call produces the same error as noted above, the one difference is that it is trying to launch C:\Program Files\Git\cmd\git.exe from a unix shell fork.
I strongly suspect that you have a configuration problem. The "ls-remote" command is executed on the master node, though it likely uses the git executable defined by that job.
Please confirm that your master node has the git executable correctly specified for the master node (git.exe), and that the OS/X node has the git executable correctly specified for it (/usr/local/bin/git).
The location of the default git executable is set in the node configuration page for the OS/X slave node. It needs to be "/usr/local/bin/git".
The location of the default git executable for the master node needs to be configured in the "Git installations" section of the "Manage Jenkins" page.