blob: fd6d9ff18b58b1e0b47692fa4309eb59b2c2bbbb [file] [log] [blame]
Dean Birch62c4f082020-01-17 16:13:26 +00001#!/usr/bin/env groovy
2//-------------------------------------------------------------------------------
Xinyu Zhang433771e2022-04-01 16:49:17 +08003// Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
Dean Birch62c4f082020-01-17 16:13:26 +00004//
5// SPDX-License-Identifier: BSD-3-Clause
6//
7//-------------------------------------------------------------------------------
8
Dean Birchd0f9f8c2020-03-26 11:10:33 +00009@Library('trustedfirmware') _
10import org.trustedfirmware.Gerrit
Dean Bircha6ede7e2020-03-13 14:00:33 +000011
Xinyu Zhang0aced4c2021-09-03 17:06:21 +080012failure_states = ["FAILURE", "ABORTED", "UNSTABLE", "NOT_BUILT"]
13
Xinyu Zhang0aced4c2021-09-03 17:06:21 +080014def submit_lava_tests(config, results, build_res, params, params_collection) {
15 print("Doing LAVA stuff for ${build_res.getAbsoluteUrl()}")
Xinyu Zhang0aced4c2021-09-03 17:06:21 +080016 params += string(name: 'BUILD_NUMBER', value: "${build_res.number}")
17 params += string(name: 'BUILD_URL', value: build_res.getAbsoluteUrl())
18 params += string(name: 'LAVA_URL', value: env.LAVA_URL)
Paul Sokolovskydaa430a2022-01-06 09:59:16 +030019 params += string(name: 'CI_SCRIPTS_REPO', value: env.CI_SCRIPTS_REPO)
Xinyu Zhang0aced4c2021-09-03 17:06:21 +080020 params += string(name: 'CI_SCRIPTS_BRANCH', value: env.CI_SCRIPTS_BRANCH)
21 params += string(name: 'LAVA_CREDENTIALS', value: env.LAVA_CREDENTIALS)
22 params += string(name: 'CODE_COVERAGE_EN', value: env.CODE_COVERAGE_EN)
Xinyu Zhang0c8d3202022-10-19 14:42:47 +080023 params += string(name: 'DEVICE_FILTER', value: env.DEVICE_FILTER)
Xinyu Zhang0aced4c2021-09-03 17:06:21 +080024 def lava_res = build(job: 'tf-m-lava-submit', parameters: params, propagate: false)
25 def lava_resubmitted = false
26 if (lava_res.result in failure_states) {
27 error("LAVA Create and Submit failed at ${lava_res.getAbsoluteUrl()}")
28 } else {
29 lava_des = lava_res.getDescription()
30 if (lava_des.contains(" Submitted twice!")) {
31 lava_resubmitted = true
32 lava_des = lava_des - " Submitted twice!"
33 }
34 results['lava_jobs'] += lava_des
35 }
36 links = "Build Config: ${config}\n"
37 links += "Build URL: ${build_res.getAbsoluteUrl()}\n"
38 links += "LAVA Submit: ${lava_res.getAbsoluteUrl()}"
39 if (lava_resubmitted) {
40 links += "\nLAVA Job Re-Submitted!"
41 }
42 print(links)
43}
44
Xinyu Zhang0f78e7a2022-10-17 13:55:52 +080045def listConfigs(config_list, filter_group) {
Xinyu Zhang4b109802022-10-18 17:22:07 +080046 def build_config_list_raw = sh(script:
47 """
48 set +x\n
49 python3 ./tf-m-ci-scripts/configs.py -g ${filter_group.replace(" ", " -g ")}\n
50 set -x
51 """, returnStdout: true).trim()
52 def build_config_list = build_config_list_raw.tokenize('\n')
53 config_list.addAll(build_config_list)
Dean Birch62c4f082020-01-17 16:13:26 +000054}
55
Xinyu Zhang0f78e7a2022-10-17 13:55:52 +080056def obtainBuildParams(config) {
57 def build_params = [:]
Xinyu Zhang4b109802022-10-18 17:22:07 +080058 build_config_params = sh(script:
59 """
60 set +x\n
61 python3 ./tf-m-ci-scripts/configs.py ${config}\n
62 set -x
63 """, returnStdout: true).trim()
Dean Birch62c4f082020-01-17 16:13:26 +000064 def lines = build_config_params.tokenize('\n')
65 for (String line : lines) {
66 def key, value
67 (key, value) = line.tokenize('=')
Xinyu Zhang0f78e7a2022-10-17 13:55:52 +080068 build_params[key] = value
69 }
70 return build_params
71}
72
73def buildConfig(config, results) {
74 def params = []
75 params_collection = obtainBuildParams(config)
76 params_collection.each { param ->
77 params += string(name: param.key, value:param.value)
Dean Birch62c4f082020-01-17 16:13:26 +000078 }
79 params += string(name: 'GERRIT_BRANCH', value: env.GERRIT_BRANCH)
Dean Birchd0f9f8c2020-03-26 11:10:33 +000080 params += string(name: 'GERRIT_HOST', value: env.GERRIT_HOST)
81 params += string(name: 'GERRIT_CHANGE_NUMBER', value: env.GERRIT_CHANGE_NUMBER)
82 params += string(name: 'GERRIT_PATCHSET_REVISION', value: env.GERRIT_PATCHSET_REVISION)
Dean Birch62c4f082020-01-17 16:13:26 +000083 params += string(name: 'GERRIT_REFSPEC', value: env.GERRIT_REFSPEC)
Karl Zhang02d30352020-08-20 13:48:52 +080084 params += string(name: 'MBEDTLS_VERSION', value: env.MBEDTLS_VERSION)
Dean Birch62c4f082020-01-17 16:13:26 +000085 params += string(name: 'CODE_REPO', value: env.CODE_REPO)
Karl Zhangf6f467e2020-07-10 16:24:45 +080086 params += string(name: 'CODE_COVERAGE_EN', value: env.CODE_COVERAGE_EN)
Paul Sokolovskydaa430a2022-01-06 09:59:16 +030087 params += string(name: 'CI_SCRIPTS_REPO', value: env.CI_SCRIPTS_REPO)
Colin Thorbinson58703db2020-11-24 12:02:19 +000088 params += string(name: 'CI_SCRIPTS_BRANCH', value: env.CI_SCRIPTS_BRANCH)
Leonardo Sandoval7090b2c2021-09-17 13:20:44 -050089 params += string(name: 'MCUBOOT_REFSPEC', value: env.MCUBOOT_REFSPEC)
90 params += string(name: 'MCUBOOT_URL', value: env.MCUBOOT_URL)
91 params += string(name: 'MBEDTLS_VERSION', value: env.MBEDTLS_VERSION)
Paul Sokolovsky8d288712022-01-13 00:53:03 +030092 params += string(name: 'MBEDTLS_URL', value: env.MBEDTLS_URL)
Leonardo Sandoval7090b2c2021-09-17 13:20:44 -050093 params += string(name: 'TFM_TESTS_REFSPEC', value: env.TFM_TESTS_REFSPEC)
94 params += string(name: 'TFM_TESTS_URL', value: env.TFM_TESTS_URL)
95 params += string(name: 'PSA_ARCH_TESTS_VERSION', value: env.PSA_ARCH_TESTS_VERSION)
96 params += string(name: 'PSA_ARCH_TESTS_URL', value: env.PSA_ARCH_TESTS_URL)
97 params += string(name: 'SHARE_FOLDER', value: env.SHARE_FOLDER)
Xinyu Zhang470b3c42022-09-19 14:41:45 +080098 params += string(name: 'SQUAD_CONFIGURATIONS', value: env.SQUAD_CONFIGURATIONS)
Dean Bircha6ede7e2020-03-13 14:00:33 +000099 return { -> results
100 def build_res = build(job: 'tf-m-build-config', parameters: params, propagate: false)
Dean Bircha6ede7e2020-03-13 14:00:33 +0000101 def build_url = build_res.getAbsoluteUrl()
Xinyu Zhang0f78e7a2022-10-17 13:55:52 +0800102 results['builds'][config] = build_res
Xinyu Zhang0aced4c2021-09-03 17:06:21 +0800103
Dean Bircha6ede7e2020-03-13 14:00:33 +0000104 print("${build_res.number}: ${config} ${build_res.result} ${build_url}")
Xinyu Zhangf2ba9112021-09-02 13:31:16 +0800105
106 // Filter out configs do not need LAVA tests
107
108 // Configs with build failure do not need LAVA tests
Xinyu Zhang6aa579a2022-04-20 11:36:27 +0800109 if (build_res.result in failure_states) {
Dean Bircha6ede7e2020-03-13 14:00:33 +0000110 error("Build failed at ${build_url}")
Arthur She3c0dadd2021-11-18 21:17:48 -0800111 } else {
112 // Build successful
Xinyu Zhang6aa579a2022-04-20 11:36:27 +0800113 // Job tf-m-extra-build does not need LAVA tests
114 if (env.JOB_NAME.equals("tf-m-extra-build")) {
115 print("LAVA is not needed in tf-m-extra-build job.")
116 }
Xinyu Zhang22a12752022-10-10 17:21:21 +0800117 // Submit LAVA tests
118 else {
Arthur She3c0dadd2021-11-18 21:17:48 -0800119 submit_lava_tests(config, results, build_res, params, params_collection)
Arthur She3c0dadd2021-11-18 21:17:48 -0800120 }
Dean Birch62c4f082020-01-17 16:13:26 +0000121 }
122 }
123}
124
Matthew Hart06340d72020-06-15 16:08:20 +0100125def buildDocs(results) {
Dean Birch62c4f082020-01-17 16:13:26 +0000126 def params = []
127 params += string(name: 'GERRIT_BRANCH', value: env.GERRIT_BRANCH)
Dean Birchd0f9f8c2020-03-26 11:10:33 +0000128 params += string(name: 'GERRIT_HOST', value: env.GERRIT_HOST)
129 params += string(name: 'GERRIT_CHANGE_NUMBER', value: env.GERRIT_CHANGE_NUMBER)
130 params += string(name: 'GERRIT_PATCHSET_REVISION', value: env.GERRIT_PATCHSET_REVISION)
Dean Birch62c4f082020-01-17 16:13:26 +0000131 params += string(name: 'GERRIT_REFSPEC', value: env.GERRIT_REFSPEC)
Dean Birch62c4f082020-01-17 16:13:26 +0000132 params += string(name: 'CODE_REPO', value: env.CODE_REPO)
Paul Sokolovskydaa430a2022-01-06 09:59:16 +0300133 params += string(name: 'CI_SCRIPTS_REPO', value: env.CI_SCRIPTS_REPO)
Colin Thorbinson58703db2020-11-24 12:02:19 +0000134 params += string(name: 'CI_SCRIPTS_BRANCH', value: env.CI_SCRIPTS_BRANCH)
Leonardo Sandoval7090b2c2021-09-17 13:20:44 -0500135 params += string(name: 'SHARE_FOLDER', value: env.SHARE_FOLDER)
Matthew Hart06340d72020-06-15 16:08:20 +0100136 return { -> results
Dean Birch62c4f082020-01-17 16:13:26 +0000137 def res = build(job: 'tf-m-build-docs', parameters: params, propagate:false)
138 print("${res.number}: Docs ${res.result} ${res.getAbsoluteUrl()}")
Matthew Hart06340d72020-06-15 16:08:20 +0100139 results['docs'] = [res.number, res.result, params]
Dean Bircha6ede7e2020-03-13 14:00:33 +0000140 if (res.result in ["FAILURE", "ABORTED", "UNSTABLE", "NOT_BUILT"]) {
Dean Birch62c4f082020-01-17 16:13:26 +0000141 error("Build failed at ${res.getAbsoluteUrl()}")
142 }
143 }
144}
145
Xinyu Zhang0f78e7a2022-10-17 13:55:52 +0800146def generateEmailBody(stage, results) {
147 // Results format: [CONFIG_NAME: [URL: "", RESULT: "", ...]]
Xinyu Zhang38a18872020-11-23 16:45:28 +0800148 body = "Check console output at ${env.BUILD_URL} \n\n"
149
150 body += "Failed Jobs:\n"
Xinyu Zhang0f78e7a2022-10-17 13:55:52 +0800151 results.each { job ->
152 if (job.value['RESULT'] == 'FAILURE') {
153 body += "${job.key} ${job.value['URL']}\n"
154 }
Xinyu Zhang38a18872020-11-23 16:45:28 +0800155 }
156
157 body += "\nFor detailed ${stage} results please refer to \
158 ${env.BUILD_URL}artifact/${stage}_results.csv \n"
159 return body
160}
161
Xinyu Zhang0f78e7a2022-10-17 13:55:52 +0800162def emailNotification(success, stage, results) {
Karl Zhang0413e972020-09-18 17:59:26 +0800163 script {
Xinyu Zhang953dc232022-09-07 18:27:35 +0800164 if (env.EMAIL_NOTIFICATION) {
Xinyu Zhang0f78e7a2022-10-17 13:55:52 +0800165 if (success == true) {
166 print("Skip sending as Success for ${stage}")
Karl Zhang182ecdf2020-10-10 09:52:12 +0800167 }
168 else {
169 emailext (
Xinyu Zhang0f78e7a2022-10-17 13:55:52 +0800170 subject: ("Job ${env.JOB_NAME} ${stage} ${env.BUILD_NUMBER} fail"),
171 body: generateEmailBody(stage, results),
Karl Zhang182ecdf2020-10-10 09:52:12 +0800172 to: "${EMAIL_NOTIFICATION}"
173 )
174 }
Karl Zhang0413e972020-09-18 17:59:26 +0800175 }
176 } /* script */
177}
178
Xinyu Zhang82dab282022-10-09 16:33:19 +0800179def parseTestResults(output) {
Xinyu Zhang82dab282022-10-09 16:33:19 +0800180 def test_results = [:]
181 records = output.split('\nLAVA Test Config:\n')
182 if (records.size() < 2) {
183 return test_results
184 }
185 records[1..-1].each { record ->
186 config_name = ""
187 metadata = [:]
188 record.split('\n').each { line ->
189 record_metadata = line.split(': ')
190 if (record_metadata[0] == 'Config Name') {
191 config_name = record_metadata[1]
192 } else {
193 metadata[record_metadata[0]] = record_metadata[1]
194 }
195 }
Xinyu Zhang0f78e7a2022-10-17 13:55:52 +0800196 test_results[config_name] = ['URL': metadata['LAVA link'],
197 'RESULT': metadata['Test Result']]
Xinyu Zhang82dab282022-10-09 16:33:19 +0800198 }
Xinyu Zhang0f78e7a2022-10-17 13:55:52 +0800199
200 writeCsv(test_results, "test_results.csv")
201
Xinyu Zhang82dab282022-10-09 16:33:19 +0800202 return test_results
203}
204
Xinyu Zhang57d2d8c2022-10-24 14:27:30 +0800205def verifyTestStatus(output) {
206 g = new Gerrit()
207 if (output.contains('FAILURE')) {
208 score = -1
209 } else {
210 score = 1
211 }
212 g.verifyStatus(score, "lava_test", "test")
213 if (score < 0) {
214 error("Marking job as failed due to failed tests.")
215 }
216}
217
xinyu-tfmb4fc0412020-08-19 10:49:51 +0800218def generateCsvContent(results) {
Xinyu Zhang0f78e7a2022-10-17 13:55:52 +0800219 // Results format: [CONFIG_NAME: [URL: "", RESULT: "", ...]]
220 // CSV format: CONFIG_NAME, RESULT
221 csv_header = obtainBuildParams(results.keySet()[0]).keySet().toList()
222 csv_header.add('RESULT')
223 csv_content = [csv_header]
xinyu-tfmb4fc0412020-08-19 10:49:51 +0800224 results.each { result ->
Xinyu Zhang0f78e7a2022-10-17 13:55:52 +0800225 build_params = []
226 obtainBuildParams(result.key).each { config ->
227 build_params.add(config.value)
Xinyu Zhang4f2ef5a2020-11-09 18:11:43 +0800228 }
Xinyu Zhang0f78e7a2022-10-17 13:55:52 +0800229 build_params.add(result.value['RESULT'])
230 csv_content.add(build_params)
xinyu-tfmb4fc0412020-08-19 10:49:51 +0800231 }
Xinyu Zhang0f78e7a2022-10-17 13:55:52 +0800232 return csv_content
xinyu-tfmb4fc0412020-08-19 10:49:51 +0800233}
234
Xinyu Zhang0f78e7a2022-10-17 13:55:52 +0800235def generateHtmlContent(results) {
236 // Results format: [CONFIG_NAME: [URL: "", RESULT: "", ...]]
237 // HTML format: CONFIG_NAME: Job/Logs/Artifacts RESULT
238 htmlContent = []
239 results.each { result ->
240 htmlContent.add("${result.key}: <a href=\"${result.value['URL']}\">Job</a>/<a href=\"${result.value['URL']}/consoleText\">Logs</a>/<a href=\"${result.value['URL']}/artifact/\">Artifacts</a> ${result.value['RESULT']}<br/>")
241 }
242 htmlContent.sort()
243 return htmlContent.join("\n")
244}
245
246def writeCsv(results, file_name) {
xinyu-tfmb4fc0412020-08-19 10:49:51 +0800247 def csvContent = generateCsvContent(results)
Xinyu Zhang0f78e7a2022-10-17 13:55:52 +0800248 writeCSV file: file_name, records: csvContent, format: CSVFormat.EXCEL
249 sh(script: """./tf-m-ci-scripts/report_parser/report_csv_helper.py \
250 --input-file ${file_name} --output-file ${file_name} \
251 """, returnStdout: true)
252 archiveArtifacts file_name
xinyu-tfmb4fc0412020-08-19 10:49:51 +0800253}
Dean Bircha6ede7e2020-03-13 14:00:33 +0000254
Xinyu Zhang0f78e7a2022-10-17 13:55:52 +0800255def writeHTML(results, file_name) {
256def buildLinks = generateHtmlContent(results)
257 writeFile file: file_name, text: buildLinks
258 archiveArtifacts file_name
Dean Bircha6ede7e2020-03-13 14:00:33 +0000259}
260
Matthew Hartfb6fd362020-03-04 21:03:59 +0000261def lineInString(string, match) {
262 def lines = string.split("\n")
263 def result = lines.findAll { it.contains(match) }
264 return result[0]
265}
266
267def getResult(string, match) {
268 line = lineInString(string, match)
Dean Birch1d545c02020-05-29 14:09:21 +0100269 a = line.split(match)[1].split(' ')
270 score = a[0]
271 if (a.size() > 1)
272 {
273 fail_text = a[1..-1].join(" ")
274 return [score, fail_text]
275 }
276 return [score, ""]
Matthew Hartfb6fd362020-03-04 21:03:59 +0000277}
278
279def submitJobsToList(results) {
280 def all_jobs = []
281 for (String result : results){
282 jobs_s = result.split('JOBS: ')
283 if (jobs_s.size() > 1) {
284 all_jobs += jobs_s[1]
285 }
286 }
287 return(all_jobs)
288}
289
Dean Birch62c4f082020-01-17 16:13:26 +0000290def configs = []
291def builds = [:]
Matthew Hartfb6fd362020-03-04 21:03:59 +0000292def results = [:]
Dean Birch62c4f082020-01-17 16:13:26 +0000293
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +0800294timestamps {
295 node("docker-amd64-tf-m-bionic") {
296 stage("Init") {
297 cleanWs()
298 dir("tf-m-ci-scripts") {
299 checkout([$class: 'GitSCM', branches: [[name: '$CI_SCRIPTS_BRANCH']], userRemoteConfigs: [[credentialsId: 'GIT_SSH_KEY', url: '$CI_SCRIPTS_REPO']]])
Xinyu Zhang8472b852021-09-04 00:13:34 +0800300 sh "git rev-parse --short HEAD"
Leonardo Sandoval7090b2c2021-09-17 13:20:44 -0500301 // Clone TF-M repositories so share folder can be reused by downstream jobs
302 sh "./clone.sh"
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +0800303 }
304 }
Xinyu Zhang6b456c22022-10-13 15:48:58 +0800305
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +0800306 stage("Configs") {
Xinyu Zhang4b109802022-10-18 17:22:07 +0800307 dir(".") {
308 // Populate configs
309 listConfigs(configs, env.FILTER_GROUP)
310 results['builds'] = [:]
311 results['lava_jobs'] = []
312 for (config in configs) {
313 builds[config] = buildConfig(config, results)
314 }
315 if (!env.JOB_NAME.equals("tf-m-extra-build")) {
316 builds["docs"] = buildDocs(results)
317 }
Xinyu Zhang351f14c2021-11-15 14:30:09 +0800318 }
Dean Birch62c4f082020-01-17 16:13:26 +0000319 }
Karl Zhangfec84102020-06-24 09:56:36 +0800320
Xinyu Zhang6b456c22022-10-13 15:48:58 +0800321 stage("Builds") {
322 def verify = 1
323 def success = true
Xinyu Zhang4b109802022-10-18 17:22:07 +0800324 dir(".") {
325 try {
326 parallel(builds)
327 } catch (Exception e) {
328 print(e)
329 manager.buildFailure()
330 verify = -1
331 success = false
332 } finally {
333 print("Verifying status")
334 g = new Gerrit()
335 g.verifyStatus(verify, 'tf-m-build', 'build')
336 print("Generating build results summary.")
337 def build_results_for_summary = [:]
338 results['builds'].each { build ->
Xinyu Zhang0d85cc32022-10-19 17:58:32 +0800339 build_results_for_summary[build.key] = ['URL': build.value.getAbsoluteUrl(),
340 'RESULT': build.value.result]
Xinyu Zhang4b109802022-10-18 17:22:07 +0800341 }
342 emailNotification(success, 'build', build_results_for_summary)
343 writeCsv(build_results_for_summary, "build_results.csv")
344 writeHTML(build_results_for_summary, "build_links.html")
Xinyu Zhang0f78e7a2022-10-17 13:55:52 +0800345 }
Xinyu Zhang6b456c22022-10-13 15:48:58 +0800346 }
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +0800347 }
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +0800348
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +0800349 stage("Tests") {
350 dir("tf-m-ci-scripts") {
351 checkout([$class: 'GitSCM', branches: [[name: '$CI_SCRIPTS_BRANCH']], userRemoteConfigs: [[credentialsId: 'GIT_SSH_KEY', url: '$CI_SCRIPTS_REPO']]])
352 }
353 def all_jobs = []
354 def success = true
Xinyu Zhang0f78e7a2022-10-17 13:55:52 +0800355 def test_results = [:]
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +0800356 print("Wait for LAVA results here...")
357 try {
358 all_jobs = submitJobsToList(results['lava_jobs'])
Paul Sokolovsky437bc422022-02-01 17:57:13 +0300359 output = ""
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +0800360 if (all_jobs.size() > 0) {
Paul Sokolovsky3d522f72022-04-13 11:17:00 +0300361 dir(".") {
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +0800362 withCredentials([usernamePassword(credentialsId: env.LAVA_CREDENTIALS, passwordVariable: 'LAVA_TOKEN', usernameVariable: 'LAVA_USER')]) {
Paul Sokolovsky3d522f72022-04-13 11:17:00 +0300363 output = sh(script: """./tf-m-ci-scripts/lava_helper/lava_wait_jobs.py --job-ids ${all_jobs.join(",")} \
Xinyu Zhang6b456c22022-10-13 15:48:58 +0800364 --lava-url ${env.LAVA_URL} --lava-user ${LAVA_USER} --lava-token ${LAVA_TOKEN} \
365 --artifacts-path cfgs --lava-timeout 12000 \
366 """, returnStdout: true).trim()
Paul Sokolovsky1b024ac2022-02-01 22:26:23 +0300367 println("--- output from lava_wait_jobs.py ---")
Xinyu Zhange9033f62022-10-08 11:15:27 +0800368 println(output)
Paul Sokolovsky1b024ac2022-02-01 22:26:23 +0300369 println("--- end of output from lava_wait_jobs.py ---")
Xinyu Zhang0f78e7a2022-10-17 13:55:52 +0800370 test_results = parseTestResults(output)
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +0800371 archiveArtifacts artifacts: 'test_summary.*', allowEmptyArchive: true
Xinyu Zhang57d2d8c2022-10-24 14:27:30 +0800372 verifyTestStatus(output)
Paul Sokolovsky0136de02022-04-19 20:21:47 +0300373 if (env.CODE_COVERAGE_EN == "TRUE") {
374 println("Producing merged report")
375 sh(script: """./tf-m-ci-scripts/lava_helper/codecov_merge.sh""")
376 archiveArtifacts artifacts: 'merged_report/**', allowEmptyArchive: true
377 }
Matthew Hartfb6fd362020-03-04 21:03:59 +0000378 }
379 }
380 }
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +0800381 else {
382 print("There were no LAVA jobs to test.")
383 }
Matthew Hartfb6fd362020-03-04 21:03:59 +0000384 }
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +0800385 catch (Exception e) {
386 print("ERROR: ${e}")
387 success = false
388 } finally {
Paul Sokolovsky3d522f72022-04-13 11:17:00 +0300389 archiveArtifacts artifacts: 'cfgs/**', allowEmptyArchive: true
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +0800390 if (all_jobs.size() > 0) {
Xinyu Zhang0f78e7a2022-10-17 13:55:52 +0800391 emailNotification(success, 'test', test_results)
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +0800392 }
393 cleanWs()
394 if (!success) {
395 error("There was an Error waiting for LAVA jobs")
396 }
Matthew Hartfb6fd362020-03-04 21:03:59 +0000397 }
Dean Bircha6ede7e2020-03-13 14:00:33 +0000398 }
399 }
Dean Bircha6ede7e2020-03-13 14:00:33 +0000400}