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

Node environment variables not recursively expanded

    XMLWordPrintable

Details

    Description

      A user reported a problem whereby a script

      node('some-slave') {
        sh 'echo hello'
      }
      

      would fail, claiming the shell interpreter could not be found. In fact

      echo env.PATH
      

      revealed a mangled path like

      /usr/local/bin:$PATH:$SOME_TOOL/bin
      

      with various unexpanded variables. The node in question had the custom environment variable property set, where in particular PATH was set to an expression involving $PATH as well as various other sister properties.

      Freestyle projects were building without problem on this node, so it seems that the Workflow node step was failing to expand variable references picked up from the custom property.

      Attachments

        Issue Links

          Activity

            Is this a duplicate of JENKINS-20001? Is this a really old issue that crops up sometimes?

            docwhat Christian Höltje added a comment - Is this a duplicate of JENKINS-20001 ? Is this a really old issue that crops up sometimes?
            jglick Jesse Glick added a comment -

            No, this is about Pipeline builds, which use a rather different code path.

            jglick Jesse Glick added a comment - No, this is about Pipeline builds, which use a rather different code path.
            jglick Jesse Glick added a comment -

            Worked for me using software at the time this was filed. JENKINS-41339 covers a regression.

            jglick Jesse Glick added a comment - Worked for me using software at the time this was filed. JENKINS-41339 covers a regression.

            People

              jglick Jesse Glick
              jglick Jesse Glick
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: