From f38fe98c0dfee841d7a9dd2a0cee335794d93975 Mon Sep 17 00:00:00 2001 From: Stephen Kitt Date: Mon, 13 Jan 2025 10:42:23 +0100 Subject: [PATCH] Check the deployed version of local components In projects building deployed components, declaring LOCAL_COMPONENTS allows deploy.sh to check that the deployed version used in tests matches the expected version. Signed-off-by: Stephen Kitt --- Makefile | 3 +++ scripts/shared/deploy.sh | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/Makefile b/Makefile index 9b9d54f4..b48b6fcf 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,15 @@ BASE_BRANCH ?= devel OCM_BASE_BRANCH ?= main IMAGES ?= shipyard-dapper-base shipyard-linting nettest +LOCAL_COMPONENTS := submariner-metrics-proxy MULTIARCH_IMAGES ?= nettest EXTRA_PRELOAD_IMAGES := $(PRELOAD_IMAGES) PLATFORMS ?= linux/amd64,linux/arm64 NON_DAPPER_GOALS += images multiarch-images PLUGIN ?= +export LOCAL_COMPONENTS + export BASE_BRANCH OCM_BASE_BRANCH ifneq (,$(DAPPER_HOST_ARCH)) diff --git a/scripts/shared/deploy.sh b/scripts/shared/deploy.sh index 247c4428..13d81cda 100755 --- a/scripts/shared/deploy.sh +++ b/scripts/shared/deploy.sh @@ -173,3 +173,16 @@ run_if_defined post_deploy # Print installed versions for manual validation of CI subctl show versions print_clusters_message + +# If there are any local components, check that the deployed versions are the newly-built versions +if [ -n "$LOCAL_COMPONENTS" ]; then + for component in $LOCAL_COMPONENTS; do + for version in $(subctl show versions | awk "/$component/ { print \$4 }"); do + # shellcheck disable=SC2153 # VERSION is provided externally + if [ "$version" != "$VERSION" ]; then + printf "Expected version %s of component %s, but got %s.\n" "$VERSION" "$component" "$version" + exit 1 + fi + done + done +fi