Skip to content

Commit

Permalink
Static checks now also rebuilds image on missing checksum
Browse files Browse the repository at this point in the history
Ticket: ENT-10993
Changelog: None
Signed-off-by: Lars Erik Wik <[email protected]>
  • Loading branch information
larsewi committed Dec 5, 2024
1 parent 9617b15 commit 6cc3890
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions tests/static-check/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,18 @@ set -x
if buildah inspect cfengine-static-checker-f$STATIC_CHECKS_FEDORA_VERSION >/dev/null 2>&1; then
c=$(buildah from cfengine-static-checker-f$STATIC_CHECKS_FEDORA_VERSION)

# Recreate the image if the checksum of this file has changed
SUM_A=$(sha256sum $0)
SUM_B=$(buildah run $c cat $SUM_FILE)
if [[ $SUM_A != $SUM_B ]]; then
echo "Recreating image due to mismatching checksum..."
# Recreate the image if the checksum of this file has changed
if [[ `buildah run $c ls $SUM_FILE` == $SUM_FILE ]]; then
SUM_A=$(sha256sum $0)
SUM_B=$(buildah run $c cat $SUM_FILE)
if [[ $SUM_A != $SUM_B ]]; then
echo "Recreating image due to mismatching checksum..."
IMAGE_ID=$(buildah inspect $c | jq -r '.FromImageID')
buildah rmi --force $IMAGE_ID >/dev/null
c=$(create_image)
fi
else
echo "Recreating image due to missing checksum..."
IMAGE_ID=$(buildah inspect $c | jq -r '.FromImageID')
buildah rmi --force $IMAGE_ID >/dev/null
c=$(create_image)
Expand Down

0 comments on commit 6cc3890

Please sign in to comment.