-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile.quick
285 lines (283 loc) · 19.8 KB
/
Jenkinsfile.quick
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
// Define variables
def _user="saluser"
def _home="/home/" + _user
pipeline {
parameters {
string defaultValue: 'develop', description: 'The branch of ts_sal to test.', name: 'SAL_BRANCH', trim: true
string defaultValue: 'develop', description: 'The branch of ts_xml to test.', name: 'XML_BRANCH', trim: true
string defaultValue: 'main', description: 'The branch of ts_idl to test.', name: 'IDL_BRANCH', trim: true
string defaultValue: 'main', description: 'The branch of ts_ddsconfig to test.', name: 'DDSCONFIG_BRANCH', trim: true
string defaultValue: 'develop', description: 'The branch of lsst-camera-ccs/org-lsst-camera-simple-sal to test.', name: 'SIMPLESAL_BRANCH', trim: true
string defaultValue: '${BRANCH_NAME}', description: 'The branch of robotframework_salgenerator to test.', name: 'SALGEN_BRANCH', trim: true
string defaultValue: 'develop', description: 'The branch of robotframework_SAL to test.', name: 'SALMSG_BRANCH', trim: true
booleanParam defaultValue: params.Generate ?:false, description: 'Run the "salgenerator generate" tests?', name: 'Generate'
}
environment {
AWS_ACCESS_KEY_ID = credentials('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = credentials('AWS_SECRET_ACCESS_KEY')
}
options {
disableConcurrentBuilds()
}
agent {
docker {
image 'ts-dockerhub.lsst.org/robotsal:latest'
args '-w ' + _home + ' -e AWS_ACCESS_KEY_ID=$aws_key_id -e AWS_SECRET_ACCESS_KEY=$aws_secret_key ' +
'-e NEXUS_USER=$nexus_user -e NEXUS_PASS=$nexus_pass ' +
'-e LSST_DDS_PARTITION_PREFIX=citest_${BRANCH_NAME} -v ${WORKSPACE}:' + _home + '/repos'
label 'Node1_4CPU || Node3_4CPU'
}
}
stages {
stage('Pull Git repos') {
steps {
echo "The SAL Branch: " + SAL_BRANCH
echo "The XML Branch: " + XML_BRANCH
echo "The IDL Branch: " + IDL_BRANCH
echo "The DDSCONFIG Branch: " + DDSCONFIG_BRANCH
echo "The SIMPLESAL Branch: " + SIMPLESAL_BRANCH
echo "The RFSALGEN Branch: " + SALGEN_BRANCH
echo "The RFSALMSGs Branch: " + SALMSG_BRANCH
// Checkout the SAL, XML, IDL, DDSCONFIG and Salgenerator and SAL Messaging test repos.
checkout poll: false, scm: [$class: 'GitSCM', branches: [[name: SAL_BRANCH]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'ts_sal']], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/lsst-ts/ts_sal']]]
checkout poll: false, scm: [$class: 'GitSCM', branches: [[name: XML_BRANCH]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'ts_xml']], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/lsst-ts/ts_xml']]]
checkout poll: false, scm: [$class: 'GitSCM', branches: [[name: IDL_BRANCH]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'ts_idl']], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/lsst-ts/ts_idl']]]
checkout poll: false, scm: [$class: 'GitSCM', branches: [[name: DDSCONFIG_BRANCH]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'ts_ddsconfig']], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/lsst-ts/ts_ddsconfig']]]
checkout poll: false, scm: [$class: 'GitSCM', branches: [[name: SALGEN_BRANCH]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'robotframework_salgenerator']], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/lsst-ts/robotframework_salgenerator']]]
checkout poll: false, scm: [$class: 'GitSCM', branches: [[name: SALMSG_BRANCH]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'robotframework_SAL']], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/lsst-ts/robotframework_SAL']]]
checkout poll: false, scm: [$class: 'GitSCM', branches: [[name: SIMPLESAL_BRANCH]], extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'simple_sal']], userRemoteConfigs: [[credentialsId: '14e4c262-1fb1-4b73-b395-5fe617420c85', url: 'https://github.com/lsst-camera-ccs/org-lsst-camera-simple-sal.git']]]
}
}//Git repos
stage('Setup: Define variables and create directories') {
steps {
println("The container user: " + _user);
println("The container home dir: " + _home);
script {
SAL_Version = sh(returnStdout: true, script: "cd /home/saluser/repos/ts_sal && git describe |sed s/v//g").trim()
XML_Version = sh(returnStdout: true, script: "cd /home/saluser/repos/ts_xml && git describe |sed s/v//g").trim()
SAL_Version_Base = sh(returnStdout: true, script: "echo " + SAL_Version + " |cut -d '-' -f1 |sed s/v//g").trim()
XML_Version_Base = sh(returnStdout: true, script: "echo " + XML_Version + " |cut -d '-' -f1 |sed s/v//g").trim()
SAL_Version_RC = sh(returnStdout: true, script: "echo " + SAL_Version + " |cut -d '-' -f1,2 |sed s/v//g").trim()
XML_Version_RC = sh(returnStdout: true, script: "echo " + XML_Version + " |cut -d '-' -f1,2 |sed s/v//g").trim()
if (params.SAL_BRANCH == 'main' || params.XML_BRANCH == 'main') {
println("This is a RELEASE build.")
// Maven and RPM release artifacts simply use the version numbers.
MavenVersion = ''
Build_Param = ''
RPM_Version = XML_Version_Base + "-" + SAL_Version_Base
} else if (SAL_Version_RC.contains('rc')) {
println("This is a SAL RELEASE CANDIDATE build.")
// Maven and RPM release candidate artifacts simply use the version numbers.
MavenVersion = ''
Build_Param = ''
RPM_Version = XML_Version_Base + "-" + SAL_Version_RC
} else if (XML_Version_RC.contains('rc')) {
println("This is an XML RELEASE CANDIDATE build.")
// Maven and RPM release candidate artifacts simply use the version numbers.
MavenVersion = ''
Build_Param = ''
RPM_Version = XML_Version_RC + "-" + SAL_Version_Base
} else {
println("This is a daily build.")
// Maven develop/daily/etc artifacts add the -SNAPSHOT string.
MavenVersion = '-SNAPSHOT'
// RPM develop/daily/etc artifacts add 'pre' and the Build Number string.
Build_Param = "post${BUILD_NUMBER}"
RPM_Version = XML_Version_Base + "~" + Build_Param + "-" + SAL_Version_Base
}
}
sh 'mkdir -pv "${WORKSPACE}/Reports"'
sh 'mkdir -pv ' + _home + '/repos/Reports'
echo "The Branch Name: ${GIT_BRANCH}"
echo "The SAL version: " + SAL_Version
echo "The SAL base version: " + SAL_Version_Base
echo "The SAL RC version: " + SAL_Version_RC
echo "The XML version: " + XML_Version
echo "The XML base version: " + XML_Version_Base
echo "The XML RC version: " + XML_Version_RC
echo "The Maven version: " + MavenVersion
echo "The RPM Version: " + RPM_Version
}
}//Define SAL & XML variables
stage('Copy XML files') {
steps {
// Move XML definition files to the SAL working directory.
sh label: 'XML files', script: '#!/bin/bash \n' + 'cp -v ${WORKSPACE}/ts_xml/python/lsst/ts/xml/data/sal_interfaces/*/*.xml ts_sal/test'
sh label: 'SAL Subsystems', script: '#!/bin/bash \n' + 'cp -v ${WORKSPACE}/ts_xml/python/lsst/ts/xml/data/sal_interfaces/SALSubsystems.xml ts_sal/test'
sh label: 'SAL Generics', script: '#!/bin/bash \n' + 'cp -v ${WORKSPACE}/ts_xml/python/lsst/ts/xml/data/sal_interfaces/SALGenerics.xml ts_sal/test'
}
}//Copy XML
stage('Install IDL and XML python libraries') {
steps {
sh label: 'IDL library', script: '#!/bin/bash -x \n' + 'cd ts_idl && pip3.11 install -e . --ignore-installed --no-deps'
sh label: 'XML library', script: '#!/bin/bash -x \n' + 'cd ts_xml && pip3.11 install -e . --ignore-installed --no-deps'
}
}//IDL & XML
stage('Validate') {
steps {
script {
if ( params.Generate ) {
script_test_path = _home + '/repos/robotframework_salgenerator/GENERATE/Script_Generate.robot'
test_test_path = _home + '/repos/robotframework_salgenerator/GENERATE/Test_Generate.robot'
} else {
script_test_path = _home + '/repos/robotframework_salgenerator/DDS_SALGEN/Script_salgenerator.robot'
test_test_path = _home + '/repos/robotframework_salgenerator/DDS_SALGEN/Test_salgenerator.robot'
}
}
echo "Script test suite: " + script_test_path
echo "Test test suite: " + test_test_path
// Validate the SAL/XML state using Test/Script CSCs
sh label: 'Validate', script: '#!/bin/bash \n' + 'source ' + _home + '/.bash_profile \n' + 'set -x \n' +
'echo LSST_DDS_QOS: $LSST_DDS_QOS \n' +
'echo TS_SAL_DIR: $TS_SAL_DIR \n' +
'echo TS_XML_DIR: $TS_XML_DIR \n' +
'echo ========= Move to robotframework_salgenerator directory ========= \n' +
'echo cd ' + _home + '/repos/robotframework_salgenerator \n' +
'cd ' + _home + '/repos/robotframework_salgenerator \n' +
'pwd \n' +
'robot --variable ContInt:true -e skipped --skiponfailure TSS* --skiponfailure DM* --loglevel TRACE:INFO' +
' --variable SALVersion:' + SAL_Version + ' --variable SALVersionBase:' + SAL_Version_Base +
' --variable XMLVersion:' + XML_Version + ' --variable XMLVersionBase:' + XML_Version_Base +
' --variable SALInstall:' + _home + '/repos/ts_sal --variable XMLHome:' + _home + '/repos/ts_xml' +
' --variable MavenVersion:' + MavenVersion + ' --variable Build_Number:' + Build_Param + ' ' +
'--name Validate --output VALIDATE --outputdir ' + _home + '/repos/Reports ' +
_home + '/repos/robotframework_salgenerator/Verify_SAL_DDS_Setup.robot ' + script_test_path + ' ' + test_test_path + '\n' +
'Result=$? \n' +
'if [ $Result -eq 0 ]; then echo Validation complete; else exit $Result; fi'
}
}//Validate
stage('Run simple-sal tests') {
when {
not {
expression {
return params.Generate
}
}
}
steps {
sh label: 'Simple-SAL', script: '#!/bin/bash \n' + 'source ' + _home + '/.bash_profile \n' + 'set -x \n' +
'echo ========= Move to simple-sal directory ========= \n' +
'echo cd ' + _home + '/repos/simple_sal \n' +
'cd ' + _home + '/repos/simple_sal \n' +
'echo ========= Execute simple-sal tests ========= \n' +
'mvn --no-transfer-progress -B clean install'
}
}//simple-sal
stage('Run C++ Messaging Tests') {
when {
not {
expression {
return params.Generate
}
}
}
parallel {
stage('CppTelemetry') {
steps {
sh label: 'CppTelemetry', script: '#!/bin/bash \n' + 'source ' + _home + '/.bash_profile \n' + 'set -x \n' +
'echo ========= Move to robotframework_SAL directory ========= \n' +
'echo cd ' + _home + '/repos/robotframework_SAL \n' +
'cd ' + _home + '/repos/robotframework_SAL \n' +
'echo ========= Execute SAL messaging tests ========= \n' +
'robot --variable ContInt:true -e skipped --skiponfailure DM* --loglevel TRACE:INFO' +
' --variable SALVersion:' + SAL_Version + ' --variable XMLVersion:' + XML_Version +
' --variable SALInstall:' + _home + '/repos/ts_sal --variable XMLHome:' + _home + '/repos/ts_xml ' +
' --variable MavenVersion:' + MavenVersion + ' --variable Build_Number:' + Build_Param +
' --outputdir ' + _home + '/repos/Reports --name CombinedCppTelemetry --output CombinedCppTelemetry ' +
_home + '/repos/robotframework_SAL/Combined/DDS_CPP/Telemetry/Test_Telemetry.robot \n' +
'exit 0'
}
}//CppTelemetry
stage('CppEvents') {
steps {
sh label: 'CppEvents', script: '#!/bin/bash \n' + 'source ' + _home + '/.bash_profile \n' + 'set -x \n' +
'echo ========= Move to robotframework_SAL directory ========= \n' +
'echo cd ' + _home + '/repos/robotframework_SAL \n' +
'cd ' + _home + '/repos/robotframework_SAL \n' +
'echo Start \n' +
'robot --variable ContInt:true -e skipped --skiponfailure DM* --loglevel TRACE:INFO' +
' --variable SALVersion:' + SAL_Version + ' --variable XMLVersion:' + XML_Version +
' --variable SALInstall:' + _home + '/repos/ts_sal --variable XMLHome:' + _home + '/repos/ts_xml ' +
' --variable MavenVersion:' + MavenVersion + ' --variable Build_Number:' + Build_Param +
' --outputdir ' + _home + '/repos/Reports --name CombinedCppEvents --output CombinedCppEvents ' +
_home + '/repos/robotframework_SAL/Combined/DDS_CPP/Events/Script_Events.robot ' +
_home + '/repos/robotframework_SAL/Combined/DDS_CPP/Events/Test_Events.robot \n' +
'exit 0'
}
}//CppEvents
}//parallel
}//RunCppMessagingTests
stage('Run Java Messaging Tests') {
when {
not {
expression {
return params.Generate
}
}
}
parallel {
stage('JavaTelemetry') {
steps {
sh label: 'JavaTelemetry', script: '#!/bin/bash \n' + 'source ' + _home + '/.bash_profile \n' + 'set -x \n' +
'echo ========= Move to robotframework_SAL directory ========= \n' +
'echo cd ' + _home + '/repos/robotframework_SAL \n' +
'cd ' + _home + '/repos/robotframework_SAL \n' +
'echo ========= Execute SAL Java messaging tests ========= \n' +
'robot --variable ContInt:true -e skipped --skiponfailure DM* --loglevel TRACE:INFO' +
' --variable SALVersion:' + SAL_Version + ' --variable SALVersionBase:' + SAL_Version_Base +
' --variable XMLVersion:' + XML_Version + ' --variable XMLVersionBase:' + XML_Version_Base +
' --variable SALInstall:' + _home + '/repos/ts_sal --variable XMLHome:' + _home + '/repos/ts_xml ' +
' --variable MavenVersion:' + MavenVersion + ' --variable Build_Number:' + Build_Param +
' --outputdir ' + _home + '/repos/Reports --name CombinedJavaTelemetry --output CombinedJavaTelemetry ' +
_home + '/repos/robotframework_SAL/Combined/DDS_JAVA/Telemetry/Test_Telemetry.robot \n' +
'exit 0'
}
}//JavaTelemetry
stage('JavaEvents') {
steps {
sh label: 'JavaEvents', script: '#!/bin/bash \n' + 'source ' + _home + '/.bash_profile \n' + 'set -x \n' +
'echo ========= Move to robotframework_SAL directory ========= \n' +
'echo cd ' + _home + '/repos/robotframework_SAL \n' +
'cd ' + _home + '/repos/robotframework_SAL \n' +
'echo ========= Execute SAL messaging tests ========= \n' +
'robot --variable ContInt:true -e skipped --skiponfailure DM* --loglevel TRACE:INFO' +
' --variable SALVersion:' + SAL_Version + ' --variable SALVersionBase:' + SAL_Version_Base +
' --variable XMLVersion:' + XML_Version + ' --variable XMLVersionBase:' + XML_Version_Base +
' --variable SALInstall:' + _home + '/repos/ts_sal --variable XMLHome:' + _home + '/repos/ts_xml ' +
' --variable MavenVersion:' + MavenVersion + ' --variable Build_Number:' + Build_Param +
' --outputdir ' + _home + '/repos/Reports --name CombinedJavaEvents --output CombinedJavaEvents ' +
_home + '/repos/robotframework_SAL/Combined/DDS_JAVA/Events/Test_Events.robot \n' +
'exit 0'
}
}//JavaEvents
}//parallel
}//RunJavaMessagingTests
}//stages
post {
always {
//Process Robot-Framework results.
sh label: 'Results', script: '#!/bin/bash \n' + 'echo "# Check for output files."\n' +
'declare -a outputs=(VALIDATE.xml CombinedCppTelemetry.xml CombinedCppEvents.xml CombinedJavaTelemetry.xml CombinedJavaEvents.xml )\n' +
'echo ${outputs[@]}\n' +
'i=0\n echo i=$i\n' + 'for item in "${outputs[@]}"; do\n' +
'\tif test -f ' + _home + '/repos/Reports/$item; then array[$i]=' + _home + '/repos/Reports/$item; else echo ' +
_home + '/repos/Reports/$item does not exist!; fi\n' +
'\t(( i++ ))\n' + 'done\n' +
'echo ========= Generate the reports =========\n' + 'set -x \n' +
'rebot --nostatusrc --removekeywords wuks ' +
'--outputdir ' + _home + '/repos/Reports --name SAL_Test_Quick -o rpm_output.xml -l rpm_log.html ' +
'-r rpm_report.html ${array[@]} \n' +
'echo Processing Robot-Framework results complete'
//Publish results to Jenkins.
robot onlyCritical: false, outputPath: 'Reports', logFileName: 'rpm_log.html', outputFileName: 'rpm_output.xml', reportFileName: 'rpm_report.html', passThreshold: 99.5, unstableThreshold: 99.0
//Email Notification
step([$class: 'Mailer',
notifyEveryUnstableBuild: false,
recipients: "[email protected]",
sendToIndividuals: true])
}
success {
cleanWs cleanWhenAborted: false, cleanWhenFailure: false, cleanWhenUnstable: false, deleteDirs: true, disableDeferredWipeout: true, notFailBuild: true
}
}//post
}//pipeline