Jenkins版本:Jenkins ver. 2.165
安装的插件:


有些插件没有用到,由于是安装jenkins时默认安装的。
工作流程:
- 获取代码、编译打包
- 等待用户输入确认是否发布测试环境(或者预生产环境)
- 等待用户输入确认是否发布发布生产环境第一台主机
- 等待用户输入确认是否发布发布生产环境第二台主机


Pipeline script:
node {
stage('build'){
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '44222250-cfd7-45f4-558e-209f410fddc9', url: 'http://jenkins@git.gitlab.com/aaa/aaa.git']]])
sh label: '', script: 'mvn clean package install'
}
stage('push_uat') {
timeout(time: 7, unit: 'DAYS') {
input message: '是否发布到预生产?',ok: 'Yes'
}
sh label: '', script: '/shell/deploy_v2.sh uat'
}
stage('push_online1') {
timeout(time: 7, unit: 'DAYS') {
input message: '是否发布到生产online1?',ok: 'Yes'
}
sh label: '', script: '/shell/deploy_v2.sh online1'
}
stage('push_online2') {
timeout(time: 7, unit: 'DAYS') {
input message: '是否发布到生产online2?',ok: 'Yes'
}
sh label: '', script: '/shell/deploy_v2.sh online2'
}
}
构建等待输入过程:

构建后视图显示:

网友评论