2020-12-18 11:57:58 +08:00
|
|
|
pipeline {
|
|
|
|
agent {
|
|
|
|
node {
|
2022-02-16 23:36:31 +08:00
|
|
|
label 'metersphere-buildx'
|
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')]) {
|
2021-10-29 13:15:29 +08:00
|
|
|
// sh "cd frontend"
|
|
|
|
// sh "yarn install"
|
|
|
|
// sh "cd .."
|
|
|
|
sh "./mvnw clean package --settings ./settings.xml"
|
2022-02-18 11:35:34 +08:00
|
|
|
sh "mkdir -p backend/target/dependency && (cd backend/target/dependency; jar -xf ../*.jar)"
|
2020-12-18 11:57:58 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Docker build & push') {
|
|
|
|
steps {
|
2022-02-16 23:36:31 +08:00
|
|
|
sh "docker buildx build --build-arg MS_VERSION=\${TAG_NAME:-\$BRANCH_NAME}-\${GIT_COMMIT:0:8} -t ${IMAGE_PREFIX}/${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME} --platform linux/amd64,linux/arm64 . --push"
|
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')]) {
|
2022-03-27 16:49:45 +08:00
|
|
|
qyWechatNotification failNotify: true, mentionedId: '', mentionedMobile: '', webhookUrl: "$WEBHOOK"
|
2020-12-21 10:43:12 +08:00
|
|
|
}
|
2022-03-15 18:09:39 +08:00
|
|
|
sh "./mvnw clean"
|
2020-12-21 10:43:12 +08:00
|
|
|
}
|
2020-12-18 11:57:58 +08:00
|
|
|
}
|
|
|
|
}
|