diff --git a/.gitea/workflows/build-v2.yml b/.gitea/workflows/build-v2.yml index a258f2c..1d426fe 100644 --- a/.gitea/workflows/build-v2.yml +++ b/.gitea/workflows/build-v2.yml @@ -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 diff --git a/AGENTS.md b/AGENTS.md index 29663d7..0ca3159 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -112,7 +112,12 @@ currently has only `shellcheck`, so builds cannot be run here.) - Tags: `main` → `stable`, `stable.YYYYMMDD`, `YYYYMMDD`; any other branch → `test-` 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-` 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