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

Environment vars with multiple substitutions are not set

    Details

    • Similar Issues:
    • Sprint:
      Pipeline - July/August

      Description

      Attempting to use multiple substituted values in an environment property causes it to silently fail to be set.

      Example script

      pipeline {
          agent any
          stages {
              stage('Build') {
                  environment {
                      AAA_Key = "${EXECUTOR_NUMBER} ${BUILD_NUMBER}"
                      AAA_BN_ONLY = "${BUILD_NUMBER}"
                      AAA_EN_ONLY = "${EXECUTOR_NUMBER}"
                  }
                  steps {
                      bat 'set'
                  }
              }
          }
      }
      

      Current output

      c:\w\Pipeline Experimental\default>set
      AAA_BN_ONLY=36
      AAA_EN_ONLY=1
      

      Current workaround is to use withEnv directly, which doesn't appear to suffer from this issue

        Attachments

          Issue Links

            Activity

            peitschie Philip Peitsch created issue -
            abayer Andrew Bayer made changes -
            Field Original Value New Value
            Labels declarative-variable-and-method-resolution
            jamesdumay James Dumay made changes -
            Sprint Pipeline - July/August [ 371 ]
            abayer Andrew Bayer made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            Hide
            abayer Andrew Bayer added a comment -

            This'll be fixed as part of JENKINS-42753, which is in PR right now and will be included in Declarative 1.2. I've added a test to that PR verifying the fix.

            Show
            abayer Andrew Bayer added a comment - This'll be fixed as part of JENKINS-42753 , which is in PR right now and will be included in Declarative 1.2. I've added a test to that PR verifying the fix.
            abayer Andrew Bayer made changes -
            Link This issue depends on JENKINS-42753 [ JENKINS-42753 ]
            abayer Andrew Bayer made changes -
            Status In Progress [ 3 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            Hide
            bitwiseman Liam Newman added a comment -

            Bulk closing resolved issues.

            Show
            bitwiseman Liam Newman added a comment - Bulk closing resolved issues.
            bitwiseman Liam Newman made changes -
            Status Resolved [ 5 ] Closed [ 6 ]

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                peitschie Philip Peitsch
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: