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

Jenkins does not find Mercurial that is on the PATH

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • mercurial-plugin
    • None
    • MacOS X 10.7

      I have a Windows master node and Mac slave node.

      I installed Mercurial 2.3 myself on the Mac. The installer outputs the binaries into /usr/local/bin which is on my PATH. Invoking "hg" in a local terminal or over SSH (from Windows) works fine. However, when I run a task on the Mac that uses Mercurial I get:

      Building remotely on MacOS X 10.7 in workspace <workspace> JDK installation skipped: Unknown CPU name: mac os x $ hg clone --rev default --noupdate <repository> <workspace>
      ERROR: Failed to clone <repository> because hg could not be found; check that you've properly configured your Mercurial installation
      ERROR: Failed to clone <repository>
      

      I suspect this is failing because Jenkins is configured to auto-install Mercurial to "INSTALLATION/bin/hg" and run it from there but it does not because (apparently) Mercurial auto-installation is not supported for OSX.

      Expected behavior: Invoke "hg" off the PATH on platforms that do not support auto-installer.

          [JENKINS-14996] Jenkins does not find Mercurial that is on the PATH

          cowwoc added a comment -

          Additionally, I would update the error message so any time "hg" could not be found it outputs the full command-line it tried executing. It took me a very long time to figure out what was wrong because I couldn't see the command-line.

          cowwoc added a comment - Additionally, I would update the error message so any time "hg" could not be found it outputs the full command-line it tried executing. It took me a very long time to figure out what was wrong because I couldn't see the command-line.

          This is affecting me too. I simply can't use Jenkins because if it. Is there a work around?

          Michael Hodgins added a comment - This is affecting me too. I simply can't use Jenkins because if it. Is there a work around?

          Marko Käning added a comment -

          Happens for Mercurial (hg) and also for Bazaar (bzr)!

          Unfortunately one can only configure git's full path for a builder in the builder configuration.

          Can one expect that this addition to a builder's configuration regarding hg and bzr will come just like it seemingly exists already for git??

          Marko Käning added a comment - Happens for Mercurial (hg) and also for Bazaar (bzr)! Unfortunately one can only configure git's full path for a builder in the builder configuration. Can one expect that this addition to a builder's configuration regarding hg and bzr will come just like it seemingly exists already for git??

          Affected too, I was making a workaround to make hg work by creating a symlink in /usr/bin from /usr/local/bin, but since mac 10.11 it's not possible. It's SIP doesn't allow to write into /usr/bin. And I'm not able to turn off SIP.

          Please fix ASAP.

          Artem Alexandrov added a comment - Affected too, I was making a workaround to make hg work by creating a symlink in /usr/bin from /usr/local/bin, but since mac 10.11 it's not possible. It's SIP doesn't allow to write into /usr/bin. And I'm not able to turn off SIP. Please fix ASAP.

          A. Klitzing added a comment - - edited

          You can use this work-around for an SSH Agent/Slave:

          Download mercurial tarball (https://www.mercurial-scm.org/downloads) and install it to a local directory.
           
           

          python setup.py install --home="/Users/username/local/mercurial" --optimize=1

           

          Configure of Agent/Slave:

          • Launch Method: Launch slave agents via SSH
          • Advanced --> Prefix Start Slave Command

          export PATH=/Users/username/local/mercurial/bin:$PATH && export PYTHONPATH=/Users/username/local/mercurial/lib/python/ &&

          A. Klitzing added a comment - - edited You can use this work-around for an SSH Agent/Slave: Download mercurial tarball ( https://www.mercurial-scm.org/downloads ) and install it to a local directory.     python setup.py install --home="/Users/username/local/mercurial" --optimize=1   Configure of Agent/Slave: Launch Method: Launch slave agents via SSH Advanced --> Prefix Start Slave Command export PATH=/Users/username/local/mercurial/bin:$PATH && export PYTHONPATH=/Users/username/local/mercurial/lib/python/ &&

          John Doe added a comment -

          Any workarounds for macOS 10.13 and JNLP agent?

          John Doe added a comment - Any workarounds for macOS 10.13 and JNLP agent?

          Wilson Bui added a comment - - edited

          Hey guys, thanks for the above posts–you guys helped me get my pipeline off the ground. This affects me too, but it turns on that on Mac Mojave 10.14.5, I was just able to use the above advanced configuration in my slave agent to set the following:

          Prefix Start Agent Command: "export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin && "

          In "/usr/local/bin" there is a default symlink that is installed to points to Mercurial's actual install location at "/usr/local/bin/hg" so when you set the prefix command, it's able to find Mercurial upon startup.

          Wilson Bui added a comment - - edited Hey guys, thanks for the above posts–you guys helped me get my pipeline off the ground. This affects me too, but it turns on that on Mac Mojave 10.14.5, I was just able to use the above advanced configuration in my slave agent to set the following: Prefix Start Agent Command: "export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin && " In "/usr/local/bin" there is a default symlink that is installed to points to Mercurial's actual install location at "/usr/local/bin/hg" so when you set the prefix command, it's able to find Mercurial upon startup.

            kohsuke Kohsuke Kawaguchi
            cowwoc cowwoc
            Votes:
            4 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: