blob: 8af62276a6eb4f1a8e07ad00bfc09506bc535a4d [file] [log] [blame]
#!/usr/bin/env groovy
//-------------------------------------------------------------------------------
// Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
//
// SPDX-License-Identifier: BSD-3-Clause
//
//-------------------------------------------------------------------------------
@Library('trustedfirmware') _
import org.trustedfirmware.Gerrit
def nodeLabel = "docker-amd64-tf-m-bionic"
@NonCPS
def getUpstreamJob() {
def cause = manager.build.getAction(hudson.model.CauseAction.class).getCauses()
return cause
}
timestamps {
node(nodeLabel) {
stage("Init") {
cleanWs()
dir("tf-m-ci-scripts") {
checkout([$class: 'GitSCM', branches: [[name: '$CI_SCRIPTS_BRANCH']], userRemoteConfigs: [[credentialsId: 'GIT_SSH_KEY', url: '$CI_SCRIPTS_REPO']]])
sh "git rev-parse --short HEAD"
// Clone TF-M repositories so share folder can be reused by downstream jobs
sh "./clone.sh"
}
}
try {
verify = 1
stage("Build") {
sh "tf-m-ci-scripts/run-build.sh"
}
stage("Post") {
archiveArtifacts 'trusted-firmware-m/build/bin/**'
archiveArtifacts 'trusted-firmware-m/build/install/interface/**'
def upstreamProject = getUpstreamJob()[0].upstreamProject
if (upstreamProject == "tf-m-build-and-test") {
archiveArtifacts 'trusted-firmware-m/build/generated/**'
}
if (env.SQUAD_CONFIGURATIONS == "enabled"){
//Creating a folder to store memory footprint artifacts and launching the memory footprint script.
sh "mkdir tf-m-ci-scripts/Memory_footprint/"
withCredentials([string(credentialsId: 'QA_REPORTS_TOKEN', variable: 'TOKEN')]) {
output = sh(script: """python3 tf-m-ci-scripts/memory_footprint.py ${TOKEN}""", returnStdout: true).trim()
}
if (fileExists('tf-m-ci-scripts/Memory_footprint/filesize.json')) {
println("--- output from memory_footprint.py ---")
println(output)
println("--- end of output from lava_wait_jobs.py ---")
archiveArtifacts 'tf-m-ci-scripts/Memory_footprint/filesize.json'
}
}
}
} catch (Exception e) {
archiveArtifacts artifacts: 'trusted-firmware-m/build/**', allowEmptyArchive: true
manager.buildFailure()
verify = -1
} finally {
g = new Gerrit()
g.verifyStatusInWorkspace(verify, env.CONFIG_NAME, 'build')
def buildStatus = (verify == 1) ? 'Successful' : 'Failed'
//g.commentInWorkspace("Build configuration ${env.CONFIG_NAME} ${buildStatus}: ${env.RUN_DISPLAY_URL}")
cleanWs()
}
}
}