Repository navigation
Conversation
| echo "-${c}" | ||
| break | ||
| fi | ||
| done |
There was a problem hiding this comment.
This loop doesn't seem necessary.
With anonymous access to the quay API, we can list all th
8000
e current tags, and determine what the next value for c should be from that:
curl -sSfL 'https://quay.io/api/v1/repository/keycloak/keycloak/tag/? class="pl-pds">' | jq -r '.tags | .[] | .name' | head
nightly
latest
18.0
18.0.0
legacy
18.0.0-legacy
17.0.1-legacy
17.0
17.0.1
17.0.0-legacyThere was a problem hiding this comment.
If I read correctly the documentation:
https://docs.quay.io/api/swagger/#!/tag/listRepoTags
the endpoint you are suggesting will return a paged result and the order is not specified.
There was a problem hiding this comment.
Hmm, that's true. The order does seem to be the time of modification, but that's not specified. Here's a more complete solution:
#!/bin/bash
set -xeuo pipefail
repo="${1:-keycloak/keycloak}"
original_tag="${2:-18.0.0}"
tmp_json="$(mktemp)"
tmp_tags="$(mktemp)"
trap "rm -f '$tmp_json' '$tmp_tags'" EXIT
page=1
while true
do
curl -sSfL "https://quay.io/api/v1/repository/$repo/tag/? class="pl-smi">$page" > "$tmp_json"
jq -r '.tags | .[] | .name' "$tmp_json" >> "$tmp_tags"
if jq '.has_additional' "$tmp_json" | grep -qxF 'true'
then
(( page+=1 ))
else
break
fi
done
c="$(sort -Vu "$tmp_tags" | grep -F "$original_tag" | grep -Ee '-[0-9]+$' | tail -n1 | rev | cut -d- -f1 | rev || true)"
[ -n "$c" ] || c=0
(( c+=1 ))
echo "New suffix: $c"There was a problem hiding this comment.
Thanks for the update @ASzc !
This is again a similar tradeoff as the other PR 🙂 , I do believe that plain docker commands are preferable for this task since they work with any Docker registry.
Also, the overall complexity of your proposed solution (although shows great bash skills 🙂 ) seems to be a little higher than my proposal.
It would be nice to have a third opinion to break the tie, cc. @abstractj @stianst
| type=ref,event=branch | ||
| type=semver,pattern={{version}} | ||
| type=semver,pattern={{major}}.{{minor}} | ||
| type=semver,pattern={{version}},suffix=${{ env.INCREMENTAL }} |
There was a problem hiding this comment.
suffix may require you to add the separator (e.g. -) in there too? It's not well documented...
https://github.com/docker/metadata-action#typesemver doesn't really say much
There was a problem hiding this comment.
yup, is not well documented, we are adding the - here ATM:
https://github.com/keycloak/keycloak/pull/12110/files#diff-f7c3b7edcf25a48a41b690612fbd1d9bd1ceb29dff4a1c04234d8167ed1500d6R17
Resolves #11463