From 691da0685efcabafa4a267caf6aa522a2daf9942 Mon Sep 17 00:00:00 2001 From: jstuart Date: Fri, 19 Jul 2024 10:44:38 -0500 Subject: [PATCH] cleanup image tag --- hack/build-acceptable-bundles.sh | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/hack/build-acceptable-bundles.sh b/hack/build-acceptable-bundles.sh index 17ecdea548..bdbdc4aa49 100755 --- a/hack/build-acceptable-bundles.sh +++ b/hack/build-acceptable-bundles.sh @@ -3,19 +3,13 @@ set -o errexit set -o nounset set -o pipefail -# Function to remove everything after @ in the image reference -remove_digest() { - local input="$1" - echo "$input" | sed 's/@.*//' -} -# Function to remove the checksum and leading hyphen from the image reference -remove_checksum() { - local input="$1" - echo "$input" | sed 's/\(.*\)-[^-]*$/\1/' +# Function to remove the sha and digest from the image name +# from: quay.io/konflux-ci/task1:0.1-1234@sha256:5678 to quay.io/konflux-ci/task1:0.1 +strip_image_tag() { + echo "$1" | sed 's/\(:[^-]*\).*/\1/' } - # helps with debugging DATA_BUNDLE_REPO="${DATA_BUNDLE_REPO:-quay.io/konflux-ci/tekton-catalog/data-acceptable-bundles}" mapfile -t BUNDLES < <(cat "$@") @@ -25,8 +19,7 @@ SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" OUTPUT_TASK_BUNDLE_LIST="${OUTPUT_TASK_BUNDLE_LIST-${SCRIPTDIR}/../task-bundle-list}" for i in "${!BUNDLES[@]}"; do original_line="${BUNDLES[$i]}" - modified_line=$(remove_digest "$original_line") - modified_line=$(remove_checksum "$modified_line") + modified_line=$(strip_image_tag "$original_line") BUNDLES[$i]="$modified_line" echo "$original_line,$modified_line" >> "$OUTPUT_TASK_BUNDLE_LIST" done