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

wrong environment configuration in the syntax reference wiki page

XMLWordPrintable

      The environment configuration section declared in the Syntax reference in the wiki seems to contains errors.

      We can't made a reference to FOO from OTHER

      pipeline {
        agent any
        environment {
          FOO = "bar"
          OTHER = "${FOO}baz"
        }
        stages {
          stage("first stage") {
              steps {
                  echo "Hello world"
              }
          }
        }
      }
      

       
      because it's thrown this error

      groovy.lang.MissingPropertyException: No such property: FOO for class: groovy.lang.Binding
      	at groovy.lang.Binding.getVariable(Binding.java:63)
      	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:224)
      	at org.kohsuke.groovy.sandbox.impl.Checker$4.call(Checker.java:241)
      	at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:238)
      	at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:221)
      	at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:221)
      	at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:28)
      	at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20)
      

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

              Created:
              Updated:
              Resolved: