Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 1 | #!/usr/bin/env groovy |
| 2 | //------------------------------------------------------------------------------- |
| 3 | // Copyright (c) 2020, Arm Limited and Contributors. All rights reserved. |
| 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 | |
| 12 | def nodeLabel = "docker-amd64-xenial" |
| 13 | if (env.COMPILER == "ARMCLANG") { |
| 14 | nodeLabel = "docker-amd64-xenial-armclang" |
| 15 | } |
| 16 | |
| 17 | node(nodeLabel) { |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 18 | stage("Init") { |
| 19 | cleanWs() |
| 20 | dir("trusted-firmware-m") { |
| 21 | checkout( |
| 22 | poll: false, |
| 23 | scm: [ |
| 24 | $class: 'GitSCM', |
| 25 | branches: [[name: '$GERRIT_BRANCH']], |
| 26 | extensions: [[$class: 'BuildChooserSetting', buildChooser: [$class: 'GerritTriggerBuildChooser']]], |
| 27 | userRemoteConfigs: [[ |
| 28 | credentialsId: 'GIT_SSH_KEY', |
| 29 | refspec: '$GERRIT_REFSPEC', url: '$CODE_REPO' |
| 30 | ]] |
| 31 | ]) |
| 32 | } |
| 33 | dir("tf-m-ci-scripts") { |
Matthew Hart | fb6fd36 | 2020-03-04 21:03:59 +0000 | [diff] [blame] | 34 | git url: '$CI_SCRIPTS_REPO', branch: '$CI_SCRIPTS_BRANCH', credentialsId: 'GIT_SSH_KEY' |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 35 | } |
| 36 | dir("mbed-crypto") { |
| 37 | checkout( |
| 38 | changelog: false, |
| 39 | poll: false, |
| 40 | scm: [ |
| 41 | $class: 'GitSCM', |
Matthew Hart | fb6fd36 | 2020-03-04 21:03:59 +0000 | [diff] [blame] | 42 | branches: [[name: 'FETCH_HEAD']], |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 43 | userRemoteConfigs: [[ |
| 44 | refspec: 'refs/tags/$MBEDCRYPTO_VERSION', |
Dean Birch | a6ede7e | 2020-03-13 14:00:33 +0000 | [diff] [blame] | 45 | url: params.MBEDCRYPTO_URL |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 46 | ]] |
| 47 | ] |
| 48 | ) |
| 49 | } |
Tamas Ban | 260faf4 | 2020-06-08 16:14:55 +0100 | [diff] [blame] | 50 | dir("mcuboot") { |
| 51 | checkout( |
| 52 | changelog: false, |
| 53 | poll: false, |
| 54 | scm: [ |
| 55 | $class: 'GitSCM', |
| 56 | branches: [[name: 'FETCH_HEAD']], |
| 57 | userRemoteConfigs: [[ |
| 58 | refspec: 'refs/tags/$MCUBOOT_VERSION', |
| 59 | url: params.MCUBOOT_URL |
| 60 | ]] |
| 61 | ] |
| 62 | ) |
| 63 | } |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 64 | sh """ |
Dean Birch | 7249bfa | 2020-05-21 16:22:39 +0100 | [diff] [blame] | 65 | # Host https://github.com/Arm-software/CMSIS_5/releases/download/5.5.0/ARM.CMSIS.5.5.0.pack |
| 66 | # under \$JENKINS_HOME/userContent |
| 67 | set +e |
| 68 | wget -O cmsis.pack -q \${JENKINS_URL}/userContent/ARM.CMSIS.${CMSIS_VERSION}.pack |
| 69 | if [ "\$?" != "0" ] ; then |
| 70 | set -e |
| 71 | wget -O cmsis.pack -q https://github.com/Arm-software/CMSIS_5/releases/download/${CMSIS_VERSION}/ARM.CMSIS.${CMSIS_VERSION}.pack |
| 72 | fi |
| 73 | set -e |
| 74 | unzip -o -d CMSIS_5 cmsis.pack |
| 75 | """ |
Kevin Peng | b0bc0d1 | 2020-06-17 14:17:03 +0800 | [diff] [blame^] | 76 | dir("tf-m-tests") { |
| 77 | checkout( |
| 78 | changelog: false, |
| 79 | poll: false, |
| 80 | scm: [ |
| 81 | $class: 'GitSCM', |
| 82 | branches: [[name: 'FETCH_HEAD']], |
| 83 | userRemoteConfigs: [[ |
| 84 | refspec: '$TFM_TESTS_REFSPEC', |
| 85 | url: params.TFM_TESTS_URL |
| 86 | ]] |
| 87 | ] |
| 88 | ) |
| 89 | } |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 90 | if (env.PSA_API_SUITE != "") { |
| 91 | dir("psa-arch-tests") { |
| 92 | checkout( |
| 93 | changelog: false, |
| 94 | poll: false, |
| 95 | scm: [ |
| 96 | $class: 'GitSCM', |
| 97 | branches: [[name: 'FETCH_HEAD']], |
| 98 | userRemoteConfigs: [[ |
Karl Zhang | a6820f2 | 2020-06-17 11:34:06 +0800 | [diff] [blame] | 99 | refspec: '$PSA_ARCH_TESTS_VERSION', |
Matthew Hart | fb6fd36 | 2020-03-04 21:03:59 +0000 | [diff] [blame] | 100 | url: params.PSA_ARCH_TESTS_URL |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 101 | ]] |
| 102 | ] |
| 103 | ) |
| 104 | } |
| 105 | } |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 106 | } |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 107 | try { |
| 108 | verify = 1 |
| 109 | stage("Build") { |
| 110 | tee("build.log") { |
| 111 | sh "tf-m-ci-scripts/run-build.sh" |
| 112 | } |
| 113 | } |
| 114 | stage("Post") { |
| 115 | archiveArtifacts 'trusted-firmware-m/build/install/**,build.log' |
| 116 | } |
| 117 | } catch (Exception e) { |
| 118 | manager.buildFailure() |
| 119 | verify = -1 |
| 120 | } finally { |
| 121 | g = new Gerrit() |
| 122 | g.verifyStatusInWorkspace(verify, env.CONFIG_NAME, 'build') |
Matthew Hart | fb6fd36 | 2020-03-04 21:03:59 +0000 | [diff] [blame] | 123 | def buildStatus = (verify == 1) ? 'Successful' : 'Failed' |
| 124 | //g.commentInWorkspace("Build configuration ${env.CONFIG_NAME} ${buildStatus}: ${env.RUN_DISPLAY_URL}") |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 125 | cleanWs() |
| 126 | } |
| 127 | } |