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

Repo(Gerrit) is behaving differently than from the command line.

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • repo-plugin
    • Slave Node OSX 10.8.5
      repo version 1.20

      I am trying to bring up a new slave node with an identically configuration to a working slave.

            • Error message ****
              [EnvInject] - Loading node environment variables.
              Building remotely on mini-slave in workspace /Users/build/jenkins/workspace/job-64
              [Destination_Directory] $ repo init -u ssh://source.company.local/git/product-manifest -b feature_branch
              java.io.IOException: Cannot run program "repo" (in directory "/Users/build/jenkins/workspace/job-64/Destination_Directory"): error=2, No such file or directory
              at java.lang.ProcessBuilder.processException(ProcessBuilder.java:478)
              *****

      If I remove the repo information from Source control Management. And move the repo commands down into the shell it works.

      cd job-64/Destination_Directory
      repo init -u ssh://source.company.local/git/product-manifest -b feature_branch
      repo sync -d --jobs=1

      =====
      So it looks like a pathing issue however the pathing for the repo tool has been set everywhere and I see no way of figuring out where it's getting the information. Repo is located in /Users/build/bin

      Specifically I'm setting environment at:
      From the job:
      Inject Environment variables to the build process:
      PATH=/Users/build/bin:/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
      From the Node:
      Environment Variables:
      (PATH=/Users/build/bin:$PATH)

          [JENKINS-20309] Repo(Gerrit) is behaving differently than from the command line.

          scott julian added a comment -

          I have this exact same issue and I can't find anymore information on this. Has this ever been addressed?

          Slave node: OSX 10.10.3
          repo v1.21
          repo-plugin v1.7

          scott julian added a comment - I have this exact same issue and I can't find anymore information on this. Has this ever been addressed? Slave node: OSX 10.10.3 repo v1.21 repo-plugin v1.7

          Beth Griffin added a comment - - edited

          I am seeing this also:
          slave node: Ubuntu 14.04
          repo 1.22
          repo-plugin 1.10.1
          jenkins 1.586
          PATH: /home/jenkins/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
          path to repo: /home/jenkins/bin/repo

          00:00:00.177 java.io.IOException: Cannot run program "repo" (in directory "/data/jenkins/workspace/myjob"): error=2, No such file or directory

          Beth Griffin added a comment - - edited I am seeing this also: slave node: Ubuntu 14.04 repo 1.22 repo-plugin 1.10.1 jenkins 1.586 PATH: /home/jenkins/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games path to repo: /home/jenkins/bin/repo 00:00:00.177 java.io.IOException: Cannot run program "repo" (in directory "/data/jenkins/workspace/myjob"): error=2, No such file or directory

          You should be able to set the path under manage jenkins -> configure system

          Damien Merenne added a comment - You should be able to set the path under manage jenkins -> configure system

          I am having the same problem but on a Windows system.
          The plugin can not find the repo command but the command will work from the shell.

          On Windows the file to run the repo command is actually "repo.cmd" (which just runs the python file repo).
          I've noticed that if I change the name of the repo command in manage jenkins -> configure system to "repo.cmd" it works and I suspect that if the file were repo.exe then just "repo" would work. (I've actually tested this by renaming repo.cmd to repo.exe, of course it does not work but I do get a different error that indicates that the file was found but is not executable).

          Changing the path in jenkins -> configure system is not a workable solution as I have several slaves some Linux and some Windows. Jenkins does have a tool location setting that is slave specific Jenkins -> Nodes -> <Node name> -> Configure -> Tool Locations where you can specify the location of some tools on the slave (things like git MSBUild, etc) but I don't see the option to specify the location of Repo.

          Matt Schuckmann added a comment - I am having the same problem but on a Windows system. The plugin can not find the repo command but the command will work from the shell. On Windows the file to run the repo command is actually "repo.cmd" (which just runs the python file repo). I've noticed that if I change the name of the repo command in manage jenkins -> configure system to "repo.cmd" it works and I suspect that if the file were repo.exe then just "repo" would work. (I've actually tested this by renaming repo.cmd to repo.exe, of course it does not work but I do get a different error that indicates that the file was found but is not executable). Changing the path in jenkins -> configure system is not a workable solution as I have several slaves some Linux and some Windows. Jenkins does have a tool location setting that is slave specific Jenkins -> Nodes -> <Node name> -> Configure -> Tool Locations where you can specify the location of some tools on the slave (things like git MSBUild, etc) but I don't see the option to specify the location of Repo.

          Beth Griffin added a comment -

          I am in the same situation as Matt. What if repo is renamed to repo.cmd on the Linux machines, then the Jenkins server can use repo.cmd for both Linux and Windows as the command?

          Beth Griffin added a comment - I am in the same situation as Matt. What if repo is renamed to repo.cmd on the Linux machines, then the Jenkins server can use repo.cmd for both Linux and Windows as the command?

          I suppose that would work but it grates at my sensibilities and the mere fact that you have to do this points to a deeper problem.

          As a temporary work around I would not rename repo to repo.cmd rather create a soft link called repo.cmd to repo.

          Matt Schuckmann added a comment - I suppose that would work but it grates at my sensibilities and the mere fact that you have to do this points to a deeper problem. As a temporary work around I would not rename repo to repo.cmd rather create a soft link called repo.cmd to repo.

          Beth Griffin added a comment -

          The soft link is definitely much cleaner. But you are correct. The problem is that Jenkins assumes one path for all clients, and doesn't allow for Windows AND Linux slaves.

          Beth Griffin added a comment - The soft link is definitely much cleaner. But you are correct. The problem is that Jenkins assumes one path for all clients, and doesn't allow for Windows AND Linux slaves.

          I still can't figure out why the Jenkins Launcher for Windows for running the repo command can't use the file repo.cmd for repo, it only works if the executable file is repo.exe.
          It works just fine from the Windows command line and from the Run Shell or Run Batch tasks.

          FYI my other option was to create an executable called repo.exe (C# or C/C++ app) that just calls repo.cmd, other than it's a bit more work I like it better than polluting Linux systems with Windows vulgarities.

          Matt Schuckmann added a comment - I still can't figure out why the Jenkins Launcher for Windows for running the repo command can't use the file repo.cmd for repo, it only works if the executable file is repo.exe. It works just fine from the Windows command line and from the Run Shell or Run Batch tasks. FYI my other option was to create an executable called repo.exe (C# or C/C++ app) that just calls repo.cmd, other than it's a bit more work I like it better than polluting Linux systems with Windows vulgarities.

          Beth Griffin added a comment -

          So it looks like the recommended solution, at least from the command line, is to install the dependencies via the Cygwin install, and to install repo as though on a Linux system from inside the Cygwin terminal window. And to use the cygpath Jenkins plugin so that the windows machines know how to convert Linux paths to local Cygwin paths.

          Beth Griffin added a comment - So it looks like the recommended solution, at least from the command line, is to install the dependencies via the Cygwin install, and to install repo as though on a Linux system from inside the Cygwin terminal window. And to use the cygpath Jenkins plugin so that the windows machines know how to convert Linux paths to local Cygwin paths.

            Unassigned Unassigned
            codeforcoffee David W
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: