Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 1 | #!/usr/bin/env groovy |
| 2 | //------------------------------------------------------------------------------- |
Hugo L'Hostis | e55a275 | 2021-01-27 11:09:08 +0000 | [diff] [blame] | 3 | // Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved. |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 4 | // |
| 5 | // SPDX-License-Identifier: BSD-3-Clause |
| 6 | // |
| 7 | //------------------------------------------------------------------------------- |
| 8 | |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 9 | @Library('trustedfirmware') _ |
| 10 | import org.trustedfirmware.Gerrit |
| 11 | |
Benjamin Copeland | be53b03 | 2020-10-30 19:57:59 +0000 | [diff] [blame] | 12 | def nodeLabel = "docker-amd64-tf-m-bionic" |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 13 | if (env.COMPILER == "ARMCLANG") { |
Benjamin Copeland | be53b03 | 2020-10-30 19:57:59 +0000 | [diff] [blame] | 14 | nodeLabel = "docker-amd64-tf-m-bionic" |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 15 | } |
| 16 | |
Xinyu Zhang | ab21b8d | 2021-04-30 14:15:09 +0800 | [diff] [blame] | 17 | @NonCPS |
| 18 | def getUpstreamJob() { |
| 19 | def cause = manager.build.getAction(hudson.model.CauseAction.class).getCauses() |
| 20 | return cause |
| 21 | } |
| 22 | |
Xinyu Zhang | 4cdfd1b | 2021-05-21 15:10:49 +0800 | [diff] [blame] | 23 | timestamps { |
| 24 | node(nodeLabel) { |
| 25 | stage("Init") { |
| 26 | cleanWs() |
| 27 | dir("trusted-firmware-m") { |
| 28 | checkout( |
| 29 | poll: false, |
| 30 | scm: [ |
| 31 | $class: 'GitSCM', |
| 32 | branches: [[name: '$GERRIT_BRANCH']], |
| 33 | extensions: [[$class: 'BuildChooserSetting', buildChooser: [$class: 'GerritTriggerBuildChooser']]], |
| 34 | userRemoteConfigs: [[ |
| 35 | credentialsId: 'GIT_SSH_KEY', |
| 36 | refspec: '$GERRIT_REFSPEC', url: '$CODE_REPO' |
| 37 | ]] |
| 38 | ]) |
| 39 | } |
| 40 | dir("tf-m-ci-scripts") { |
| 41 | checkout([$class: 'GitSCM', branches: [[name: '$CI_SCRIPTS_BRANCH']], userRemoteConfigs: [[credentialsId: 'GIT_SSH_KEY', url: '$CI_SCRIPTS_REPO']]]) |
| 42 | } |
| 43 | dir("mbedtls") { |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 44 | checkout( |
| 45 | changelog: false, |
| 46 | poll: false, |
| 47 | scm: [ |
| 48 | $class: 'GitSCM', |
| 49 | branches: [[name: 'FETCH_HEAD']], |
| 50 | userRemoteConfigs: [[ |
Xinyu Zhang | 4cdfd1b | 2021-05-21 15:10:49 +0800 | [diff] [blame] | 51 | refspec: 'refs/tags/$MBEDTLS_VERSION', |
| 52 | url: params.MBEDTLS_URL |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 53 | ]] |
| 54 | ] |
| 55 | ) |
| 56 | } |
Xinyu Zhang | 4cdfd1b | 2021-05-21 15:10:49 +0800 | [diff] [blame] | 57 | dir("mcuboot") { |
| 58 | checkout( |
| 59 | changelog: false, |
| 60 | poll: false, |
| 61 | scm: [ |
| 62 | $class: 'GitSCM', |
| 63 | branches: [[name: 'FETCH_HEAD']], |
| 64 | userRemoteConfigs: [[ |
| 65 | refspec: '$MCUBOOT_REFSPEC', |
| 66 | url: params.MCUBOOT_URL |
| 67 | ]] |
| 68 | ] |
| 69 | ) |
Xinyu Zhang | ab21b8d | 2021-04-30 14:15:09 +0800 | [diff] [blame] | 70 | } |
Xinyu Zhang | 4cdfd1b | 2021-05-21 15:10:49 +0800 | [diff] [blame] | 71 | dir("tf-m-tests") { |
| 72 | checkout( |
| 73 | changelog: false, |
| 74 | poll: false, |
| 75 | scm: [ |
| 76 | $class: 'GitSCM', |
| 77 | branches: [[name: 'FETCH_HEAD']], |
| 78 | userRemoteConfigs: [[ |
| 79 | refspec: '$TFM_TESTS_REFSPEC', |
| 80 | url: params.TFM_TESTS_URL |
| 81 | ]] |
| 82 | ] |
| 83 | ) |
| 84 | } |
| 85 | if (env.PSA_API_SUITE != "") { |
| 86 | dir("psa-arch-tests") { |
| 87 | checkout( |
| 88 | changelog: false, |
| 89 | poll: false, |
| 90 | scm: [ |
| 91 | $class: 'GitSCM', |
| 92 | branches: [[name: 'FETCH_HEAD']], |
| 93 | userRemoteConfigs: [[ |
| 94 | refspec: '$PSA_ARCH_TESTS_VERSION', |
| 95 | url: params.PSA_ARCH_TESTS_URL |
| 96 | ]] |
| 97 | ] |
| 98 | ) |
Hugo L'Hostis | e55a275 | 2021-01-27 11:09:08 +0000 | [diff] [blame] | 99 | } |
| 100 | } |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 101 | } |
Xinyu Zhang | 4cdfd1b | 2021-05-21 15:10:49 +0800 | [diff] [blame] | 102 | try { |
| 103 | verify = 1 |
| 104 | stage("Build") { |
| 105 | sh "tf-m-ci-scripts/run-build.sh" |
| 106 | } |
| 107 | stage("Post") { |
| 108 | archiveArtifacts 'trusted-firmware-m/build/bin/**' |
| 109 | archiveArtifacts 'trusted-firmware-m/build/install/interface/**' |
| 110 | def upstreamProject = getUpstreamJob()[0].upstreamProject |
| 111 | if (upstreamProject == "tf-m-build-and-test") { |
| 112 | archiveArtifacts 'trusted-firmware-m/build/generated/**' |
| 113 | } |
| 114 | if (env.SQUAD_CONFIGURATIONS != ""){ |
| 115 | //Creating a folder to store memory footprint artifacts and launching the memory footprint script. |
| 116 | sh "mkdir tf-m-ci-scripts/Memory_footprint/" |
| 117 | withCredentials([string(credentialsId: 'QA_REPORTS_TOKEN', variable: 'TOKEN')]) { |
| 118 | sh(script: "python3 tf-m-ci-scripts/memory_footprint.py ${env.WORKSPACE}/trusted-firmware-m/ ${env.CONFIG_NAME} \'${env.SQUAD_CONFIGURATIONS}\' ${TOKEN}", returnStdout: true) |
| 119 | } |
| 120 | if (fileExists('tf-m-ci-scripts/Memory_footprint/filesize.json')) { |
| 121 | archiveArtifacts 'tf-m-ci-scripts/Memory_footprint/filesize.json' |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | } catch (Exception e) { |
| 126 | manager.buildFailure() |
| 127 | verify = -1 |
| 128 | } finally { |
| 129 | g = new Gerrit() |
| 130 | g.verifyStatusInWorkspace(verify, env.CONFIG_NAME, 'build') |
| 131 | def buildStatus = (verify == 1) ? 'Successful' : 'Failed' |
| 132 | //g.commentInWorkspace("Build configuration ${env.CONFIG_NAME} ${buildStatus}: ${env.RUN_DISPLAY_URL}") |
| 133 | cleanWs() |
| 134 | } |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 135 | } |
| 136 | } |