Jenkins 部署前手动电子邮件批准
Jenkins Manual email approval before deployment
我正在尝试为我们的 UAT 团队构建一个逻辑,以便仅在获得经理批准后才部署代码。我想知道如何才能实现?电子邮件批准 ?.请帮助
你可以试试这个
//this will grab user - who is running the job
def user
node {
wrap([$class: 'BuildUser']) {
user = env.BUILD_USER_ID
}
emailext mimeType: 'text/html',
subject: "[Jenkins]${currentBuild.fullDisplayName}",
to: "user@xxx.com",
body: '''<a href="${BUILD_URL}input">click to approve</a>'''
}
pipeline {
agent any
stages {
stage('deploy') {
input {
message "Should we continue?"
ok "Yes"
}
when {
expression { user == 'hardCodeApproverJenkinsId'}
}
steps {
sh "echo 'describe your deployment' "
}
}
}
}
您还可以从这个Whosebug问题中获得更多帮助
我正在尝试为我们的 UAT 团队构建一个逻辑,以便仅在获得经理批准后才部署代码。我想知道如何才能实现?电子邮件批准 ?.请帮助
你可以试试这个
//this will grab user - who is running the job
def user
node {
wrap([$class: 'BuildUser']) {
user = env.BUILD_USER_ID
}
emailext mimeType: 'text/html',
subject: "[Jenkins]${currentBuild.fullDisplayName}",
to: "user@xxx.com",
body: '''<a href="${BUILD_URL}input">click to approve</a>'''
}
pipeline {
agent any
stages {
stage('deploy') {
input {
message "Should we continue?"
ok "Yes"
}
when {
expression { user == 'hardCodeApproverJenkinsId'}
}
steps {
sh "echo 'describe your deployment' "
}
}
}
}
您还可以从这个Whosebug问题中获得更多帮助