blob: 7450ff32463d7c27ff1720575a9cb574e482242f [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 Zhanga88a2eb2023-08-15 17:43:51 +080037 archiveArtifacts 'ci_build/spe/bin/**'
Xinyu Zhanga88a2eb2023-08-15 17:43:51 +080038 archiveArtifacts 'ci_build/spe/api_ns/bin/**'
39 archiveArtifacts 'ci_build/spe/api_ns/interface/**'
Xinyu Zhang8ea4cfc2023-10-30 18:28:43 +080040 try {
41 archiveArtifacts 'ci_build/nspe/bin/**'
42 } catch (Exception e) {
43 print("ci_build/nspe/bin not exists")
44 }
45 try {
46 archiveArtifacts 'ci_build/nspe/*.bin'
47 } catch (Exception e) {
48 print("ci_build/nspe/*.bin not exists")
49 }
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +080050 def upstreamProject = getUpstreamJob()[0].upstreamProject
51 if (upstreamProject == "tf-m-build-and-test") {
Xinyu Zhanga88a2eb2023-08-15 17:43:51 +080052 archiveArtifacts 'ci_build/spe/build-spe/generated/**'
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +080053 }
Jianliang Shen48704152023-10-17 17:06:00 +080054 if (upstreamProject == "tf-m-nightly-performance"){
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +080055 //Creating a folder to store memory footprint artifacts and launching the memory footprint script.
Jianliang Shen48704152023-10-17 17:06:00 +080056 sh "mkdir -p ${SHARE_FOLDER}/Memory_footprint/"
57 output = sh(script: """python3 tf-m-ci-scripts/performance.py --generate-memory""", returnStdout: true).trim()
58 println(output)
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +080059 }
60 }
61 } catch (Exception e) {
Xinyu Zhanga88a2eb2023-08-15 17:43:51 +080062 archiveArtifacts artifacts: 'ci_build/**', allowEmptyArchive: true
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +080063 manager.buildFailure()
64 verify = -1
65 } finally {
66 g = new Gerrit()
67 g.verifyStatusInWorkspace(verify, env.CONFIG_NAME, 'build')
68 def buildStatus = (verify == 1) ? 'Successful' : 'Failed'
69 //g.commentInWorkspace("Build configuration ${env.CONFIG_NAME} ${buildStatus}: ${env.RUN_DISPLAY_URL}")
70 cleanWs()
71 }
Dean Birch62c4f082020-01-17 16:13:26 +000072 }
73}