Approval process with time out in pipeline

The below pipeline is a simple example of the approval process in the pipeline.

In the stage "get approval", we are using an input directive that will wait for user input. As we are defining the timeout option, if the user didn't provide any input within 1 minute the stage will be aborted and the "deployment" stage will not be executed.

pipeline {
    agent any
    stages {
        stage("Build") {
            steps {
                echo "Building Application"
            }
        }        stage("get approval") {
            options {
                timeout(time: 1, unit: 'MINUTES')
            }
            steps {
                input "Please approve to proceed with deployment"
            }
        }        stage("deployment") {
            steps {
                echo "Deploying Application"
            }
        }
    }
}

Recent Comments

No comments

Leave a Comment