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

Pipeline environment 'constant' fails when in lowercase or in collision with Configuration environment 'constant'

XMLWordPrintable

      'lower' sometime is not printed:

      #!/usr/bin/env groovy
      
      def getMyValue() { return 'MY_VALUE' }
      def getJobUrl() { return env['JOB_URL'] ?: env['FOO'] }
      
      pipeline {
          agent { node { label 'xwiki' } }
          options { skipDefaultCheckout() }
          environment {
              UPPER = 'UPPER'
              lower = 'lower'
                                    
              MY_VALUE = getMyValue()
              my_value = getMyValue()
                                     
              MY_JOB = getJobUrl()
              my_job = getJobUrl()
          }
          stages {
              stage('Envs UPPER and lower') {
                  steps {
                      sh("echo U \$UPPER")
                      sh("echo l \$lower")                
                      
                      sh 'echo U $UPPER'
                      sh 'echo l $lower'
      
                      sh("echo M \$MY_VALUE")
                      sh("echo m \$my_value") 
                     
                      sh 'echo M $MY_VALUE'
                      sh 'echo m $my_value' 
                      
                      sh("echo M \$MY_JOB")
                      sh("echo m \$my_job")
                     
                      sh 'echo M $MY_JOB'
                      sh 'echo m $my_job'
                  }
              }
          }
      }
      

            Unassigned Unassigned
            based3 Basile Chandesris
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: