| 1 | #!/bin/bash |
| 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"). |
| 5 | # You may not use this file except in compliance with the License. |
| 6 | # A copy of the License is located at |
| 7 | # |
| 8 | # http://aws.amazon.com/apache2.0 |
| 9 | # |
| 10 | # or in the "license" file accompanying this file. This file is distributed |
| 11 | # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 12 | # express or implied. See the License for the specific language governing |
| 13 | # permissions and limitations under the License. |
| 14 | |
| 15 | # Codebuild does not run in the Github CI if certain files are modified. |
| 16 | # Launching each individual build from the Codebuild UI is slow and tedious. |
| 17 | # Instead, this script will launch all the Codebuild builds at once. |
| 18 | # You will need to setup the AWS CLI with the proper authentication. |
| 19 | |
| 20 | set -e |
| 21 | |
| 22 | BUILDS=( |
| 23 | "AddressSanitizer" |
| 24 | "S2nIntegrationV2SmallBatch" |
| 25 | "Valgrind" |
| 26 | "s2nFuzzBatch" |
| 27 | "s2nGeneralBatch" |
| 28 | "s2nUnitNix" |
| 29 | "IntegRustNixBatch" |
| 30 | "Integv2NixBatch" |
| 31 | "kTLS us-west-2 no-batch" |
| 32 | "kTLSKeyUpdate us-west-2 no-batch" |
| 33 | ) |
| 34 | |
| 35 | usage() { |
| 36 | echo "start_codebuild.sh <source_version> <repo>" |
| 37 | echo " example: start_codebuild.sh pr/1111" |
| 38 | echo " example: start_codebuild.sh 1234abcd" |
| 39 | echo " example: start_codebuild.sh test_branch lrstewart/s2n" |
| 40 | } |
| 41 | |
| 42 | if [ "$#" -lt "1" ]; then |
| 43 | usage |
| 44 | exit 1 |
| 45 | fi |
| 46 | SOURCE_VERSION=$1 |
| 47 | REPO=${2:-aws/s2n-tls} |
| 48 | |
| 49 | start_build() { |
| 50 | NAME=$1 |
| 51 | REGION=${2:-"us-west-2"} |
| 52 | BATCH=${3:-"batch"} |
| 53 | |
| 54 | START_COMMAND="start-build-batch" |
| 55 | if [ "$BATCH" = "no-batch" ]; then |
| 56 | START_COMMAND="start-build" |
| 57 | fi |
| 58 | aws --region $REGION codebuild $START_COMMAND \ |
| 59 | --project-name $NAME \ |
| 60 | --source-location-override https://github.com/$REPO \ |
| 61 | --source-version $SOURCE_VERSION | jq -re "(.buildBatch.id // .build.id)" |
| 62 | } |
| 63 | |
| 64 | for args in "${BUILDS[@]}"; do |
| 65 | start_build $args |
| 66 | done |
| 67 | echo "All builds successfully started." |