Created
February 21, 2017 22:27
-
-
Save bobzoller/00d43004ca4a2403c1d34f1b4a9229e0 to your computer and use it in GitHub Desktop.
find tasks that aren't using AWS ECR
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
#!/bin/bash | |
set -e | |
set -o pipefail | |
#set -x | |
ACCOUNT=prod | |
arns=$(aws-vault exec "$ACCOUNT" -- aws ecs list-task-definitions | jq -r '.taskDefinitionArns | join("\n")') | |
families=$(echo "$arns" | awk -F '/' '{print $2}' | awk -F ':' '{print $1}' | sed '/^[[:space:]]*$/d' | sort | uniq) | |
for family in $families; do | |
images=$(aws-vault exec "$ACCOUNT" -- aws ecs describe-task-definition --task-definition "$family" | jq -r '.taskDefinition.containerDefinitions | map(.image) | join("\n")') | |
if echo "$images" | grep -qv 'dkr.ecr'; then | |
echo "FAIL $family" | |
else | |
echo "PASS $family" | |
fi | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment