Skip to content

Commit

Permalink
cleanup image tag
Browse files Browse the repository at this point in the history
  • Loading branch information
joejstuart committed Jul 19, 2024
1 parent f3cdacb commit 691da06
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions hack/build-acceptable-bundles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@")
Expand All @@ -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
Expand Down

0 comments on commit 691da06

Please sign in to comment.