version: 0.2 env: shell: bash variables: CANARY_DURATION: 25200 CANARY_THREADS: 3 CANARY_TPS: 50 CANARY_CLIENT_COUNT: 10 CANARY_LOG_FILE: 'canary_log.txt' CANARY_LOG_LEVEL: 'Error' PACKAGE_NAME: 'aws-crt-java' CANARY_SERVER_ARN: Mqtt5MosquittoSever CANARY_BUILD_S3_DST: mqtt5-canary/s3 CODEBUILD_TICKET_ITEM: "IoT SDK for Java" phases: install: commands: - add-apt-repository ppa:openjdk-r/ppa - add-apt-repository ppa:ubuntu-toolchain-r/test - apt-get update -y - sudo apt-get install cmake -y - git submodule update --init --recursive # Install necessary lib for canary wrapper - sudo apt-get install gcc python3-dev -y -f - sudo apt-get install pip -y -f - python3 -m pip install psutil - python3 -m pip install boto3 build: commands: - echo Build started on `date` - mvn install -DskipTests # Get secrets needed - export S3_DST=$(aws secretsmanager get-secret-value --secret-id "$CANARY_BUILD_S3_DST" --query "SecretString" | cut -f2,3 -d":" | sed -e 's/[\\\"\}]//g') - export GIT_HASH=$(git rev-parse HEAD) # Get the endpoint, certificate, and key for connecting to IoT Core - export ENDPOINT=$(aws secretsmanager get-secret-value --secret-id ${CANARY_SERVER_ARN} --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g') # Run the Canary - cd ./utils/Canary - 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}" post_build: commands: - echo Build completed on `date`