3

I have a master set up on Windows machine.

I have a few nodes on Jenkins, one of which has 2 labels: "system project".

This node is actually a plain Solaris 11.3 machine.

Other nodes are plain windows machines (including master).

I have a Jenkinsfile in my project in which I defined pipeline as:

pipeline {
  agent { label 'system && project' }

  environment {
    PATH='$PATH:/home/user/path'
  }
  stage('Build') {
    echo "Test PATH=$PATH"
  }
...

When I build, I see the error in the log appears:

ERROR: Error cloning remote repo 'origin'
...
Caused by: java.io.IOException: Cannot run program "git.exe" (in directory "/remote/rootdir/workspace/ProjectName"): error=2, No such file or directory

The build is added as Jenkins Pipeline, not a freestyle project or something. And for now the only thing configured is GitLab repo with SSH credentials (rsa key).

But why does it try to call "git.exe" on Solaris? It clearly shows to me in the "Nodes" section (https://servername/computer/) that it is, in fact, a SunOS (amd64).

Can it actually be called on the wrong Node? But I see the "/remote/rootdir/workspace/ProjectName" directory created (it wasn't there before, I even removed it and relaunched build to make sure Jenkins actually creates it). Clearly, this isn't the case, as I originally suspected.

The machine itself has git installed - I checked by manually cloning the same repo using the same rsa key.

What am I doing wrong? What am I missing? How to tell Jenkins to use correct git?

Please, help.

4
  • perhaps stupid question; there wouldn't usually be a git install at that path. are you absolutely certain the message is from Solaris node, not a windows node that couldn't launch the executable from that path? Commented Jun 4, 2020 at 21:53
  • @FrankThomas, I am not sure of anything. It is my first time configuring Jenkins. Where can I look for this info? I think Jenkins trying to call git from this directory, that why it is there.
    – a_girl
    Commented Jun 4, 2020 at 21:59
  • I'm far from a Jenkins pro, but git's executable directory is generally put on the system path, so that you can just call it from wherever. you shouldn't need to specify .exe. ccana you confirm git is installed correctly on the nodes, and you can call it from any source path simply by typing git both on solaris and windows? Commented Jun 4, 2020 at 22:05
  • @FrankThomas, yes it is in the path. As I say: I can call "git clone repo" manually. But Jenkins calls "git.exe" for some reason, which is unknown for me. It is like Jenkins confuses linux(unix) machine with a windows machine.
    – a_girl
    Commented Jun 4, 2020 at 22:08

1 Answer 1

2

In this case the problem was that the jenkins master was installed and is running on windows and there wasn't any git configured for unix(solaris)/linux.

I had to go to Manage Jenkins >> Global Tools Configuration >> Git >> Add Git and add another instance of it with "Path to Git executable" equal to "git", pretty much like it is shown in the answer to this question: Jenkins could not run git

There was only one git configured: "Git-win"->"git.exe". Now there are two of them: "Git.win"->"git.exe" and "Git"->"git". And jenkins has an option in job configuration of which one to use. So you can select "Git-win" for windows jobs and "Git" for unix(solaris)/linux jobs.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .