jenkins - Jenkins 在部署前手动批准电子邮件
问题描述
我正在尝试为我们的 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' "
}
}
}
}
您还可以从这个StackOverflow 问题中获得更多帮助
推荐阅读
- vb.net - 从模块返回值
- c# - WPF:创建附加的可绑定属性
- c++ - Qt5/QTest:如何模拟时钟速度(QTimer等)?
- android - 使用 android SDK 28 proguard 更新 gradle 插件 3 失败
- c# - 在 NET Core + React App 中验证 Steam ID 所有权
- serialization - 串行器设计?我什么时候需要一个新的序列化器?
- r - 如何使用 R 构建具有来自其他两个不同大小向量的特定数据的新向量
- c# - 在 setter 中更改 value 关键字是否错误?
- angular - Angular Material Accordion ngFor 与内部组件
- ios - iOS应用程序中的删除请求后奇怪的超时