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

env.WHATEVER not considered for environment variable cross reference resolution in Declarative

    XMLWordPrintable

Details

    Description

      With an environment section like this:

      environment {
        FOO = "something"
        BAR = "${env.FOO} else"
      }

      The EnvVars-driven environment variable resolution/expansion doesn't know that env.FOO means that it needs to resolve FOO before resolving BAR, so there's no guarantee that'll actually happen in that order, and you may well get BAR as null else.

      Attachments

        Activity

          bitwiseman Liam Newman added a comment -

          Bulk closing resolved issues.

          bitwiseman Liam Newman added a comment - Bulk closing resolved issues.

          Ok, Thank you, my JiraFu seems broken

          I'll open an issue for my previous case when I will have the time.

           

          vtherry Vincent Therry added a comment - Ok, Thank you, my JiraFu seems broken I'll open an issue for my previous case when I will have the time.  
          abayer Andrew Bayer added a comment -

          Yes, known bug - JENKINS-42748

          abayer Andrew Bayer added a comment - Yes, known bug -  JENKINS-42748

          Also I noticed I cannot set environment variables like that (I work on Windows) :

           

          environment {
              PATH_TO_MY_WINDOWS_FOLDER = "C:\\MyFolder"
          }
          

           

          I am getting the following error : 

          hudson.remoting.ProxyException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
          http://jenkins.eureka.lan:8080/blue/organizations/jenkins/DispatchAdminApi%2FDispatchAdminApi/detail/master/149/pipeline#log-25Script4.groovy: 1: unexpected char: '\' @ line 1, column 30.
          http://jenkins.eureka.lan:8080/blue/organizations/jenkins/DispatchAdminApi%2FDispatchAdminApi/detail/master/149/pipeline#log-26 "PATH_TO_MY_WINDOWS_FOLDER=C:\MyFolder"

          vtherry Vincent Therry added a comment - Also I noticed I cannot set environment variables like that (I work on Windows) :   environment {     PATH_TO_MY_WINDOWS_FOLDER = "C:\\MyFolder" }   I am getting the following error :  hudson.remoting.ProxyException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: http://jenkins.eureka.lan:8080/blue/organizations/jenkins/DispatchAdminApi%2FDispatchAdminApi/detail/master/149/pipeline#log-25 Script4.groovy: 1: unexpected char: '\' @ line 1, column 30. http://jenkins.eureka.lan:8080/blue/organizations/jenkins/DispatchAdminApi%2FDispatchAdminApi/detail/master/149/pipeline#log-26 "PATH_TO_MY_WINDOWS_FOLDER=C:\MyFolder"
          abayer Andrew Bayer added a comment -

          Ah, didn't notice that you were using withEnv. That's not a Declarative issue - open a ticket against workflow-basic-steps.

          abayer Andrew Bayer added a comment - Ah, didn't notice that you were using withEnv. That's not a Declarative issue - open a ticket against workflow-basic-steps.

          People

            abayer Andrew Bayer
            abayer Andrew Bayer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: