Skip to content

Commit a5f4081

Browse files
bretambroseBret Ambrose
andauthored
Canary refactor (#708)
Co-authored-by: Bret Ambrose <bambrose@amazon.com>
1 parent d1912ed commit a5f4081

2 files changed

Lines changed: 28 additions & 3 deletions

File tree

codebuild/mqtt5-python-canary-test.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ git submodule update --init
99
# build package
1010
cd $CODEBUILD_SRC_DIR
1111

12-
export AWS_TEST_S3=YES
1312
python -m pip install --verbose .
14-
python codebuild/CanaryWrapper.py --canary_executable 'python test/mqtt5_canary.py' --git_hash ${GIT_HASH} --git_repo_name $PACKAGE_NAME --codebuild_log_path $CODEBUILD_LOG_PATH
13+
python codebuild/CanaryWrapper.py --canary_executable 'python test/mqtt5_canary.py' --git_hash ${GIT_HASH} --git_repo_name $PACKAGE_NAME --ticket_item "IoT SDK for Python" --cloudwatch_namespace mqtt5_canary

codebuild/mqtt5-python-canary-test.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version: 0.2
44
env:
55
shell: bash
66
variables:
7-
CANARY_DURATION: 25200
7+
CANARY_DURATION: 300
88
CANARY_THREADS: 3
99
CANARY_TPS: 50
1010
CANARY_CLIENT_COUNT: 10
@@ -24,13 +24,39 @@ phases:
2424
pre_build:
2525
commands:
2626
- export CC=gcc-7
27+
# Retrieve the private key from Secrets Manager
28+
- DEPLOY_KEY=$(aws secretsmanager get-secret-value --secret-id Aws-crt-canaries-deploy-key --query SecretString --output text)
29+
30+
# Set up SSH configuration
31+
- mkdir -p ~/.ssh
32+
- echo "$DEPLOY_KEY" > ~/.ssh/id_rsa
33+
- chmod 600 ~/.ssh/id_rsa
34+
35+
# Add GitHub to known hosts to avoid host verification prompt
36+
- ssh-keyscan -H github.com >> ~/.ssh/known_hosts
37+
38+
# Configure SSH to use the key for GitHub
39+
- |
40+
cat > ~/.ssh/config << EOF
41+
Host github.com
42+
HostName github.com
43+
User git
44+
IdentityFile ~/.ssh/id_rsa
45+
StrictHostKeyChecking no
46+
EOF
47+
- chmod 600 ~/.ssh/config
2748
build:
2849
commands:
2950
- echo Build started on `date`
51+
# pull and copy canary scripts
52+
- git clone git@github.com:awslabs/aws-crt-canaries.git
53+
- cp aws-crt-canaries/source/mqtt5/*.py ./codebuild
3054
- source ./codebuild/mqtt5_test_setup.sh s3://aws-crt-test-stuff/TestIotProdMQTT5EnvironmentVariables.txt us-east-1
3155
- export ENDPOINT=$(aws secretsmanager get-secret-value --secret-id "$CANARY_SERVER_ARN" --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g')
3256
- export GIT_HASH=$(git rev-parse HEAD)
3357
- $CODEBUILD_SRC_DIR/codebuild/mqtt5-python-canary-test.sh
3458
post_build:
3559
commands:
3660
- echo Build completed on `date`
61+
# Clean up SSH keys for security
62+
- rm -rf ~/.ssh/id_rsa ~/.ssh/config

0 commit comments

Comments
 (0)