-
Bug
-
Resolution: Duplicate
-
Minor
-
Jenkins 2.89.4
How is the input step intended to be used in a declarative pipeline using a separate block (JENKINS-48379)? There are several issues with this.
- The result of the input can only be used in the current stage. Thus, it is not possible to skip multiple stages or use the input value in multiple stages.
- input and when cannot be combined in all cases. Currently, the result of input can be used in when to skip the stage (cool!). However, if the stage is skipped because of some other criteria, the input is still requested.
- input cannot be used inside the stage steps as a workaround because the agent would be blocked and it cannot be separated to two steps (approval without agent, handling with agent) because the input result is stage-local.
If I missed something and the issues can be solved, it would be nice to know and the documentation should be more clear about this. Currently, it seems impossible to create a declarative pipeline with a manual approval step before a deployment when the process also depends on other criteria (e.g. the branch in a multibranch pipeline).
- duplicates
-
JENKINS-50880 Create a new option for running when condition before stage input
-
- Closed
-
- relates to
-
JENKINS-48379 Input/parameters for Stages
-
- Closed
-
The ability to skip multiple stages for a single input result will come along as part of
JENKINS-46809- the architecture makes it not viable to have something that happens in a stage (input, environment, etc) actually carry over as an environment variable to other sibling stages, but sequential nested stages will let you say "here's a parent stage with an input and a when - if the when passes, run this list of other stages".Ordering is hard. =) I made the call that there was more value in having the result of input available for when than avoiding the input directive if an unrelated when condition was false. It was either input and then when in evaluation order, or when and then input, so...yeah. Again, once
JENKINS-46809lands, you could do a "parent" stage with the branch when condition, with a single nested stage with the input-based when condition. Not the most elegant syntax, sure, but trade-offs have to be made in order to have the opinionated behavior and structure Declarative provides.