|
@@ -5,7 +5,7 @@ def qyWechatRobot = new org.devops.notification.QYWechatRobot()
|
|
|
pipeline {
|
|
|
agent {
|
|
|
node {
|
|
|
- label 'ls-3-bags-of-samples'
|
|
|
+ label 'master'
|
|
|
}
|
|
|
}
|
|
|
// tools { node '' }
|
|
@@ -13,7 +13,7 @@ pipeline {
|
|
|
environment {
|
|
|
_fullDisplayName = "幼享乐-Web管理后台"
|
|
|
_qyWechatRobotToken = "a47cb467-8e94-4877-b275-832cc1f0d9af"
|
|
|
- _remote = "root@8.129.111.45"
|
|
|
+ _remote = "root@47.97.230.53"
|
|
|
_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()
|
|
@@ -123,45 +123,31 @@ pipeline {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- stage('app') {
|
|
|
+ stage('Install') {
|
|
|
+ steps {
|
|
|
+ sh 'npm install'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ stage('Static check') {
|
|
|
parallel {
|
|
|
- stage('admin') {
|
|
|
- steps {
|
|
|
- dir("${env.WORKSPACE}/admin") {
|
|
|
- sh 'npm install'
|
|
|
- sh 'npm run build:prod'
|
|
|
- }
|
|
|
- dir("${env.WORKSPACE}/admin/dist") {
|
|
|
- sh "tar -zcvf ${env.WORKSPACE}/admin_${_git_branch}_${_buildTime}.tar.gz ./"
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- stage('client') {
|
|
|
+ stage('eslint') {
|
|
|
steps {
|
|
|
- dir("${env.WORKSPACE}/client") {
|
|
|
- sh 'npm install'
|
|
|
- sh 'npm run build'
|
|
|
- }
|
|
|
- dir("${env.WORKSPACE}/client/dist") {
|
|
|
- sh "tar -zcvf ${env.WORKSPACE}/client_${_git_branch}_${_buildTime}.tar.gz ./"
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- stage('employee') {
|
|
|
- steps {
|
|
|
- dir("${env.WORKSPACE}/employee") {
|
|
|
- sh 'npm install'
|
|
|
- sh 'npm run build'
|
|
|
- }
|
|
|
- dir("${env.WORKSPACE}/employee/dist") {
|
|
|
- sh "tar -zcvf ${env.WORKSPACE}/employee_${_git_branch}_${_buildTime}.tar.gz ./"
|
|
|
- }
|
|
|
+ echo 'eslint'
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ stage('YARN build') {
|
|
|
+ steps {
|
|
|
+ sh 'npm run build:prod'
|
|
|
+ }
|
|
|
+ }
|
|
|
stage('Product') {
|
|
|
steps {
|
|
|
+ dir("${env.WORKSPACE}/dist") {
|
|
|
+ sh "tar -zcvf ${env.WORKSPACE}/${_productFileName} ./"
|
|
|
+ }
|
|
|
+
|
|
|
archiveArtifacts(
|
|
|
artifacts: '*.tar.gz', // 字符串类型,需要归档的文件路径,使用的是Ant风格路径表达式。
|
|
|
// excludes: '', // 字符串类型,需要排除的文件路径,使用的也是Ant风格路径表达式。
|
|
@@ -192,38 +178,18 @@ pipeline {
|
|
|
ssh ${_remote} "
|
|
|
source /etc/profile
|
|
|
mkdir -pv ${_productBackupPath}
|
|
|
- mkdir -pv ${_productPath}/admin
|
|
|
- mkdir -pv ${_productPath}/client
|
|
|
- mkdir -pv ${_productPath}/employee
|
|
|
+ mkdir -pv ${_productPath}
|
|
|
"
|
|
|
"""
|
|
|
|
|
|
- sh "scp -r ${WORKSPACE}/admin_${_git_branch}_${_buildTime}.tar.gz ${_remote}:${_productBackupPath}"
|
|
|
- sh "scp -r ${WORKSPACE}/client_${_git_branch}_${_buildTime}.tar.gz ${_remote}:${_productBackupPath}"
|
|
|
- sh "scp -r ${WORKSPACE}/employee_${_git_branch}_${_buildTime}.tar.gz ${_remote}:${_productBackupPath}"
|
|
|
+ sh "scp -r ${WORKSPACE}/${_productFileName} ${_remote}:${_productBackupPath}"
|
|
|
|
|
|
sh """
|
|
|
ssh ${_remote} "
|
|
|
source /etc/profile
|
|
|
- rm -rf ${_productPath}/admin/*
|
|
|
- touch ${_productPath}/admin/${_git_branch}_${_buildTime}.log
|
|
|
- tar -zxvf ${_productBackupPath}/admin_${_git_branch}_${_buildTime}.tar.gz -C ${_productPath}/admin
|
|
|
- "
|
|
|
- """
|
|
|
- sh """
|
|
|
- ssh ${_remote} "
|
|
|
- source /etc/profile
|
|
|
- rm -rf ${_productPath}/client/*
|
|
|
- touch ${_productPath}/client/${_git_branch}_${_buildTime}.log
|
|
|
- tar -zxvf ${_productBackupPath}/client_${_git_branch}_${_buildTime}.tar.gz -C ${_productPath}/client
|
|
|
- "
|
|
|
- """
|
|
|
- sh """
|
|
|
- ssh ${_remote} "
|
|
|
- source /etc/profile
|
|
|
- rm -rf ${_productPath}/employee/*
|
|
|
- touch ${_productPath}/employee/${_git_branch}_${_buildTime}.log
|
|
|
- tar -zxvf ${_productBackupPath}/employee_${_git_branch}_${_buildTime}.tar.gz -C ${_productPath}/employee
|
|
|
+ rm -rf ${_productPath}/*
|
|
|
+ touch ${_productPath}/${_buildTime}.log
|
|
|
+ tar -zxvf ${_productBackupPath}/${_productFileName} -C ${_productPath}
|
|
|
"
|
|
|
"""
|
|
|
}
|