When expression in Groovy Jenkins Pipeline — Part01

Syedusmanahmad
2 min readSep 8, 2022

--

1- when before the input directive

By default, the when condition for a stage will not be evaluated before the input, if one is defined. However, this can be changed by specifying the beforeInput option within the when block. If beforeInput is set to true, the when condition will be evaluated first, and the input will only be entered if the when condition evaluates to true.

For Example:

In above screenshot you can see that if we want to get user input before moving ahead, then we need to use input statement in stage of jenkinsfile.

In above screenshot you can see that pipeline is looking for the user input (confirmation) “proceed” or “abort” to move ahead

When I have clicked on “proceed” it will executed the next step with Approved by owner.

As you can see in above screenshot, when I have rerun the pipeline and clicked on “Abort” the pipeline will be ABORTED with confirmation.

--

--

Syedusmanahmad
Syedusmanahmad

Written by Syedusmanahmad

AWS & DevOps Architect | Linux, Docker, Kubernetes, Terraform, Jenkins, Git&GitHub, Ansible expert

No responses yet