2026-10-30 19:55:20 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
# Copies upstream images into this forge's registry, as
|
|
|
|
|
# forge.quinefoundation.com/quine-global-labs/mirror/<registry>/<path>,
|
|
|
|
|
# which runner-x86-linux's registries.conf tries before the upstream
|
|
|
|
|
# registry (petersweb-infra, hosts/runner-x86-linux). So builds pull from
|
|
|
|
|
# the forge, and still build from yesterday's copy when upstream is down.
|
|
|
|
|
#
|
|
|
|
|
# Usage: vendor-images.sh REF... (registry-qualified, e.g.
|
|
|
|
|
# quay.io/fedora/fedora-bootc:rawhide, or name:tag@sha256:...)
|
|
|
|
|
#
|
|
|
|
|
# Needs a `podman login` to the forge first. Best effort: an image that
|
|
|
|
|
# can't be copied is a warning, not a failure; the build then gets the
|
|
|
|
|
# mirror's last copy, or upstream's.
|
|
|
|
|
set -uo pipefail
|
|
|
|
|
|
|
|
|
|
mirror=${MIRROR:-forge.quinefoundation.com/quine-global-labs/mirror}
|
|
|
|
|
# Read from upstream itself, not from the mirror registries.conf points at.
|
2026-11-02 20:43:42 -09:00
|
|
|
# The flag, not CONTAINERS_REGISTRIES_CONF: podman and buildah read that
|
|
|
|
|
# variable, but skopeo never has. Until 2026-11-03 this exported it, skopeo
|
|
|
|
|
# read the mirror, and every run copied the mirror onto itself, so tags
|
|
|
|
|
# stayed at their first copy. (runner-x86-linux's skopeo now honors the
|
|
|
|
|
# variable too; petersweb-infra, hosts/runner-x86-linux.)
|
2026-11-02 19:50:46 -09:00
|
|
|
skopeo() { command skopeo --registries-conf /dev/null "$@"; }
|
2026-10-30 19:55:20 -08:00
|
|
|
|
|
|
|
|
for ref in "$@"; do
|
2026-10-30 21:40:06 -08:00
|
|
|
src="docker://$ref"
|
|
|
|
|
dest="docker://$mirror/$ref"
|
2026-11-02 18:04:15 -09:00
|
|
|
# Every architecture: build-arm64.yml pulls the arm64 halves.
|
|
|
|
|
opts=(--multi-arch all)
|
2026-10-30 19:55:20 -08:00
|
|
|
if [[ $ref == *@sha256:* ]]; then
|
|
|
|
|
# Pinned by digest: copy the whole index unchanged, so the digest the
|
2026-10-30 21:40:06 -08:00
|
|
|
# build asks for exists on the mirror. skopeo refuses a reference with
|
|
|
|
|
# both a tag and a digest, so read by digest and write by tag.
|
|
|
|
|
name=${ref%@*}
|
|
|
|
|
src="docker://${name%:*}@${ref#*@}"
|
|
|
|
|
dest="docker://$mirror/$name"
|
2026-10-30 19:55:20 -08:00
|
|
|
opts=(--multi-arch all --preserve-digests)
|
|
|
|
|
fi
|
|
|
|
|
echo "::group::$ref"
|
|
|
|
|
# Layers already on the mirror aren't downloaded again.
|
2026-10-30 21:40:06 -08:00
|
|
|
skopeo copy --retry-times 5 "${opts[@]}" "$src" "$dest" ||
|
2026-10-30 19:55:20 -08:00
|
|
|
echo "::warning::couldn't vendor $ref; builds get the mirror's last copy, or upstream's"
|
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
done
|