This issue is archived. You can view it, but you can't modify it. Learn more

ExportXMLWordPrintable

      Testing the latest version of the pipeline plugins and it appears that it's no longer possible to set empty environment variables.  The following works in some current declarative scripts I have still using v1.0.2:

      pipeline{
          environment{
             EMAIL_RECIPIENTS         = 'me@me.com' 
             EMAIL_RECIPIENTS_SUCCESS = ''
          }
          
          (some stages and steps)
      
          post {
              success {
                  echo 'Send Success message...'
                  buildEmailer (currentBuild.result, EMAIL_RECIPIENTS, EMAIL_RECIPIENTS_SUCCESS)
              }
              failure {
                  echo 'Send Failed message...'
                  buildEmailer (currentBuild.result, EMAIL_RECIPIENTS, EMAIL_RECIPIENTS_SUCCESS) 
              } 
          }
      }

      I have emailing logic in shared library (buildEmailer) and do some processing if the incoming variable is blank. The above causes no trouble in plugin version 1.0.2, but in 1.1.2, I get:

      groovy.lang.MissingPropertyException: No such property: EMAIL_RECIPIENTS_SUCCESS for class: WorkflowScript
      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getProperty(ScriptBytecodeAdapter.java:458)
      at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.getProperty(DefaultInvoker.java:33)
      at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20)
      at WorkflowScript.run(WorkflowScript:127)
      ...

      However, the script is OK if I move things around and set the variables inside a script {} section inside a stage{}. The reason this particular value is set but blank, is that I let this value be optional and let developers update the desired property to what they want in the build job. I could process some default value in the environment section, but since the scripts works with variables in a script section, and it was working in 1.0.2, it seems like this could be a bug with the environment section.

            Assignee:
            Unassigned
            Reporter:
            Jason Davis
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: