Skip to content

Instantly share code, notes, and snippets.

@aditya-konarde
Created October 27, 2017 07:04
Show Gist options
  • Save aditya-konarde/539cab2774988a5cbf3fe14c3e53b55c to your computer and use it in GitHub Desktop.
Save aditya-konarde/539cab2774988a5cbf3fe14c3e53b55c to your computer and use it in GitHub Desktop.
Check images
#!/bin/bash
# Show command before executing
set -x
# Exit on error
set -e
# Check the existence of image on registry.centos.org
IMAGE="mattermost-team"
REGISTRY="https://registry.centos.org"
REPOSITORY="mattermost"
TAG="4.3"
curl -X GET $REGISTRY/v2/$REPOSITORY/$IMAGE/tags/list | grep -w $TAG
if [ $? -eq 0 ]; then
echo 'CICO: Image existence check successful. Ready to deploy updated app'
exit 0
else
echo 'CICO: Image push to registry failed'
exit 2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment