Skip to content

Instantly share code, notes, and snippets.

@rmpestano
Last active November 12, 2018 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmpestano/11ebfa553bdfb89fa3c91515cc7aaae2 to your computer and use it in GitHub Desktop.
Save rmpestano/11ebfa553bdfb89fa3c91515cc7aaae2 to your computer and use it in GitHub Desktop.
input+when condition in a declarative pipeline
pipeline {
    agent none

    //other stages

    stage("Stage ok") {
        agent any
           when {
	      expression {
                 return !params.PULL_REQUEST
              }
            steps {
                //this stage is being skipped without problems
            }
    }
    stage("go to production") {
                when {
                   beforeAgent true
                   expression {
                        return !params.PULL_REQUEST
                      }
                }
                input {
                    message "Deploy to production?" //this is being evaluated before when expression
                    ok "Yes"
                }
         agent any
         steps {
         //step commands
@rmpestano
Copy link
Author

This is related to JENKINS-50880

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment