xref: /aosp_15_r20/external/aws-crt-java/codebuild/mqtt5-java-canary-test.yml (revision 3c7ae9de214676c52d19f01067dc1a404272dc11)
1version: 0.2
2env:
3  shell: bash
4  variables:
5    CANARY_DURATION: 25200
6    CANARY_THREADS: 3
7    CANARY_TPS: 50
8    CANARY_CLIENT_COUNT: 10
9    CANARY_LOG_FILE: 'canary_log.txt'
10    CANARY_LOG_LEVEL: 'Error'
11    PACKAGE_NAME: 'aws-crt-java'
12    CANARY_SERVER_ARN: Mqtt5MosquittoSever
13    CANARY_BUILD_S3_DST: mqtt5-canary/s3
14    CODEBUILD_TICKET_ITEM: "IoT SDK for Java"
15phases:
16  install:
17    commands:
18      - add-apt-repository ppa:openjdk-r/ppa
19      - add-apt-repository ppa:ubuntu-toolchain-r/test
20      - apt-get update -y
21      - sudo apt-get install cmake -y
22      - git submodule update --init --recursive
23      # Install necessary lib for canary wrapper
24      - sudo apt-get install gcc python3-dev -y -f
25      - sudo apt-get install pip -y -f
26      - python3 -m pip install psutil
27      - python3 -m pip install boto3
28  build:
29    commands:
30      - echo Build started on `date`
31      - mvn install -DskipTests
32      # Get secrets needed
33      - export S3_DST=$(aws secretsmanager get-secret-value --secret-id "$CANARY_BUILD_S3_DST" --query "SecretString" | cut -f2,3 -d":" | sed -e 's/[\\\"\}]//g')
34      - export GIT_HASH=$(git rev-parse HEAD)
35      # Get the endpoint, certificate, and key for connecting to IoT Core
36      - export ENDPOINT=$(aws secretsmanager get-secret-value --secret-id ${CANARY_SERVER_ARN} --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g')
37      # Run the Canary
38      - cd ./utils/Canary
39      - python3 ../../codebuild/CanaryWrapper.py --canary_executable mvn --canary_arguments "compile exec:java -Dexec.mainClass=canary.mqtt5.Mqtt5Canary -Dexec.args=\"--endpoint \"${ENDPOINT}\" --port 1883 --seconds ${CANARY_DURATION} --threads ${CANARY_THREADS} --tps ${CANARY_TPS} --clients ${CANARY_CLIENT_COUNT}\" -Daws.crt.debugnative=true -Daws.crt.log.destination=Stdout -Daws.crt.log.level=${CANARY_LOG_LEVEL}" --git_hash ${GIT_HASH} --git_repo_name $PACKAGE_NAME --codebuild_log_path $CODEBUILD_LOG_PATH --ticket_item "${CODEBUILD_TICKET_ITEM}"
40  post_build:
41    commands:
42      - echo Build completed on `date`
43