Kick off a job after manual approval in jenkins

白昼怎懂夜的黑 提交于 2019-12-03 06:02:32
  • 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.

Another option is to use the Jenkins Workflow plugin (as per the jenkins-workflow tag on the question), which is designed for this kind of more complex system. You would write something like (off the top of my head):

build job: 'A', wait: true mail to: 'user@…', subject: "Please approve #${env.BUILD_NUMBER}", body: """ See ${env.BUILD_URL}input/ """ input submitter: 'userId', message: 'Ready?' build job: 'B', wait: true

Later the build steps can be replaced with actual build tasks by inlining the work of those freestyle jobs.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!