blob: 47e6c1063790553bc66dbe995c53d64d5287baac [file] [log] [blame]
Joey Armstrong8c6f6482023-01-12 12:31:44 -05001// Copyright 2021-2023 Open Networking Foundation (ONF) and the ONF Contributors
Matteo Scandolo42f6e572021-01-25 15:11:34 -08002//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
Hardik Windlassec9341b2021-06-07 11:58:29 +000015// voltha-2.x e2e tests for openonu-go
Matteo Scandolo42f6e572021-01-25 15:11:34 -080016// uses bbsim to simulate OLT/ONUs
17
Joey Armstronge5aae1c2023-07-24 14:11:20 -040018// [TODO] Update syntax below to the latest supported
Matteo Scandoloa156b572021-02-04 11:52:18 -080019library identifier: 'cord-jenkins-libraries@master',
20 retriever: modernSCM([
21 $class: 'GitSCMSource',
22 remote: 'https://gerrit.opencord.org/ci-management.git'
23])
24
Joey Armstronge5aae1c2023-07-24 14:11:20 -040025//------------------//
26//---] GLOBAL [---//
27//------------------//
Hardik Windlassec9341b2021-06-07 11:58:29 +000028def clusterName = "kind-ci"
Joey Armstronge5aae1c2023-07-24 14:11:20 -040029String branch_name = 'master'
Hardik Windlassec9341b2021-06-07 11:58:29 +000030
Joey Armstronge5aae1c2023-07-24 14:11:20 -040031// -----------------------------------------------------------------------
Joey Armstrong06a68372023-07-24 16:37:16 -040032// Intent: Due to lack of a reliable stack trace, construct a literal.
33// Jenkins will re-write the call stack for serialization.
34// -----------------------------------------------------------------------
35def getIam(String func)
36{
37 String src = [
38 'ci-management',
39 'jjb',
40 'pipeline',
41 'voltha',
42 branch_name,
43 'bbsim-tests.groovy'
44 ].join('/')
45
46 String iam = [src, func].join('::')
47 return iam
48}
49
50// -----------------------------------------------------------------------
Joey Armstronge5aae1c2023-07-24 14:11:20 -040051// Intent: Determine if working on a release branch.
52// Note: Conditional is legacy, should also check for *-dev or *-pre
53// -----------------------------------------------------------------------
54Boolean isReleaseBranch(String name)
55{
56 // List modifiers = ['-dev', '-pre', 'voltha-x.y.z-pre']
57 // if branch_name in modifiers
58 return(name != 'master') // OR branch_name.contains('-')
59}
60
61// -----------------------------------------------------------------------
Joey Armstrong06a68372023-07-24 16:37:16 -040062// Intent: Phase helper method
63// -----------------------------------------------------------------------
64Boolean my_install_kind()
65{
66 String iam = getIam('installKind')
67 Boolean ans = False
68
69 println("** ${iam}: ENTER")
70 try
71 {
72 println("** ${iam} Running: installKind() { debug:true }"
Joey Armstrong5c494962023-07-25 16:48:48 -040073 installKind(branch_name)
Joey Armstrong06a68372023-07-24 16:37:16 -040074 println("** ${iam}: Ran to completion")
75 ans = True // iff
76 }
77 catch (Exception err)
78 {
79 ans = False
80 println("** ${iam}: EXCEPTION ${err}")
81 throw err
82 }
83 finally
84 {
85 println("** ${iam}: ENTER")
86 }
87
88 return(ans)
89}
90
91// -----------------------------------------------------------------------
Joey Armstronge5aae1c2023-07-24 14:11:20 -040092// Intent:
93// -----------------------------------------------------------------------
Joey Armstrong2d5a7c12023-04-13 09:37:42 -040094def execute_test(testTarget, workflow, testLogging, teardown, testSpecificHelmFlags = "")
95{
Joey Armstrong8c6f6482023-01-12 12:31:44 -050096 def infraNamespace = "default"
97 def volthaNamespace = "voltha"
98 def logsDir = "$WORKSPACE/${testTarget}"
Joey Armstrong293e16b2022-11-26 20:16:33 -050099
100 stage('IAM')
101 {
Joey Armstrong84adc542023-04-11 14:47:34 -0400102 script
103 {
Joey Armstrong06a68372023-07-24 16:37:16 -0400104 // Announce ourselves for log usability
105 String iam = getIam('execute_test')
Joey Armstronge5aae1c2023-07-24 14:11:20 -0400106 println("${iam}: ENTER")
107 println("${iam}: LEAVE")
Joey Armstrong84adc542023-04-11 14:47:34 -0400108 }
Joey Armstrong293e16b2022-11-26 20:16:33 -0500109 }
110
111 stage('Cleanup') {
Joey Armstrong84adc542023-04-11 14:47:34 -0400112 if (teardown) {
113 timeout(15) {
114 script {
115 helmTeardown(["default", infraNamespace, volthaNamespace])
116 }
117 timeout(1) {
118 sh returnStdout: false, script: '''
Hardik Windlassec9341b2021-06-07 11:58:29 +0000119 # remove orphaned port-forward from different namespaces
Joey Armstronge5aae1c2023-07-24 14:11:20 -0400120 ps aux | grep port-forw | grep -v grep | awk '{print $2}' | xargs --no-run-if-empty kill -9
Hardik Windlassec9341b2021-06-07 11:58:29 +0000121 '''
Joey Armstrong84adc542023-04-11 14:47:34 -0400122 }
123 }
124 }
Hardik Windlassec9341b2021-06-07 11:58:29 +0000125 }
Joey Armstrong8c6f6482023-01-12 12:31:44 -0500126
127 stage ('Initialize')
128 {
Joey Armstrong84adc542023-04-11 14:47:34 -0400129 // VOL-4926 - Is voltha-system-tests available ?
130 String cmd = [
131 'make',
132 '-C', "$WORKSPACE/voltha-system-tests",
133 "KAIL_PATH=\"$WORKSPACE/bin\"",
134 'kail',
135 ].join(' ')
136 println(" ** Running: ${cmd}:\n")
Joey Armstrongbeef4cd2023-01-18 09:59:58 -0500137 sh("${cmd}")
Joey Armstrong06a68372023-07-24 16:37:16 -0400138
139 // if (! my_install_kail())
140 // throw new Exception('installKail() failed')
141 if (! my_install_kind())
142 throw new Exception('installKind() failed')
Joey Armstrong8c6f6482023-01-12 12:31:44 -0500143 }
144
Joey Armstrong06a68372023-07-24 16:37:16 -0400145
146
147 stage('Deploy common infrastructure')
148 {
Joey Armstrong84adc542023-04-11 14:47:34 -0400149 sh '''
Hardik Windlasse1660492022-03-14 15:12:46 +0000150 helm repo add onf https://charts.opencord.org
151 helm repo update
152 if [ ${withMonitoring} = true ] ; then
153 helm install nem-monitoring onf/nem-monitoring \
154 --set prometheus.alertmanager.enabled=false,prometheus.pushgateway.enabled=false \
155 --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false
156 fi
157 '''
Joey Armstrong8c6f6482023-01-12 12:31:44 -0500158 }
159
Joey Armstronge5aae1c2023-07-24 14:11:20 -0400160 stage('Deploy Voltha')
161 {
162 if (teardown)
163 {
164 timeout(10)
165 {
166 script
167 {
Hardik Windlassec9341b2021-06-07 11:58:29 +0000168 sh """
Matteo Scandolo9c230bb2021-10-22 12:48:39 -0700169 mkdir -p ${logsDir}
170 _TAG=kail-startup kail -n ${infraNamespace} -n ${volthaNamespace} > ${logsDir}/onos-voltha-startup-combined.log &
Hardik Windlassec9341b2021-06-07 11:58:29 +0000171 """
172
173 // if we're downloading a voltha-helm-charts patch, then install from a local copy of the charts
174 def localCharts = false
Joey Armstronge5aae1c2023-07-24 14:11:20 -0400175
176 if (volthaHelmChartsChange != ""
177 || gerritProject == "voltha-helm-charts"
178 || isReleaseBranch(branch) // branch != 'master'
179 ) {
Hardik Windlassec9341b2021-06-07 11:58:29 +0000180 localCharts = true
181 }
Joey Armstronge5aae1c2023-07-24 14:11:20 -0400182 Boolean is_release = isReleaseBranch(branch)
183 println(" ** localCharts=${localCharts}, branch_name=${branch_name}, isReleaseBranch=${is_release}")
Hardik Windlassec9341b2021-06-07 11:58:29 +0000184
185 // NOTE temporary workaround expose ONOS node ports
Joey Armstronge5aae1c2023-07-24 14:11:20 -0400186 def localHelmFlags = extraHelmFlags.trim()
187 + " --set global.log_level=${logLevel.toUpperCase()} "
188 + " --set onos-classic.onosSshPort=30115 "
189 + " --set onos-classic.onosApiPort=30120 "
190 + " --set onos-classic.onosOfPort=31653 "
191 + " --set onos-classic.individualOpenFlowNodePorts=true "
192 + testSpecificHelmFlags
Matteo Scandolo42f6e572021-01-25 15:11:34 -0800193
Hardik Windlassec9341b2021-06-07 11:58:29 +0000194 if (gerritProject != "") {
195 localHelmFlags = "${localHelmFlags} " + getVolthaImageFlags("${gerritProject}")
196 }
197
198 volthaDeploy([
199 infraNamespace: infraNamespace,
200 volthaNamespace: volthaNamespace,
201 workflow: workflow.toLowerCase(),
Hardik Windlass2b164342022-02-28 03:50:48 +0000202 withMacLearning: enableMacLearning.toBoolean(),
Hardik Windlassec9341b2021-06-07 11:58:29 +0000203 extraHelmFlags: localHelmFlags,
204 localCharts: localCharts,
205 bbsimReplica: olts.toInteger(),
206 dockerRegistry: registry,
207 ])
Matteo Scandolod17de3a2021-04-09 15:47:52 -0700208 }
Matteo Scandolofcfc60d2021-02-24 09:06:48 -0800209
Joey Armstronge5aae1c2023-07-24 14:11:20 -0400210 // -----------------------------------------------------------------------
211 // Intent: Replacing P_IDS with pgrep/pkill is a step forward.
212 // Why not simply use a pid file, capture _TAG=kail-startup above
213 // Grep runs the risk of terminating stray commands (??-good <=> bad-??)
214 // -----------------------------------------------------------------------
215 println('Try out the pgrep/pkill commands')
216 def stream = sh(
217 returnStatus:false,
218 returnStdout:true,
219 script: '''pgrep --list-full kail-startup || true'''
220 )
221 println("** pgrep output: ${stream}")
222
223 // -----------------------------------------------------------------------
224 // stop logging
225 // -----------------------------------------------------------------------
Matteo Scandolod17de3a2021-04-09 15:47:52 -0700226 sh """
Hardik Windlassec9341b2021-06-07 11:58:29 +0000227 P_IDS="\$(ps e -ww -A | grep "_TAG=kail-startup" | grep -v grep | awk '{print \$1}')"
228 if [ -n "\$P_IDS" ]; then
229 echo \$P_IDS
230 for P_ID in \$P_IDS; do
231 kill -9 \$P_ID
232 done
233 fi
Matteo Scandolo9c230bb2021-10-22 12:48:39 -0700234 cd ${logsDir}
Hardik Windlassec9341b2021-06-07 11:58:29 +0000235 gzip -k onos-voltha-startup-combined.log
236 rm onos-voltha-startup-combined.log
Matteo Scandolod17de3a2021-04-09 15:47:52 -0700237 """
Hardik Windlassec9341b2021-06-07 11:58:29 +0000238 }
Joey Armstrong2d5a7c12023-04-13 09:37:42 -0400239
240 sh """
Hardik Windlassec9341b2021-06-07 11:58:29 +0000241 JENKINS_NODE_COOKIE="dontKillMe" _TAG="voltha-voltha-api" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n ${volthaNamespace} svc/voltha-voltha-api 55555:55555; done"&
242 JENKINS_NODE_COOKIE="dontKillMe" _TAG="voltha-infra-etcd" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n ${infraNamespace} svc/voltha-infra-etcd 2379:2379; done"&
243 JENKINS_NODE_COOKIE="dontKillMe" _TAG="voltha-infra-kafka" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n ${infraNamespace} svc/voltha-infra-kafka 9092:9092; done"&
244 bbsimDmiPortFwd=50075
245 for i in {0..${olts.toInteger() - 1}}; do
246 JENKINS_NODE_COOKIE="dontKillMe" _TAG="bbsim\${i}" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n ${volthaNamespace} svc/bbsim\${i} \${bbsimDmiPortFwd}:50075; done"&
247 ((bbsimDmiPortFwd++))
248 done
Hardik Windlass3bb089a2022-03-22 17:56:03 +0000249 if [ ${withMonitoring} = true ] ; then
250 JENKINS_NODE_COOKIE="dontKillMe" _TAG="nem-monitoring-prometheus-server" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n default svc/nem-monitoring-prometheus-server 31301:80; done"&
251 fi
Hardik Windlassec9341b2021-06-07 11:58:29 +0000252 ps aux | grep port-forward
253 """
Joey Armstrong8c6f6482023-01-12 12:31:44 -0500254
Joey Armstrong2d5a7c12023-04-13 09:37:42 -0400255 // setting ONOS log level
256 script
257 {
258 setOnosLogLevels([
259 onosNamespace: infraNamespace,
260 apps: [
261 'org.opencord.dhcpl2relay',
262 'org.opencord.olt',
263 'org.opencord.aaa',
264 'org.opencord.maclearner',
265 'org.onosproject.net.flowobjective.impl.FlowObjectiveManager',
266 'org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager'
267 ],
268 logLevel: logLevel
269 ])
270 } // script
271 } // if (teardown)
272 } // stage('Deploy Voltha')
273
274 stage('Run test ' + testTarget + ' on ' + workflow + ' workFlow')
275 {
276 sh """
Hardik Windlass8cd517c2022-03-22 04:01:40 +0000277 if [ ${withMonitoring} = true ] ; then
Joey Armstrong8c6f6482023-01-12 12:31:44 -0500278 mkdir -p "$WORKSPACE/voltha-pods-mem-consumption-${workflow}"
279 cd "$WORKSPACE/voltha-system-tests"
Joey Armstronge5aae1c2023-07-24 14:11:20 -0400280 make venv-activate-script
281 set +u && source .venv/bin/activate && set -u
Hardik Windlass8cd517c2022-03-22 04:01:40 +0000282 # Collect initial memory consumption
Joey Armstrong0eb8bd82023-07-10 13:26:25 -0400283 python scripts/mem_consumption.py -o $WORKSPACE/voltha-pods-mem-consumption-${workflow} -a 0.0.0.0:31301 -n ${volthaNamespace}
Hardik Windlass8cd517c2022-03-22 04:01:40 +0000284 fi
Hardik Windlasse1660492022-03-14 15:12:46 +0000285 """
Joey Armstrong2d5a7c12023-04-13 09:37:42 -0400286
287 sh """
Matteo Scandolo9c230bb2021-10-22 12:48:39 -0700288 mkdir -p ${logsDir}
Hardik Windlassd62442d2021-11-30 10:51:20 +0000289 export ROBOT_MISC_ARGS="-d ${logsDir} ${params.extraRobotArgs} "
Matteo Scandolo9c230bb2021-10-22 12:48:39 -0700290 ROBOT_MISC_ARGS+="-v ONOS_SSH_PORT:30115 -v ONOS_REST_PORT:30120 -v NAMESPACE:${volthaNamespace} -v INFRA_NAMESPACE:${infraNamespace} -v container_log_dir:${logsDir} -v logging:${testLogging}"
Hardik Windlass72947302021-06-14 10:36:57 +0000291 export KVSTOREPREFIX=voltha/voltha_voltha
Matteo Scandolo42f6e572021-01-25 15:11:34 -0800292
Joey Armstrong0eb8bd82023-07-10 13:26:25 -0400293 make -C "$WORKSPACE/voltha-system-tests" ${testTarget}
Hardik Windlass72947302021-06-14 10:36:57 +0000294 """
Joey Armstrong2d5a7c12023-04-13 09:37:42 -0400295
296 getPodsInfo("${logsDir}")
297
298 sh """
Joey Armstronge5aae1c2023-07-24 14:11:20 -0400299 # set +e
Hardik Windlassdad8e5c2021-11-11 05:19:47 +0000300 # collect logs collected in the Robot Framework StartLogging keyword
301 cd ${logsDir}
Joey Armstronge5aae1c2023-07-24 14:11:20 -0400302 gzip *-combined.log
303 rm -f *-combined.log
Hardik Windlassdad8e5c2021-11-11 05:19:47 +0000304 """
Joey Armstrong2d5a7c12023-04-13 09:37:42 -0400305
Hardik Windlass8cd517c2022-03-22 04:01:40 +0000306 sh """
307 if [ ${withMonitoring} = true ] ; then
Joey Armstrong8c6f6482023-01-12 12:31:44 -0500308 cd "$WORKSPACE/voltha-system-tests"
Joey Armstronge5aae1c2023-07-24 14:11:20 -0400309 make venv-activate-script
310 set +u && source .venv/bin/activate && set -u
Hardik Windlass8cd517c2022-03-22 04:01:40 +0000311 # Collect memory consumption of voltha pods once all the tests are complete
Joey Armstrong0eb8bd82023-07-10 13:26:25 -0400312 python scripts/mem_consumption.py -o $WORKSPACE/voltha-pods-mem-consumption-${workflow} -a 0.0.0.0:31301 -n ${volthaNamespace}
Hardik Windlass8cd517c2022-03-22 04:01:40 +0000313 fi
314 """
Joey Armstrong2d5a7c12023-04-13 09:37:42 -0400315 } // stage
316} // execute_test()
Matteo Scandolo42f6e572021-01-25 15:11:34 -0800317
Joey Armstrong2d5a7c12023-04-13 09:37:42 -0400318// -----------------------------------------------------------------------
319// -----------------------------------------------------------------------
320def collectArtifacts(exitStatus)
321{
Hardik Windlassec9341b2021-06-07 11:58:29 +0000322 getPodsInfo("$WORKSPACE/${exitStatus}")
323 sh """
Joey Armstrong0eb8bd82023-07-10 13:26:25 -0400324 kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/${exitStatus}/voltha.log
Hardik Windlassec9341b2021-06-07 11:58:29 +0000325 """
Hardik Windlass8cd517c2022-03-22 04:01:40 +0000326 archiveArtifacts artifacts: '**/*.log,**/*.gz,**/*.txt,**/*.html,**/voltha-pods-mem-consumption-att/*,**/voltha-pods-mem-consumption-dt/*,**/voltha-pods-mem-consumption-tt/*'
Hardik Windlassec9341b2021-06-07 11:58:29 +0000327 sh '''
328 sync
Joey Armstronge5aae1c2023-07-24 14:11:20 -0400329 [[ $(pgrep --count kail) -gt 0 ]] && pkill --echo kail
Hardik Windlassec9341b2021-06-07 11:58:29 +0000330 which voltctl
331 md5sum $(which voltctl)
332 '''
333 step([$class: 'RobotPublisher',
334 disableArchiveOutput: false,
Matteo Scandolo9c230bb2021-10-22 12:48:39 -0700335 logFileName: "**/*/log*.html",
Hardik Windlassec9341b2021-06-07 11:58:29 +0000336 otherFiles: '',
Matteo Scandolo9c230bb2021-10-22 12:48:39 -0700337 outputFileName: "**/*/output*.xml",
Hardik Windlassec9341b2021-06-07 11:58:29 +0000338 outputPath: '.',
339 passThreshold: 100,
Matteo Scandolo9c230bb2021-10-22 12:48:39 -0700340 reportFileName: "**/*/report*.html",
Andrea Campanellaabc09772021-06-16 12:08:57 +0200341 unstableThreshold: 0,
342 onlyCritical: true]);
Hardik Windlassec9341b2021-06-07 11:58:29 +0000343}
344
Matteo Scandolo42f6e572021-01-25 15:11:34 -0800345pipeline {
346
347 /* no label, executor is determined by JJB */
348 agent {
349 label "${params.buildNode}"
350 }
351 options {
Hardik Windlassec9341b2021-06-07 11:58:29 +0000352 timeout(time: "${timeout}", unit: 'MINUTES')
Matteo Scandolo42f6e572021-01-25 15:11:34 -0800353 }
354 environment {
Hardik Windlassec9341b2021-06-07 11:58:29 +0000355 KUBECONFIG="$HOME/.kube/kind-${clusterName}"
356 VOLTCONFIG="$HOME/.volt/config"
357 PATH="$PATH:$WORKSPACE/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Hardik Windlassec9341b2021-06-07 11:58:29 +0000358 DIAGS_PROFILE="VOLTHA_PROFILE"
Matteo Scandolo35ac7822021-10-28 18:08:54 -0700359 SSHPASS="karaf"
Matteo Scandolo42f6e572021-01-25 15:11:34 -0800360 }
Hardik Windlassec9341b2021-06-07 11:58:29 +0000361 stages {
Matteo Scandolo42f6e572021-01-25 15:11:34 -0800362 stage('Download Code') {
363 steps {
364 getVolthaCode([
365 branch: "${branch}",
366 gerritProject: "${gerritProject}",
367 gerritRefspec: "${gerritRefspec}",
368 volthaSystemTestsChange: "${volthaSystemTestsChange}",
369 volthaHelmChartsChange: "${volthaHelmChartsChange}",
370 ])
371 }
372 }
Joey Armstrong84adc542023-04-11 14:47:34 -0400373
374 stage('Build patch v1.1')
375 {
376 // build the patch only if gerritProject is specified
377 when
378 {
379 expression
380 {
381 return !gerritProject.isEmpty()
382 }
Hardik Windlassec9341b2021-06-07 11:58:29 +0000383 }
Joey Armstrong06a68372023-07-24 16:37:16 -0400384
385 steps
386 {
387 // NOTE that the correct patch has already been checked out
388 // during the getVolthaCode step
389 buildVolthaComponent("${gerritProject}")
390 }
Matteo Scandolo42f6e572021-01-25 15:11:34 -0800391 }
Joey Armstronged161f72023-04-11 13:16:59 -0400392
Joey Armstronge5aae1c2023-07-24 14:11:20 -0400393 stage('Create K8s Cluster')
394 {
Joey Armstrongbf492922023-04-13 17:05:09 -0400395 steps
Joey Armstrong84adc542023-04-11 14:47:34 -0400396 {
Joey Armstrongbf492922023-04-13 17:05:09 -0400397 script
Joey Armstrong84adc542023-04-11 14:47:34 -0400398 {
Joey Armstronge5aae1c2023-07-24 14:11:20 -0400399 def clusterExists = sh(
Joey Armstrongbf492922023-04-13 17:05:09 -0400400 returnStdout: true,
Joey Armstronge5aae1c2023-07-24 14:11:20 -0400401 script: """kind get clusters | grep "${clusterName}" | wc -l""")
Joey Armstrongbf492922023-04-13 17:05:09 -0400402
403 if (clusterExists.trim() == "0")
404 {
405 createKubernetesCluster([nodes: 3, name: clusterName])
406 }
407 } // script
408 } // steps
409 } // stage('Create K8s Cluster')
Joey Armstrong84adc542023-04-11 14:47:34 -0400410
Joey Armstrong2d5a7c12023-04-13 09:37:42 -0400411 stage('Replace voltctl')
412 {
Joey Armstrong06a68372023-07-24 16:37:16 -0400413 // if the project is voltctl, override the downloaded one with the built one
Joey Armstrong2d5a7c12023-04-13 09:37:42 -0400414 when {
415 expression {
416 return gerritProject == "voltctl"
417 }
418 }
Joey Armstrong06a68372023-07-24 16:37:16 -0400419
420 // Hmmmm(?) where did the voltctl download happen ?
421 // Likely Makefile but would be helpful to document here.
Joey Armstrong2d5a7c12023-04-13 09:37:42 -0400422 steps
Joey Armstrong06a68372023-07-24 16:37:16 -0400423 {
424 println("${iam} Running: installVoltctl($branch)")
425 installVoltctl("$branch")
Joey Armstrong2d5a7c12023-04-13 09:37:42 -0400426 } // steps
427 } // stage
Hardik Windlassec9341b2021-06-07 11:58:29 +0000428
Joey Armstrong2d5a7c12023-04-13 09:37:42 -0400429 stage('Load image in kind nodes')
430 {
431 when {
432 expression {
433 return !gerritProject.isEmpty()
434 }
Hardik Windlassec9341b2021-06-07 11:58:29 +0000435 }
Joey Armstrong2d5a7c12023-04-13 09:37:42 -0400436 steps {
437 loadToKind()
438 }
Matteo Scandolo29597f02021-02-12 10:53:57 -0800439 }
Joey Armstrong2d5a7c12023-04-13 09:37:42 -0400440
441 stage('Parse and execute tests')
442 {
443 steps {
444 script {
445 def tests = readYaml text: testTargets
446
447 for(int i = 0;i<tests.size();i++) {
448 def test = tests[i]
449 def target = test["target"]
450 def workflow = test["workflow"]
451 def flags = test["flags"]
452 def teardown = test["teardown"].toBoolean()
453 def logging = test["logging"].toBoolean()
454 def testLogging = 'False'
455 if (logging) {
456 testLogging = 'True'
457 }
458 println "Executing test ${target} on workflow ${workflow} with logging ${testLogging} and extra flags ${flags}"
459 execute_test(target, workflow, testLogging, teardown, flags)
460 }
461 }
462 }
463 } // stage
464 } // stages
Joey Armstrong84adc542023-04-11 14:47:34 -0400465
466 post
467 {
468 aborted { collectArtifacts('aborted') }
469 failure { collectArtifacts('failed') }
Joey Armstrongbf492922023-04-13 17:05:09 -0400470 always { collectArtifacts('always') }
Matteo Scandolo42f6e572021-01-25 15:11:34 -0800471 }
Joey Armstrong2d5a7c12023-04-13 09:37:42 -0400472} // pipeline
Joey Armstronged161f72023-04-11 13:16:59 -0400473
474// EOF