MeterSphere/Jenkinsfile

40 lines
1.4 KiB
Plaintext
Raw Normal View History

2020-12-18 11:57:58 +08:00
pipeline {
agent {
node {
2020-12-21 16:38:50 +08:00
label 'metersphere'
2020-12-18 11:57:58 +08:00
}
}
2020-12-21 16:57:42 +08:00
options { quietPeriod(600) }
2021-01-05 17:25:24 +08:00
environment {
IMAGE_NAME = 'metersphere'
IMAGE_PREFIX = 'registry.cn-qingdao.aliyuncs.com/metersphere'
2020-12-18 11:57:58 +08:00
}
stages {
stage('Build/Test') {
steps {
configFileProvider([configFile(fileId: 'metersphere-maven', targetLocation: 'settings.xml')]) {
sh "cd frontend"
sh "yarn install"
sh "cd .."
2020-12-18 11:57:58 +08:00
sh "mvn clean package --settings ./settings.xml"
}
}
}
stage('Docker build & push') {
steps {
sh "docker build --build-arg MS_VERSION=\${TAG_NAME:-\$BRANCH_NAME}-\${GIT_COMMIT:0:8} -t ${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME} ."
sh "docker tag ${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME} ${IMAGE_PREFIX}/${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME}"
sh "docker push ${IMAGE_PREFIX}/${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME}"
2020-12-18 11:57:58 +08:00
}
}
2020-12-21 14:06:32 +08:00
}
post('Notification') {
always {
sh "echo \$WEBHOOK\n"
withCredentials([string(credentialsId: 'wechat-bot-webhook', variable: 'WEBHOOK')]) {
qyWechatNotification failSend: true, mentionedId: '', mentionedMobile: '', webhookUrl: "$WEBHOOK"
}
}
2020-12-18 11:57:58 +08:00
}
}