Search code examples
jenkinsjenkins-workflow

Kick off a job after manual approval in jenkins


I have a requirement of trigerring a Job B after Job A executes successfully. After Job A executes successfully , an email notification will be sent to the approver . The approver will receive an email and click on the mail link . He will be routed to Jenkins page where he will approve the execution of Job B .

I am not sure which plugin to use where I can mention the name of the approver , how the approver can click on the link and simple say "approve" after logging in to the Jenkins page.


Solution

    • Setup Job A
    • Configure Job A to send email to your "approver" as part of Email Ext post-build action
    • Configure the email to contain link back to the job run (not just job name, or you could even link directly to promotion from the email)
    • Configure a Promotion on Job A
    • In that promotion, allow it to be run only by your "approver" user (by name)
    • Configure that promotion to trigger Job B

    When Job A is run, it will send email to "approver". He/she will click the link and come to the Jenkins job run UI. He/she should be logged in to Jenkins with their "approver" user.

    Then he/she can click the promotion star and simply click "approve" on it. This will trigger the promotion which in turn triggers Job B

    Note: you can achieve something similar without "Promotions" plugin, but this is exactly the reason why that plugin exists, so use it.