I'm surprised this issue has been closed. I cannot determine a way to display any dynamic values in the input directive for declarative pipeline. I really like that this has been added, but the inability to use dynamic values in it really limits the usefulness. As other user have stated:
- A globally scoped environment variable results in null when used
- A defined groovy string that is overridden in a subsequent stage results in the originally set value
- The recommendation for a nested stage results in an error because only steps or parallel are allowed keyword in a stage. Changing to stages to parallel allows it to work, but still results in a null value for the env var just as the globally scoped env var did.
For now it appears we are stuck utilizing another stage without an agent to get the desired result, but that is not very clean and defeats the purpose that the declarative input directive was meant to solve.
Part of this another ordering issue, like
JENKINS-49947: either we can have input results available when evaluating its stage's environment or the other way around, but not both. But top-level environment variables should be available to input - that's a bug. Can you provide a simple Jenkinsfile reproducing this? Thanks!