user9223244
user9223244

Reputation: 21

Is there a way to insert a manual approval for Build pipeline 1.5.8 version in jenkins 2

I am using jenkins 2.89.2 version.

For deployment into production system it's often useful to require manual approval; is there a way to insert a manual button to press inside a pipeline?

I tried using Build other Project(manual Step) in post build action but still i don't see any approval button or manual intervention at prod build in build pipeline.. And as i can see that In Build pipeline ---> Manually trigger downstream projects is no more avail in Build pipeline version 1.5.8. I want to use build pipeline for my project.

Can anyone help on this how to do? Thanks in advance.

Upvotes: 2

Views: 9466

Answers (2)

bpadz
bpadz

Reputation: 69

That's how I'm doing using Slack integration.

slackSend (channel: "#slack-channel", color: '#4286f4', message: "Deploy Approval: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.JOB_DISPLAY_URL})")
                script {
                    try {
                        timeout(time:30, unit:'MINUTES') {
                            env.APPROVE_PROD = input message: 'Deploy to Production', ok: 'Continue',
                                parameters: [choice(name: 'APPROVE_PROD', choices: 'YES\nNO', description: 'Deploy from STAGING to PRODUCTION?')]
                            if (env.APPROVE_PROD == 'YES'){
                                env.DPROD = true
                            } else {
                                env.DPROD = false
                            }
                        }
                    } catch (error) {
                        env.DPROD = true
                        echo 'Timeout has been reached! Deploy to PRODUCTION automatically activated'
                    }
                }

Upvotes: 5

Muhammad Faizan-Ul-Haq
Muhammad Faizan-Ul-Haq

Reputation: 340

I have not done this yet but one way to add approvals could be by using "Input Step"

It is documented here:

https://jenkins.io/doc/pipeline/steps/pipeline-input-step/

Upvotes: 1

Related Questions