Skip to content

Commit

Permalink
use image instead of digest for local check
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdokkum authored May 27, 2024
1 parent bd3b709 commit 3fe643c
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,18 @@ jobs:
echo "Building Docker image locally..."
docker build --platform linux/amd64 -t wxyc_backend_service:latest .
echo "Fetching local image details..."
LOCAL_IMAGE_DETAILS=$(docker inspect wxyc_backend_service:latest)
echo "Fetching local image ID..."
LOCAL_ID=$(docker inspect --format='{{.Id}}' wxyc_backend_service:latest)
echo "Local Image Details: $LOCAL_IMAGE_DETAILS"
echo "Fetching local image digest..."
LOCAL_DIGEST=$(echo "$LOCAL_IMAGE_DETAILS" | jq -r '.[0].RepoDigests[0]' | cut -d '@' -f 2)
if [ -z "$LOCAL_DIGEST" ]; then
echo "Failed to fetch local image digest."
if [ -z "$LOCAL_ID" ]; then
echo "Failed to fetch local image ID."
exit 1
fi
echo "Local Digest: $LOCAL_DIGEST"
echo "Local ID: $LOCAL_ID"
echo "Remote Digest: $REMOTE_DIGEST"
if [ "$REMOTE_DIGEST" = "$LOCAL_DIGEST" ]; then
if [ "$REMOTE_DIGEST" = "sha256:$LOCAL_ID" ]; then
echo "The image to be deployed is the same as the current image in ECR."
else
echo "The image to be deployed is different from the current image in ECR."
Expand Down

0 comments on commit 3fe643c

Please sign in to comment.