blob: 15eff68a32ba6248c83630ff6e18a9f7bb4809b1 [file] [log] [blame]
Dean Birch62c4f082020-01-17 16:13:26 +00001#!/usr/bin/env groovy
2//-------------------------------------------------------------------------------
Paul Sokolovsky2ae6c742024-03-09 15:16:19 +07003// Copyright (c) 2020-2024, 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
Paul Sokolovsky2ae6c742024-03-09 15:16:19 +070012def nodeLabel = "docker-amd64-tf-m-jammy"
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") {
Paul Sokolovsky9517ed42024-07-04 15:52:57 +030025 tfgit.checkout_ci_scripts()
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") {
Paul Sokolovskye0e6ffa2023-11-01 19:40:57 +030034 // Activate UBL license for ArmClang.
35 if (env.CONFIG_NAME.contains("ARMCLANG")) {
36 withCredentials([string(credentialsId: 'ARMCLANG_UBL_CODE', variable: 'ARMCLANG_UBL_CODE')]) {
Paul Sokolovsky2f5ab4e2023-12-01 12:11:39 +030037 sh "tf-m-ci-scripts/jenkins/armclang-ubl.sh"
Paul Sokolovskye0e6ffa2023-11-01 19:40:57 +030038 }
39 }
40
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +080041 sh "tf-m-ci-scripts/run-build.sh"
42 }
43 stage("Post") {
Paul Sokolovsky57f4e9d2024-04-27 14:50:51 +070044 // Temporary, for debugging https://linaro.atlassian.net/browse/TFC-615
45 archiveArtifacts artifacts: 'ci_build/**', allowEmptyArchive: true
46
Xinyu Zhanga88a2eb2023-08-15 17:43:51 +080047 archiveArtifacts 'ci_build/spe/bin/**'
Xinyu Zhanga88a2eb2023-08-15 17:43:51 +080048 archiveArtifacts 'ci_build/spe/api_ns/bin/**'
49 archiveArtifacts 'ci_build/spe/api_ns/interface/**'
Xinyu Zhang8ea4cfc2023-10-30 18:28:43 +080050 try {
51 archiveArtifacts 'ci_build/nspe/bin/**'
52 } catch (Exception e) {
53 print("ci_build/nspe/bin not exists")
54 }
55 try {
56 archiveArtifacts 'ci_build/nspe/*.bin'
57 } catch (Exception e) {
58 print("ci_build/nspe/*.bin not exists")
59 }
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +080060 def upstreamProject = getUpstreamJob()[0].upstreamProject
61 if (upstreamProject == "tf-m-build-and-test") {
Xinyu Zhanga88a2eb2023-08-15 17:43:51 +080062 archiveArtifacts 'ci_build/spe/build-spe/generated/**'
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +080063 }
Jianliang Shen48704152023-10-17 17:06:00 +080064 if (upstreamProject == "tf-m-nightly-performance"){
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +080065 //Creating a folder to store memory footprint artifacts and launching the memory footprint script.
Jianliang Shen48704152023-10-17 17:06:00 +080066 sh "mkdir -p ${SHARE_FOLDER}/Memory_footprint/"
67 output = sh(script: """python3 tf-m-ci-scripts/performance.py --generate-memory""", returnStdout: true).trim()
68 println(output)
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +080069 }
70 }
71 } catch (Exception e) {
Paul Sokolovsky0e799fe2024-04-27 14:50:16 +070072 println("Archiving all build files due to build error (to allow investigate it)")
Xinyu Zhanga88a2eb2023-08-15 17:43:51 +080073 archiveArtifacts artifacts: 'ci_build/**', allowEmptyArchive: true
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +080074 manager.buildFailure()
75 verify = -1
76 } finally {
77 g = new Gerrit()
78 g.verifyStatusInWorkspace(verify, env.CONFIG_NAME, 'build')
79 def buildStatus = (verify == 1) ? 'Successful' : 'Failed'
80 //g.commentInWorkspace("Build configuration ${env.CONFIG_NAME} ${buildStatus}: ${env.RUN_DISPLAY_URL}")
81 cleanWs()
82 }
Dean Birch62c4f082020-01-17 16:13:26 +000083 }
84}