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
Anton Komlevf84a5bb2025-07-09 10:12:12 +00006//
Dean Birch62c4f082020-01-17 16:13:26 +00007//-------------------------------------------------------------------------------
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
Anton Komlevf84a5bb2025-07-09 10:12:12 +000015def getUpstreamJob() {
16 def cause = manager.build.getAction(hudson.model.CauseAction.class).getCauses()
17 return cause
Xinyu Zhangab21b8d2021-04-30 14:15:09 +080018}
19
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +080020timestamps {
Anton Komlevf84a5bb2025-07-09 10:12:12 +000021 node(nodeLabel) {
22 stage("Init") {
23 cleanWs()
24 dir("tf-m-ci-scripts") {
25 tfgit.checkout_ci_scripts()
26 sh "git rev-parse --short HEAD"
27 // Clone TF-M repositories so share folder can be reused by downstream jobs
28 sh "./clone.sh"
29 }
Xinyu Zhang4cdfd1b2021-05-21 15:10:49 +080030 }
Anton Komlevf84a5bb2025-07-09 10:12:12 +000031 try {
32 verify = 1
33 stage("Build") {
34 // Activate UBL license for ArmClang.
35 if (env.CONFIG_NAME.contains("ARMCLANG")) {
36 withCredentials([string(credentialsId: 'ARMCLANG_UBL_CODE', variable: 'ARMCLANG_UBL_CODE')]) {
37 sh "tf-m-ci-scripts/jenkins/armclang-ubl.sh"
38 }
39 }
40
41 sh "tf-m-ci-scripts/run-build.sh"
42 }
43 stage("Post") {
44 // Temporary, for debugging https://linaro.atlassian.net/browse/TFC-615
45 archiveArtifacts artifacts: 'ci_build/**', allowEmptyArchive: true
46
47 archiveArtifacts 'ci_build/spe/bin/**'
48 archiveArtifacts 'ci_build/spe/api_ns/bin/**'
49 archiveArtifacts 'ci_build/spe/api_ns/interface/**'
50 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 }
60 def upstreamProject = getUpstreamJob()[0].upstreamProject
61 if (upstreamProject == "tf-m-build-and-test") {
62 archiveArtifacts 'ci_build/spe/build-spe/generated/**'
63 }
64 if (upstreamProject == "tf-m-nightly-performance"){
65 //Creating a folder to store memory footprint artifacts and launching the memory footprint script.
66 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)
69 }
70 }
71 } catch (Exception e) {
72 println("Archiving all build files due to build error (to allow investigate it)")
73 archiveArtifacts artifacts: 'ci_build/**', allowEmptyArchive: true
74 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 }
83 }
Dean Birch62c4f082020-01-17 16:13:26 +000084}