|
@@ -14,6 +14,7 @@ pipeline {
|
|
|
_fullDisplayName = "幼享乐-Web管理后台"
|
|
|
_qyWechatRobotToken = "a47cb467-8e94-4877-b275-832cc1f0d9af"
|
|
|
_remote = "root@47.97.230.53"
|
|
|
+ _remoteB = "root@8.134.14.62"
|
|
|
_buildTime = new Date().format('yyyyMMddHHmmss') // 生成当前时间戳
|
|
|
_git_tag = sh(returnStdout: true, script: 'git describe --tags --always').trim()
|
|
|
_git_branch = sh(returnStdout: true, script: 'echo ${GIT_BRANCH#*/}').trim()
|
|
@@ -170,7 +171,7 @@ pipeline {
|
|
|
}
|
|
|
stage('Release') {
|
|
|
parallel {
|
|
|
- stage('master分支') {
|
|
|
+ stage('开发环境(47.97.230.53)') {
|
|
|
when {
|
|
|
branch 'master' // 仅在多分支Pipeline有效
|
|
|
}
|
|
@@ -198,6 +199,34 @@ pipeline {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ stage('生产环境(8.134.14.62)') {
|
|
|
+ when {
|
|
|
+ branch 'master' // 仅在多分支Pipeline有效
|
|
|
+ }
|
|
|
+ steps {
|
|
|
+ script {
|
|
|
+ echo '准备发布ing...'
|
|
|
+ sh """
|
|
|
+ ssh ${_remoteB} "
|
|
|
+ source /etc/profile
|
|
|
+ mkdir -pv ${_productBackupPath}
|
|
|
+ mkdir -pv ${_productPath}
|
|
|
+ "
|
|
|
+ """
|
|
|
+
|
|
|
+ sh "scp -r ${WORKSPACE}/${_productFileName} ${_remoteB}:${_productBackupPath}"
|
|
|
+
|
|
|
+ sh """
|
|
|
+ ssh ${_remoteB} "
|
|
|
+ source /etc/profile
|
|
|
+ rm -rf ${_productPath}/*
|
|
|
+ touch ${_productPath}/${_buildTime}.log
|
|
|
+ tar -zxvf ${_productBackupPath}/${_productFileName} -C ${_productPath}
|
|
|
+ "
|
|
|
+ """
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|