Jenkins Poll SCM (Git) on Windows master / Build on Linux slave

Viewed 2884

Here is my scenario:

  • Using git as my SCM
  • Jenkins Job runs on Linux slave
  • Jenkins master is hosted on Windows

I have configured two Git installations as indicated in Jenkins path to git Windows master / Linux slave. Git installations are set up as follows:

  • Name: WindowsGit | Path: C:\Program Files\Git\bin\git.exe
  • Name: LinuxGit | Path: /usr/local/bin/git

Because I need to run the job on linux slave, my job git configuration is pointing to LinuxGit (Git executable option). Job runs great, no problems. However, when I try to use "Poll SCM" option, it breaks. I believe the problem here is because Poll SCM runs on the Windows Master and the Git information for this job is pointing to LinuxGit. Git Polling Log shows:

Caused by: java.io.IOException: Cannot run program "/usr/local/bin/git": CreateProcess error=2, The system cannot find the file specified

In the other hand, if I select WindowsGit, Git Polling Log is fine but job itself will obviously fail because it's running on a Linux Slave.

Question: Can anyone think about a way I can select one Git installation for the Source Code Management configuration and another one for the Poll SCM feature?

1 Answers
Related