Skip to content

Commit

Permalink
Self Terminate ec2 tests instances after 1 hour (#1233)
Browse files Browse the repository at this point in the history
The new ec2 test framework doesn't mesh well with our job pruner.
Codebuild just "stops" the instance without giving a signal to the
executing script, so trap cleanup is not executed. This lets the ec2
self-terminate once a certain amount of time has passed.
  • Loading branch information
samuel40791765 authored Oct 11, 2023
1 parent 4a48eb6 commit ff693cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/ci/cdk/cdk/ssm/general_test_run_ssm_document.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ mainSteps:
inputs:
timeoutSeconds: '7200'
runCommand:
# Fallback plan to shut down the ec2 instance in 60 minutes in case it's not terminated.
# Codebuild just "stops" the instance calling the script, so "trap cleanup" is not executed.
- shutdown -P +60
- sudo -i
- export DEBIAN_FRONTEND=noninteractive
- export CPU_TYPE=$(dpkg --print-architecture)
Expand Down
1 change: 1 addition & 0 deletions tests/ci/run_ec2_test_framework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ create_ec2_instances() {
--tag-specifications 'ResourceType="instance",Tags=[{Key="aws-lc",Value="aws-lc-ci-ec2-test-framework-ec2-x86-instance"}]' \
--iam-instance-profile Name=aws-lc-ci-ec2-test-framework-ec2-profile \
--placement 'AvailabilityZone=us-west-2a' \
--instance-initiated-shutdown-behavior terminate \
--query Instances[*].InstanceId --output text)"
echo "${instance_id}"
}
Expand Down

0 comments on commit ff693cf

Please sign in to comment.