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 | |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 23 | node(nodeLabel) { |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 24 | stage("Init") { |
| 25 | cleanWs() |
| 26 | dir("trusted-firmware-m") { |
| 27 | checkout( |
| 28 | poll: false, |
| 29 | scm: [ |
| 30 | $class: 'GitSCM', |
| 31 | branches: [[name: '$GERRIT_BRANCH']], |
| 32 | extensions: [[$class: 'BuildChooserSetting', buildChooser: [$class: 'GerritTriggerBuildChooser']]], |
| 33 | userRemoteConfigs: [[ |
| 34 | credentialsId: 'GIT_SSH_KEY', |
| 35 | refspec: '$GERRIT_REFSPEC', url: '$CODE_REPO' |
| 36 | ]] |
| 37 | ]) |
| 38 | } |
| 39 | dir("tf-m-ci-scripts") { |
Colin Thorbinson | 58703db | 2020-11-24 12:02:19 +0000 | [diff] [blame] | 40 | checkout([$class: 'GitSCM', branches: [[name: '$CI_SCRIPTS_BRANCH']], userRemoteConfigs: [[credentialsId: 'GIT_SSH_KEY', url: '$CI_SCRIPTS_REPO']]]) |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 41 | } |
Karl Zhang | 02d3035 | 2020-08-20 13:48:52 +0800 | [diff] [blame] | 42 | dir("mbedtls") { |
| 43 | checkout( |
| 44 | changelog: false, |
| 45 | poll: false, |
| 46 | scm: [ |
| 47 | $class: 'GitSCM', |
| 48 | branches: [[name: 'FETCH_HEAD']], |
| 49 | userRemoteConfigs: [[ |
| 50 | refspec: 'refs/tags/$MBEDTLS_VERSION', |
| 51 | url: params.MBEDTLS_URL |
| 52 | ]] |
| 53 | ] |
| 54 | ) |
| 55 | } |
Tamas Ban | 260faf4 | 2020-06-08 16:14:55 +0100 | [diff] [blame] | 56 | dir("mcuboot") { |
| 57 | checkout( |
| 58 | changelog: false, |
| 59 | poll: false, |
| 60 | scm: [ |
| 61 | $class: 'GitSCM', |
| 62 | branches: [[name: 'FETCH_HEAD']], |
| 63 | userRemoteConfigs: [[ |
Tamas Ban | 1f1213e | 2020-09-25 12:38:31 +0100 | [diff] [blame] | 64 | refspec: '$MCUBOOT_REFSPEC', |
Tamas Ban | 260faf4 | 2020-06-08 16:14:55 +0100 | [diff] [blame] | 65 | url: params.MCUBOOT_URL |
| 66 | ]] |
| 67 | ] |
| 68 | ) |
| 69 | } |
Kevin Peng | b0bc0d1 | 2020-06-17 14:17:03 +0800 | [diff] [blame] | 70 | dir("tf-m-tests") { |
| 71 | checkout( |
| 72 | changelog: false, |
| 73 | poll: false, |
| 74 | scm: [ |
| 75 | $class: 'GitSCM', |
| 76 | branches: [[name: 'FETCH_HEAD']], |
| 77 | userRemoteConfigs: [[ |
| 78 | refspec: '$TFM_TESTS_REFSPEC', |
| 79 | url: params.TFM_TESTS_URL |
| 80 | ]] |
| 81 | ] |
| 82 | ) |
| 83 | } |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 84 | if (env.PSA_API_SUITE != "") { |
| 85 | dir("psa-arch-tests") { |
| 86 | checkout( |
| 87 | changelog: false, |
| 88 | poll: false, |
| 89 | scm: [ |
| 90 | $class: 'GitSCM', |
| 91 | branches: [[name: 'FETCH_HEAD']], |
| 92 | userRemoteConfigs: [[ |
Karl Zhang | a6820f2 | 2020-06-17 11:34:06 +0800 | [diff] [blame] | 93 | refspec: '$PSA_ARCH_TESTS_VERSION', |
Matthew Hart | fb6fd36 | 2020-03-04 21:03:59 +0000 | [diff] [blame] | 94 | url: params.PSA_ARCH_TESTS_URL |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 95 | ]] |
| 96 | ] |
| 97 | ) |
| 98 | } |
| 99 | } |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 100 | } |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 101 | try { |
| 102 | verify = 1 |
| 103 | stage("Build") { |
Riku Voipio | d78059f | 2020-09-10 13:35:13 +0300 | [diff] [blame] | 104 | sh "tf-m-ci-scripts/run-build.sh" |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 105 | } |
| 106 | stage("Post") { |
Xinyu Zhang | 694eb49 | 2020-11-04 18:29:08 +0800 | [diff] [blame] | 107 | archiveArtifacts 'trusted-firmware-m/build/bin/**' |
Xinyu Zhang | 840a528 | 2020-12-30 15:28:56 +0800 | [diff] [blame] | 108 | archiveArtifacts 'trusted-firmware-m/build/install/interface/**' |
Xinyu Zhang | ab21b8d | 2021-04-30 14:15:09 +0800 | [diff] [blame^] | 109 | def upstreamProject = getUpstreamJob()[0].upstreamProject |
| 110 | if (upstreamProject == "tf-m-build-and-test") { |
| 111 | archiveArtifacts 'trusted-firmware-m/build/generated/**' |
| 112 | } |
Hugo L'Hostis | e55a275 | 2021-01-27 11:09:08 +0000 | [diff] [blame] | 113 | if (env.SQUAD_CONFIGURATIONS != ""){ |
| 114 | //Creating a folder to store memory footprint artifacts and launching the memory footprint script. |
| 115 | sh "mkdir tf-m-ci-scripts/Memory_footprint/" |
| 116 | withCredentials([string(credentialsId: 'QA_REPORTS_TOKEN', variable: 'TOKEN')]) { |
| 117 | sh(script: "python3 tf-m-ci-scripts/memory_footprint.py ${env.WORKSPACE}/trusted-firmware-m/ ${env.CONFIG_NAME} \'${env.SQUAD_CONFIGURATIONS}\' ${TOKEN}", returnStdout: true) |
| 118 | } |
| 119 | if (fileExists('tf-m-ci-scripts/Memory_footprint/filesize.json')) { |
| 120 | archiveArtifacts 'tf-m-ci-scripts/Memory_footprint/filesize.json' |
| 121 | } |
| 122 | } |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 123 | } |
| 124 | } catch (Exception e) { |
| 125 | manager.buildFailure() |
| 126 | verify = -1 |
| 127 | } finally { |
| 128 | g = new Gerrit() |
| 129 | g.verifyStatusInWorkspace(verify, env.CONFIG_NAME, 'build') |
Matthew Hart | fb6fd36 | 2020-03-04 21:03:59 +0000 | [diff] [blame] | 130 | def buildStatus = (verify == 1) ? 'Successful' : 'Failed' |
| 131 | //g.commentInWorkspace("Build configuration ${env.CONFIG_NAME} ${buildStatus}: ${env.RUN_DISPLAY_URL}") |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 132 | cleanWs() |
| 133 | } |
| 134 | } |