Skip to content

Commit 8cd6a0b

Browse files
committed
IMAINT-4: update Jenkinsfile
1 parent 7ce896b commit 8cd6a0b

File tree

1 file changed

+89
-63
lines changed

1 file changed

+89
-63
lines changed

Jenkinsfile

Lines changed: 89 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,18 @@
1010
* to use the software.
1111
*/
1212

13-
def runBuildStage(String buildMode, String linkMode) {
14-
def cmd = "python3 ${env.WORKSPACE}/resources/ci_cd/linux_build.py"
15-
cmd += " --build-mode ${buildMode}"
16-
cmd += " --link-mode ${linkMode}"
17-
cmd += " --build-dir ${get_build_directory(buildMode, linkMode)}"
18-
sh(cmd)
19-
}
20-
21-
def get_build_directory(String buildMode, String linkMode) {
22-
return "build_${buildMode}_${linkMode}"
23-
}
13+
/**
14+
* Hold information about the pipeline.
15+
*/
16+
Map pipelineInfo = [:]
2417

2518
pipeline {
26-
agent none
19+
agent {
20+
label "${runInsideExecutor.labelFromJobName()}"
21+
}
2722

2823
options {
24+
skipDefaultCheckout()
2925
disableConcurrentBuilds()
3026
/*
3127
To avoid excessive resource usage in server, we limit the number
@@ -48,70 +44,100 @@ pipeline {
4844
}
4945

5046
stages {
51-
stage('Build sequence') {
52-
agent {
53-
dockerfile {
54-
filename 'resources/docker/Dockerfile.linux'
55-
label 'docker'
47+
stage('Configuration') {
48+
steps {
49+
script {
50+
checkoutCommunityRepoBranch(
51+
'rticonnextdds-examples',
52+
env.BRANCH_NAME,
53+
false,
54+
)
55+
pipelineInfo.dockerDir = "${env.WORKSPACE}/resources/docker/"
56+
pipelineInfo.staticAnalysisDir = "${env.WORKSPACE}/static_analysis_report"
57+
runInsideExecutor(
58+
'',
59+
pipelineInfo.dockerDir,
60+
) {
61+
pipelineInfo.connextArch = getEnvVar('CONNEXTDDS_ARCH')
62+
}
5663
}
5764
}
58-
59-
environment {
60-
RTI_INSTALLATION_PATH = "${env.WORKSPACE}"
65+
}
66+
stage('Download Packages') {
67+
steps {
68+
runInsideExecutor(
69+
'',
70+
pipelineInfo.dockerDir,
71+
) {
72+
script {
73+
pipelineInfo.connextDir = installConnext(
74+
pipelineInfo.connextArch,
75+
env.WORKSPACE,
76+
)
77+
}
78+
}
6179
}
62-
63-
stages {
64-
stage('Download Packages') {
65-
steps {
66-
sh 'pip3 install -r resources/ci_cd/requirements.txt'
67-
68-
withAWSCredentials {
69-
withCredentials([
70-
string(credentialsId: 's3-bucket', variable: 'RTI_AWS_BUCKET'),
71-
string(credentialsId: 's3-path', variable: 'RTI_AWS_PATH'),
72-
]) {
73-
sh 'python3 resources/ci_cd/linux_install.py -a $CONNEXTDDS_ARCH'
74-
}
75-
}
80+
}
81+
stage('Build all modes') {
82+
matrix {
83+
axes {
84+
axis {
85+
name 'buildMode'
86+
values 'release', 'debug'
87+
}
88+
axis {
89+
name 'linkMode'
90+
values 'static', 'dynamic'
7691
}
7792
}
78-
79-
stage('Build all modes') {
80-
matrix {
81-
axes {
82-
axis {
83-
name 'buildMode'
84-
values 'release', 'debug'
85-
}
86-
axis {
87-
name 'linkMode'
88-
values 'static', 'dynamic'
89-
}
90-
}
91-
stages {
92-
stage('Build single mode') {
93-
steps {
94-
echo("Build ${buildMode}/${linkMode}")
95-
runBuildStage(buildMode, linkMode)
96-
}
93+
stages {
94+
stage('Build single mode') {
95+
steps {
96+
runInsideExecutor(
97+
'',
98+
pipelineInfo.dockerDir,
99+
) {
100+
echo("Building ${buildMode}/${linkMode}")
101+
buildExamples(
102+
pipelineInfo.connextArch,
103+
pipelineInfo.connextDir,
104+
buildMode,
105+
linkMode,
106+
env.WORKSPACE,
107+
)
97108
}
98109
}
99110
}
100111
}
101-
102-
stage('Static Analysis') {
103-
steps {
104-
sh "python3 resources/ci_cd/linux_static_analysis.py --build-dir ${get_build_directory('release', 'dynamic')}"
105-
}
106-
}
107112
}
108-
109-
post {
110-
cleanup {
111-
cleanWs()
113+
}
114+
stage('Static Analysis') {
115+
steps {
116+
runInsideExecutor(
117+
'',
118+
pipelineInfo.dockerDir,
119+
) {
120+
runStaticAnalysis(
121+
buildExamples.getBuildDirectory('release', 'dynamic'),
122+
pipelineInfo.connextDir,
123+
pipelineInfo.staticAnalysisDir,
124+
)
112125
}
126+
publishHTML(target: [
127+
allowMissing: true,
128+
alwaysLinkToLastBuild: true,
129+
keepAll: true,
130+
reportDir: pipelineInfo.staticAnalysisDir,
131+
reportFiles: 'index.html',
132+
reportName: 'LLVM Scan build static analysis',
133+
])
113134
}
114135
}
115136
}
137+
post {
138+
cleanup {
139+
cleanWs()
140+
}
141+
}
116142
}
117143

0 commit comments

Comments
 (0)