Created
June 13, 2017 01:24
-
-
Save waltervargas/46e312c3809805409acda5596b9341b8 to your computer and use it in GitHub Desktop.
Checks if the last commit hash is present as a tag for Docker Images in a particular ECR repository.
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
NAME=dockercoins | |
IMAGES=$(aws --region ${REGION} ecr list-images --repository-name ${NAME} --output json) | |
COMMIT_ID=$(git log --pretty=format:%H -1 . ) | |
IMAGES_TEST_COMMIT_ID=$(echo $IMAGES | jq '.imageIds[] | .imageTag | select (.!=null) | test("$COMMIT_ID")') | |
if [[ ! ${IMAGES_TEST_COMMIT_ID} == *true* ]]; then | |
echo "Build and Push to ECR" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment