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

Pre-pending to PATH environment variable in declarative pipeline

      Using the following in my declarative pipeline:

      environment {
        PATH = '/usr/bin:$PATH'
      }

      Gives this warning at build time:

      Warning: JENKINS-41339 probably bogus PATH=/usr/bin:$PATH; perhaps you meant to use 'PATH+EXTRA=/something/bin'?

      The problem is, the "PATH+EXTRA" syntax this warning is suggesting doesn't seem to be available in declarative pipelines. Also, the issue mentioned in this warning seems to be about scripted pipelines only.

          [JENKINS-50299] Pre-pending to PATH environment variable in declarative pipeline

          Andrew Bayer added a comment -

          So for the moment, don't worry about the warning - I still need to find a way to support PATH+EXTRA in Declarative, but PATH = '/usr/bin:$PATH' should work.

          Andrew Bayer added a comment - So for the moment, don't worry about the warning - I still need to find a way to support PATH+EXTRA in Declarative, but PATH = '/usr/bin:$PATH' should work.

          Max Anselm added a comment -

          abayer that only works for me if I set it at the stage level. If I set that for the pipeline it gets set to `/usr/bin:null`. I think this is because I have a master-slave setup.

          Max Anselm added a comment - abayer that only works for me if I set it at the stage level. If I set that for the pipeline it gets set to `/usr/bin:null`. I think this is because I have a master-slave setup.

          Hao Maio added a comment -

          abayer: any news on this problem?

          I even get the PATH-prefix double expanded: '/usr/bin:/usr/bin:$PATH' **

          Hao Maio added a comment - abayer : any news on this problem? I even get the PATH-prefix double expanded: '/usr/bin: /usr/bin: $PATH' **

            Unassigned Unassigned
            fr0 Chris Frolik
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: