-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
55 lines (54 loc) · 2.28 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!groovy
pipeline {
agent {
node {
label 'meterspherex'
}
}
triggers {
pollSCM('20 * * * *')
}
environment {
IMAGE_PREFIX = 'registry.fit2cloud.com/metersphere'
}
stages {
stage('Community build & push') {
steps {
sh '''#!/bin/bash -xe
docker --config /home/metersphere/.docker buildx build --no-cache --build-arg MS_VERSION=\${TAG_NAME:-\$BRANCH_NAME}-\${GIT_COMMIT:0:8} --build-arg IMG_TAG=\${TAG_NAME:-\$BRANCH_NAME} -t ${IMAGE_PREFIX}/metersphere-ce:\${TAG_NAME:-\$BRANCH_NAME} -f Dockerfile.community --platform linux/amd64,linux/arm64 . --push
'''
}
}
stage('Enterprise build & push') {
steps {
sh '''#!/bin/bash -xe
docker --config /home/metersphere/.docker buildx build --no-cache --build-arg MS_VERSION=\${TAG_NAME:-\$BRANCH_NAME}-\${GIT_COMMIT:0:8} --build-arg IMG_TAG=\${TAG_NAME:-\$BRANCH_NAME} -t ${IMAGE_PREFIX}/metersphere-ee:\${TAG_NAME:-\$BRANCH_NAME} --platform linux/amd64,linux/arm64 . --push
'''
}
}
stage('Allinone release build & push') {
when {
anyOf {
tag pattern: "^v\\d+\\.\\d+\\.\\d+\$", comparator: "REGEXP";
tag pattern: "^v\\d+\\.\\d+\\.\\d+-lts\$", comparator: "REGEXP";
}
}
steps {
sh '''#!/bin/bash -xe
docker --config /home/metersphere/.docker buildx build --no-cache --build-arg MS_VERSION=\${TAG_NAME:-\$BRANCH_NAME}-\${GIT_COMMIT:0:8} --build-arg IMG_TAG=\${TAG_NAME:-\$BRANCH_NAME} \
-t ${IMAGE_PREFIX}/metersphere-ce-allinone:latest \
-t ${IMAGE_PREFIX}/metersphere-ce-allinone:\${TAG_NAME:-\$BRANCH_NAME} \
-f Dockerfile.all --platform linux/amd64,linux/arm64 . --push
'''
}
}
}
post('Notification') {
always {
sh "echo \$WEBHOOK\n"
withCredentials([string(credentialsId: 'wechat-bot-webhook', variable: 'WEBHOOK')]) {
qyWechatNotification failNotify: true, mentionedId: '', mentionedMobile: '', webhookUrl: "$WEBHOOK"
}
}
}
}