pipeline {
agent any
stages {
stage('上线申请') {
steps {
input message: '是否确认上线(请确认代码已提交)', ok: '同意'
mail bcc: '', body: "${正文}", cc: '', from: 'xxxxxx@', replyTo: '', subject: "${主题}", to: 'xxxxxx@'
}
}
stage('确认上线') {
steps {
input message: '确认是否上线(代码已合并?)', ok: '同意', submitter: 'lijiannan,liupeng'
mail bcc: '', body: '《Zn_Pwx》项目确认。', cc: '', from: 'xxxxxx@', replyTo: '', subject: "${主题}", to: 'xxxxxx@'
}
post {
aborted {
mail bcc: '', body: '《Zn_Pwx》项目上线申请被取消,代码未合并', cc: '', from: 'xxxxxx@', replyTo: '', subject: "${主题}", to: 'xxxxxx@'
}
}
}
stage('备份代码') {
steps {
sh 'ssh work@192.168.64.8 cp -r /home/work/webroot/Zn_Pwx /home/work/webroot/backups/Zn_Pwx/Zn_Pwx.bak`date "+%Y-%m-%d_%H:%M"`'
}
}
stage('拉取代码') {
steps {
sh "ssh work@192.168.64.8 ${pull}"
}
}
stage('部署代码') {
steps {
sh "ssh work@192.168.64.8 ${deploy}"
}
}
stage('上线完成') {
steps {
mail bcc: '', body: '《Zn_Pwx》项目已上线,请验证', cc: '', from: 'xxxxxx@', replyTo: '', subject: "${主题}", to: 'xxxxxx@'
}
}
stage('测试验证') {
steps {
input message: '是否通过测试', ok: '同意', submitter: 'lijiannan,liupeng,gaochenyu,wangshaofei'
mail bcc: '', body: '《Zn_Pwx》项目测试通过,请产品验收', cc: '', from: 'xxxxxx@', replyTo: '', subject: "${主题}", to: 'xxxxxx@'
}
post {
aborted {
mail bcc: '', body: '《Zn_Pwx》项目测试未通过', cc: '', from: 'xxxxxx@', replyTo: '', subject: "${主题}", to: 'xxxxxx@'
}
}
}
stage('产品验证') {
steps {
input message: '是否通过验证', ok: '同意', submitter: 'lijiannan,liupeng,tianjiping,yujiangting,lixiaohong,suhan,jianghuanwei'
mail bcc: '', body: '《Zn_Pwx》项目产品验证通过', cc: '', from: 'xxxxxx@', replyTo: '', subject: "${主题}", to: 'xxxxxx@'
}
post {
aborted {
mail bcc: '', body: '《Zn_Pwx》项目产品验证未通过', cc: '', from: 'xxxxxx@', replyTo: '', subject: "${主题}", to: 'xxxxxx@'
}
}
}
}
}
网友评论