Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
Description
I am attempting to calculate a value to be used in a few different places in my pipeline. The definition is in a method (in a global library, but I have identical behavior with an inline method).
environment { MY_VAR = calculate() }
In this scenario, MY_VAR is always null--even if the RHS is the GString {{ "${1+2}" }}! In fact, credentials() is the only non-compile-time-constant expression that I can get to evaluate to non-null.
I expected the values in the environment block to be evaluated on the master when the pipeline is started up and then injected appropriately.
Attachments
Issue Links
- links to
Code changed in jenkins
User: Andrew Bayer
Path:
pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/EnvironmentTest.java
pipeline-model-definition/src/test/resources/nonLiteralEnvironment.groovy
http://jenkins-ci.org/commit/pipeline-model-definition-plugin/e2001b6a7907bec8298faeafa16a88c7bcaa1ff4
Log:
JENKINS-43681Just verify that a simple expression works as well