ci.ocp: Sort images according to git

The quay.io registry returns the tags sorted alphabetically and doesn't
seem to provide a way to sort it by age. Let's use "git log" to get all
changes between the commits and print all tags that were actually
pushed.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
This commit is contained in:
Lukáš Doktor
2024-08-06 17:30:35 +02:00
parent 94bc54f4d2
commit 820e000f1c

View File

@@ -16,9 +16,12 @@ REPO="quay.io/kata-containers/kata-deploy-ci"
TAGS=$(skopeo list-tags "docker://$REPO") TAGS=$(skopeo list-tags "docker://$REPO")
# Only amd64 # Only amd64
TAGS=$(echo "$TAGS" | jq '.Tags' | jq "map(select(endswith(\"$ARCH\")))" | jq -r '.[]') TAGS=$(echo "$TAGS" | jq '.Tags' | jq "map(select(endswith(\"$ARCH\")))" | jq -r '.[]')
# Tags since $GOOD # Sort by git
TAGS=$(echo "$TAGS" | sed -n -e "/$GOOD/,$$p") SORTED=""
# Tags up to $BAD [ -n "$BAD" ] && LOG_ARGS="$GOOD~1..$BAD" || LOG_ARGS="$GOOD~1.."
[ -n "$BAD" ] && TAGS=$(echo "$TAGS" | sed "/$BAD/q") for TAG in $(git log --merges --pretty=format:%H --reverse $LOG_ARGS); do
[[ "$TAGS" =~ "$TAG" ]] && SORTED+="
kata-containers-$TAG-$ARCH"
done
# Comma separated tags with repo # Comma separated tags with repo
echo "$TAGS" | sed -e "s@^@$REPO:@" | paste -s -d, - echo "$SORTED" | tail -n +2 | sed -e "s@^@$REPO:@" | paste -s -d, -