Created
November 4, 2019 15:48
-
-
Save brettswift/f1f0febf18ab89fc9fd43670f8af2937 to your computer and use it in GitHub Desktop.
Revisions
-
brettswift created this gist
Nov 4, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ #!/usr/bin/env bash # Goal: run cdk apps, parse output like URL's to run a quick smoke test after the deploy set -e ACTION='deploy' NAMESPACE=$(whoami) CDK_DEPLOY_OUTPUT_FILE='.cdk_deploy_result' rm -rf ${CDK_DEPLOY_OUTPUT_FILE} # so this script doesn't drive us insane npm run build # Deploy and collect output in a file, for parsing after npx cdk ${ACTION}\ --require-approval never \ -c namespace=${NAMESPACE} \ 'Invoice-*' \ 2>&1 | tee -a ${CDK_DEPLOY_OUTPUT_FILE} # Strip .outputs to only outputs. sed -n -e '/Outputs:/,/^$/ p' ${CDK_DEPLOY_OUTPUT_FILE} > .outputs API_GW_URL=$(awk -F " " '/ApiGatewayUrl/ { print $3 }' .outputs) API_KEY_RESOURCE_ID=$(awk -F " " '/ApiKey1/ { print $3 }' .outputs) API_KEY=$(aws apigateway get-api-key --api-key ${API_KEY_RESOURCE_ID} --include-value | jq -r '.value') # QA the thing result=$(curl -H "x-api-key: ${API_KEY}" ${API_GW_URL}/api/healthcheck) echo ${result} echo ${result} | jq '.[0]' | grep Version echo "Success!"