blob: dd6adb27bfd5b6dc077079e8082f57ecb12c7762 [file] [log] [blame]
Dean Birch62c4f082020-01-17 16:13:26 +00001#!/usr/bin/env groovy
2//-------------------------------------------------------------------------------
Xinyu Zhangbbe2d762022-01-19 10:36:11 +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
11
Benjamin Copelandbe53b032020-10-30 19:57:59 +000012def nodeLabel = "docker-amd64-tf-m-bionic"
Dean Birchd0f9f8c2020-03-26 11:10:33 +000013
Xinyu Zhangab21b8d2021-04-30 14:15:09 +080014@NonCPS
15def getUpstreamJob() {
16 def cause = manager.build.getAction(hudson.model.CauseAction.class).getCauses()
17 return cause
18}
19
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +080020timestamps {
21 node(nodeLabel) {
22 stage("Init") {
23 cleanWs()
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +080024 dir("tf-m-ci-scripts") {
25 checkout([$class: 'GitSCM', branches: [[name: '$CI_SCRIPTS_BRANCH']], userRemoteConfigs: [[credentialsId: 'GIT_SSH_KEY', url: '$CI_SCRIPTS_REPO']]])
Xinyu Zhang8472b852021-09-04 00:13:34 +080026 sh "git rev-parse --short HEAD"
Leonardo Sandoval7090b2c2021-09-17 13:20:44 -050027 // Clone TF-M repositories so share folder can be reused by downstream jobs
28 sh "./clone.sh"
Hugo L'Hostise55a2752021-01-27 11:09:08 +000029 }
Dean Birchd0f9f8c2020-03-26 11:10:33 +000030 }
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +080031 try {
32 verify = 1
33 stage("Build") {
34 sh "tf-m-ci-scripts/run-build.sh"
35 }
36 stage("Post") {
Xinyu Zhangdc3b4ca2023-08-15 17:43:51 +080037 // TODO: Only archive build binary for successful build job
38 archiveArtifacts 'ci_build/**'
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +080039 def upstreamProject = getUpstreamJob()[0].upstreamProject
Xinyu Zhang470b3c42022-09-19 14:41:45 +080040 if (env.SQUAD_CONFIGURATIONS == "enabled"){
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +080041 //Creating a folder to store memory footprint artifacts and launching the memory footprint script.
Xinyu Zhang9a29f032022-01-19 15:13:24 +080042 sh "mkdir tf-m-ci-scripts/Memory_footprint/"
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +080043 withCredentials([string(credentialsId: 'QA_REPORTS_TOKEN', variable: 'TOKEN')]) {
Xinyu Zhang470b3c42022-09-19 14:41:45 +080044 output = sh(script: """python3 tf-m-ci-scripts/memory_footprint.py ${TOKEN}""", returnStdout: true).trim()
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +080045 }
46 if (fileExists('tf-m-ci-scripts/Memory_footprint/filesize.json')) {
Xinyu Zhang470b3c42022-09-19 14:41:45 +080047 println("--- output from memory_footprint.py ---")
48 println(output)
49 println("--- end of output from lava_wait_jobs.py ---")
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +080050 archiveArtifacts 'tf-m-ci-scripts/Memory_footprint/filesize.json'
51 }
52 }
53 }
54 } catch (Exception e) {
Xinyu Zhangdc3b4ca2023-08-15 17:43:51 +080055 archiveArtifacts artifacts: 'ci_build/**', allowEmptyArchive: true
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +080056 manager.buildFailure()
57 verify = -1
58 } finally {
59 g = new Gerrit()
60 g.verifyStatusInWorkspace(verify, env.CONFIG_NAME, 'build')
61 def buildStatus = (verify == 1) ? 'Successful' : 'Failed'
62 //g.commentInWorkspace("Build configuration ${env.CONFIG_NAME} ${buildStatus}: ${env.RUN_DISPLAY_URL}")
63 cleanWs()
64 }
Dean Birch62c4f082020-01-17 16:13:26 +000065 }
66}