From acd14415fe71b876287c2fdbd8f812b0a3bea329 Mon Sep 17 00:00:00 2001 From: Jon Schlueter Date: Mon, 3 Nov 2025 07:37:52 -0500 Subject: [PATCH] extend pullspecs_replaceatron logic for downstream Expand REGEX for which images to pin/replace out also use logic so that if a VAR is empty but defined it replaces the pin with empty instead of complaining Followup to https://github.com/openstack-k8s-operators/openstack-operator/pull/1584 --- hack/pullspecs_replaceatron.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hack/pullspecs_replaceatron.sh b/hack/pullspecs_replaceatron.sh index db680291a..d60abf114 100755 --- a/hack/pullspecs_replaceatron.sh +++ b/hack/pullspecs_replaceatron.sh @@ -19,7 +19,7 @@ cp "$CSV_FILE" "${CSV_FILE}.backup" echo "Updating RELATED_IMAGE_ environment variables in $CSV_FILE..." # Extract all RELATED_IMAGE_ env var names from the CSV file -RELATED_IMAGE_VARS=$(grep -o 'RELATED_IMAGE_[A-Z_]*' "$CSV_FILE" | sort -u) +RELATED_IMAGE_VARS=$(grep -o -e 'RELATED_IMAGE_[A-Z0-9_]*' -e '[A-Z0-9_]*_IMAGE_URL_DEFAULT' -e 'KUBE_RBAC_PROXY' "$CSV_FILE" | sort -u) # Track if any errors occurred ERRORS=0 @@ -27,7 +27,7 @@ ERRORS=0 # Process each RELATED_IMAGE_ variable for var_name in $RELATED_IMAGE_VARS; do # Check if the environment variable exists in the current bash environment - if [[ -n "${!var_name:-}" ]]; then + if [[ -v ${var_name} ]]; then current_value="${!var_name}" echo "Updating $var_name with value: $current_value"