fix(ci): Registry-Cache pro Branch und Gitea-kompatibles Manifest
- Cache-Tag pro Branch (buildcache-amd64-<branch>), damit sich main und Test-Branches nicht gegenseitig ueberschreiben - cache-to mit image-manifest=true,oci-mediatypes=true (Gitea lehnt BuildKits Default-Cache-Manifest ab) - AGENTS.md: Cache-Tag-Doku aktualisiert
This commit is contained in:
1 parent
23066c7831
commit
e1c42f3828
2 files changed
+23
-7
No files matched your search
@@ -66,19 +66,26 @@ jobs:
|
||||
set -euo pipefail
|
||||
|
||||
BRANCH="${GITHUB_REF_NAME}"
|
||||
# Branch-Name fuer OCI-Tags sanitizen (Slashes sind dort ungueltig).
|
||||
# main bleibt "main", damit der bestehende Cache-Tag weiter passt.
|
||||
SANITIZED=$(echo "$BRANCH" \
|
||||
| sed 's/[^a-zA-Z0-9._-]/-/g' \
|
||||
| head -c 50)
|
||||
|
||||
if [[ "$BRANCH" == "main" ]]; then
|
||||
echo "IMAGE_TAG=${DEFAULT_TAG}" >> "${GITHUB_ENV}"
|
||||
echo "IS_TEST_BUILD=false" >> "${GITHUB_ENV}"
|
||||
else
|
||||
SANITIZED=$(echo "$BRANCH" \
|
||||
| sed 's/[^a-zA-Z0-9._-]/-/g' \
|
||||
| head -c 50)
|
||||
|
||||
echo "IMAGE_TAG=test-${SANITIZED}" >> "${GITHUB_ENV}"
|
||||
echo "IS_TEST_BUILD=true" >> "${GITHUB_ENV}"
|
||||
fi
|
||||
|
||||
# Cache pro Branch: main (Kinoite) und feat/labwc-noctalia (bootc)
|
||||
# haben unterschiedliche Basis-Images. Ein gemeinsamer Cache-Tag
|
||||
# wuerde sich gegenseitig ueberschreiben und die Trefferquote auf
|
||||
# nahezu null druecken.
|
||||
echo "CACHE_TAG=buildcache-amd64-${SANITIZED}" >> "${GITHUB_ENV}"
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Checkout
|
||||
# ------------------------------------------------------------
|
||||
@@ -172,8 +179,12 @@ jobs:
|
||||
tags: ${{ steps.metadata.outputs.tags }}
|
||||
labels: ${{ steps.metadata.outputs.labels }}
|
||||
|
||||
cache-from: type=registry,ref=${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-amd64-main
|
||||
cache-to: type=registry,ref=${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-amd64-main,mode=max
|
||||
# Branch-spezifischer Cache-Tag (siehe "Determine image tag").
|
||||
# image-manifest + oci-mediatypes: Gitea akzeptiert BuildKits
|
||||
# Default-Cache-Manifest nicht (400 Bad Request) und ignoriert den
|
||||
# Cache sonst beim Pull - Ergebnis waere ein faktisch leerer Cache.
|
||||
cache-from: type=registry,ref=${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.CACHE_TAG }}
|
||||
cache-to: type=registry,ref=${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.CACHE_TAG }},mode=max,image-manifest=true,oci-mediatypes=true
|
||||
|
||||
outputs: type=oci,dest=${{ github.workspace }}/oci-layout.tar,tar=true
|
||||
|
||||
|
||||
@@ -112,7 +112,12 @@ currently has only `shellcheck`, so builds cannot be run here.)
|
||||
- Tags: `main` → `stable`, `stable.YYYYMMDD`, `YYYYMMDD`; any other branch →
|
||||
`test-<branch>` only (no dated variants).
|
||||
- Secrets: `READONLY_AUTH_BASE64`, `REGISTRY`, `SIGNING_SECRET`, `RENOVATE_TOKEN`.
|
||||
- Registry cache tag `buildcache-amd64-main` is shared across branches.
|
||||
- Registry cache tag is branch-specific: `buildcache-amd64-main` for `main`,
|
||||
`buildcache-amd64-<sanitized-branch>` for everything else. The branches use
|
||||
different base images (Kinoite vs. bootc), so a shared tag would thrash the
|
||||
cache. `cache-to` uses `image-manifest=true,oci-mediatypes=true` because Gitea
|
||||
rejects BuildKit's default cache manifest (400 Bad Request) and would
|
||||
otherwise ignore the cache on pull.
|
||||
- The registry (`humocs-man.duckdns.org/humocs-man`) is private — pulls need auth.
|
||||
- Renovate (`renovate.json`) runs nightly at 03:00 UTC via
|
||||
`.gitea/workflows/renovate_v2.yml`. That workflow intentionally uses
|
||||
|
||||
Reference in new issue
Block a user