Created
March 31, 2020 17:19
-
-
Save johnytiago/23ea30ef51b99e9c8751bd6a3f355594 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws s3 cp s3://$SCENARIOS_BUCKET/$SERVICE . --recursive | |
# Default environment variables | |
TASK_COUNT=10 | |
source ./overwrites.env # Override TASK_COUNT & others if needed | |
./setup.sh && echo "Setup script finished." || echo "No setup.sh file found. Continuing..." | |
PAYLOAD=$( jq -n -c \ | |
--arg tc "$TASK_COUNT" \ | |
--arg sv "$SERVICE" \ | |
'{taskCount: $tc, service: $sv}' ) | |
aws lambda invoke --function-name ${LAMBDA_FUNCTION} --payload ${PAYLOAD} runner-response.json | |
PAYLOAD=$(jq -n -c \ | |
--arg c "$TASK_CLUSTER" \ | |
--argjson t $(cat runner-response.json | jq -r -c '.arns') \ | |
'{cluster: $c, tasks: $t}') | |
aws ecs wait tasks-running --cli-input-json $PAYLOAD | |
aws ecs wait tasks-stopped --cli-input-json $PAYLOAD | |
echo "Got tasks, asserting exit codes" | |
EXIT_CODES_SUM=$(aws ecs describe-tasks --cli-input-json $PAYLOAD \ | |
| jq '[.tasks[].containers[0].exitCode] | reduce .[] as $sum (0; .+$sum)') | |
./teardown.sh && echo "Teardown script finished." || echo "No teardown.sh file found. Continuing..." | |
exit $EXIT_CODES_SUM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment