-
Bug
-
Resolution: Unresolved
-
Minor
If you try something like
agent { label "${SOME_ENV_VAR}" } environment { SOME_ENV_VAR = "some-label" }
You'll get an error due to SOME_ENV_VAR not existing in the binding. Not ideal, obviously, but I'm not sure if we can actually solve this without significant rewrites.
- is duplicated by
-
JENKINS-46525 NPE: Cannot invoke method getScript() on null object in stage/agent/label
-
- Closed
-
-
JENKINS-44352 Variable resolution in GString fails for docker args
-
- Closed
-
- links to
kshultz It looks like your example works as long as the environment variable existed before pipeline is entered. My previous example was apparently valid, but I had a slightly different initial test case. Modifying it with your additions:
From my tests, this appears to be valid. This likely isn't a good long term workaround since the goal is to be able to support most use cases through the pipeline editor. As far as I can tell, the below wouldn't be valid.