-
Notifications
You must be signed in to change notification settings - Fork 128
/
Copy pathJenkinsfile
80 lines (72 loc) · 2.24 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
pipeline {
agent {
docker {
image 'reg.docker.alibaba-inc.com/polardb_x/mysql_dev:1.1-SNAPSHOT'
args '-v /home/xiedao.yy/Software:/opt/Software \
-v /home/hyy407018/.ssh:/root/.ssh \
--cap-add=SYS_PTRACE \
--security-opt seccomp=unconfined \
--privileged'
}
}
environment {
CMAKE_BIN_PATH = '/opt/Software/cmake-3.28.0-linux-x86_64/bin/cmake'
CTEST_BIN_PATH = '/opt/Software/cmake-3.28.0-linux-x86_64/bin/ctest'
RELATIVE_CICD_BUILD_ROOT = 'build'
CICD_BUILD_ROOT = "${env.WORKSPACE}/${RELATIVE_CICD_BUILD_ROOT}"
BOOST_DIRECTORY = "${env.WORKSPACE}/extra/boost"
BOOST_PATH = "${BOOST_DIRECTORY}/boost_1_77_0.tar.bz2"
RESULT_PATH = "${CICD_BUILD_ROOT}/result"
// CCACHE_DIR MUST USE ABSOLUTE PATH
CCACHE_DIR = "${env.WORKSPACE}/${CICD_BUILD_ROOT}/.cache/ccache"
CMAKE_C_FLAGS = ''
CMAKE_CXX_FLAGS = ''
DINGTALK_BOT_ID = '44281ff8-2953-4369-97f8-137e09cbc486'
}
stages {
stage('Build') {
steps {
sh 'cicd/build.sh'
}
}
stage('Test') {
steps {
sh 'cicd/unittest.sh'
sh 'cicd/mtr.sh'
}
}
}
post {
always {
script {
if (env.TEST_TYPE == 'DAILY_REGRESSION') {
PostJunitResult()
}
if (env.TEST_TYPE == 'MERGE_TEST_COVERAGE') {
sh 'cicd/test_coverage.sh'
archiveArtifacts artifacts: '**/report/**/*', allowEmptyArchive: true
}
}
archiveArtifacts artifacts: "${RELATIVE_CICD_BUILD_ROOT}/result/**", allowEmptyArchive: true
}
}
}
def PostJunitResult() {
def summary = junit allowEmptyResults: true, testResults: "${RELATIVE_CICD_BUILD_ROOT}/result/*.xml"
dingtalk(
robot: "${DINGTALK_BOT_ID}",
type: 'MARKDOWN',
title: '[PolarDB-X] DN 8032 Daily Regression',
text: [
"# [${env.JOB_NAME}](${env.JOB_URL})",
'---',
"- 任务: [${env.BUILD_DISPLAY_NAME}](${env.BUILD_URL})",
"- 状态: ${currentBuild.currentResult}",
"- 测试数量: ${summary.totalCount}",
"- 失败数量: ${summary.failCount}",
"- 跳过数量: ${summary.skipCount}",
"- 成功数量: ${summary.passCount}",
"- 持续时间: ${currentBuild.durationString}",
]
)
}