Skip to content

Commit

Permalink
fix(sync-k3s-images): skip updating on inconsistent release state (#54)
Browse files Browse the repository at this point in the history
The k3s release index may be updated before container images are available to
use. This change updates the sync-k3s-images recipe to fail if any release images
cannot be found. The CI workflow is updated to allow failures. The workflow fails
if the sync recipe modifies the cached image digests.
  • Loading branch information
olix0r authored Dec 5, 2024
1 parent 9fdf077 commit 90e894c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/k3d.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ jobs:
- run: sudo apt-get update && sudo apt-get install -y skopeo
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
- uses: ./actions/setup-tools
- run: just sync-k3s-images
# The sync may fail when a new K3s version is released. This is expected.
- run: just sync-k3s-images || true
- run: git diff --exit-code

k3s-matrix:
Expand Down
6 changes: 6 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ sync-k3s-images:
DIGESTS=$(for tag in $(echo "$CHANNELS" | jq -r 'to_entries | .[].value' | sort -u) ; do
jo key="$tag" value="$(just k3s-image='{{ k3s-image }}' _k3s-inspect "${tag}" | jq -r '.Digest')"
done | jq -cs 'from_entries')
MISSING_CHANNELS=$(echo "$DIGESTS" | jq -r 'to_entries | map(select(.value == null) | .key) | .[]')
if [[ -n "$MISSING_CHANNELS" ]]; then
echo "Error: Digests could not be discovered for the following channels:" >&2
echo "$MISSING_CHANNELS" | while IFS= read -r channel; do echo "- $channel"; done >&2
exit 11
fi
jo name='{{ k3s-image }}' channels="$CHANNELS" digests="$DIGESTS" \
| jq . > k3s-images.json
jq . k3s-images.json
Expand Down

0 comments on commit 90e894c

Please sign in to comment.