mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-11-30 11:08:38 +08:00
45 lines
1.7 KiB
Groovy
45 lines
1.7 KiB
Groovy
pipeline {
|
|
agent {
|
|
node {
|
|
label 'metersphere'
|
|
}
|
|
}
|
|
options { quietPeriod(600) }
|
|
environment {
|
|
IMAGE_NAME = 'metersphere'
|
|
IMAGE_PREFIX = 'registry.cn-qingdao.aliyuncs.com/metersphere'
|
|
}
|
|
stages {
|
|
stage('Build/Test') {
|
|
steps {
|
|
configFileProvider([configFile(fileId: 'metersphere-maven', targetLocation: 'settings.xml')]) {
|
|
// sh "cd frontend"
|
|
// sh "yarn install"
|
|
// sh "cd .."
|
|
sh "./mvnw 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}"
|
|
sh "docker rmi ${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME} ${IMAGE_PREFIX}/${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME}"
|
|
}
|
|
}
|
|
}
|
|
post('Notification') {
|
|
always {
|
|
sh "echo \$WEBHOOK\n"
|
|
withCredentials([string(credentialsId: 'wechat-bot-webhook', variable: 'WEBHOOK')]) {
|
|
qyWechatNotification failSend: true, mentionedId: '', mentionedMobile: '', webhookUrl: "$WEBHOOK"
|
|
}
|
|
cleanWs(cleanWhenNotBuilt: false,
|
|
deleteDirs: true,
|
|
disableDeferredWipeout: true,
|
|
notFailBuild: true)
|
|
}
|
|
}
|
|
}
|