我有下面的jenkins管道步骤,它等待用户输入发布中的某些步骤。我想向某人发送电子邮件,以便他/她可以快速参加并确定此输入值。该怎么做?
stage('Promote to Production ?') {
agent none
steps {
timeout(time: 60, unit: 'SECONDS') {
script {
env.RELEASE_TO_PROD = input message: 'User input required',
parameters: [choice(name: 'Promote to production', choices: 'no\nyes', description: 'Choose "yes" if you want to deploy this build in prduction')]
milestone 1
}
}
}
}
答案 0 :(得分:2)
在我看来,您只需将mail
步骤添加到管道中即可:
steps {
mail to: 'devops@company.com', subject: 'New build is waiting for your decision', body: 'Please make your decision about new build in Jenkins!'
timeout(time: 60, unit: 'SECONDS') {
// ...
}
}
如果您喜欢使用功能更强大的Email-ext plugin,管道将几乎相同。例如,我们可能决定将构建日志附加到我们的邮件中,因此管道将如下所示:
steps {
emailext to: 'devops@company.com', subject: 'New build is waiting for your decision', body: 'Please make your decision about new build in Jenkins!', attachLog: true
timeout(time: 60, unit: 'SECONDS') {
// ...
}
}