There is a better solution that I just found. You can access the input result using the return value. The user must check the box to start an additional step. Otherwise, the step steps are skipped. If you skip the whole scene, the scene will disappear and “clear” the history of the scenes.
stage('do optional stuff?') { userInput = input( id: 'userInput', message: "Some important question?", parameters: [ booleanParam(defaultValue: false, description: 'really?', name: 'myValue') ]) } stage('optional: do magic') { if (userInput) { echo "do magic" } else { // do what ever you want when skipping this build currentBuild.result = "UNSTABLE" } }
source share