Skip to content

Commit

Permalink
Check deployed images against built images
Browse files Browse the repository at this point in the history
After deployment, if any images were built, check that they were used
in the deployment.

Signed-off-by: Stephen Kitt <[email protected]>
  • Loading branch information
skitt committed Jun 27, 2023
1 parent d392f63 commit ec9cc48
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions scripts/shared/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,25 @@ fi

run_if_defined post_deploy

# Check that the deployed images match those we built (if any)
image_mismatch=false
for image in package/.image.*; do
expected="$(docker image inspect "$(cat "$image")" | jq -r '.[0].RepoDigests[0]')"
image="${image#package/.image.}"
for deployed in $(kubectl get pods -A -o json | jq -r '.items[].status.containerStatuses[].imageID' | grep "$image"); do
if [ "$deployed" != "$expected" ]; then
printf "Image %s is deployed with %s, expected %s\n" "$image" "$deployed" "$expected"
image_mismatch=true
else
printf "Successfully checked image %s, deployed with %s\n" "$image" "$deployed"
fi
done
done
if [ "$image_mismatch" = true ]; then
kubectl get pods -A -o json
exit 1
fi

# Print installed versions for manual validation of CI
subctl show versions
print_clusters_message

0 comments on commit ec9cc48

Please sign in to comment.