From 8b482521e0369c678e2c9aba4b6d50936f70d29c Mon Sep 17 00:00:00 2001 From: "Benjamin R. J. Schwedler" Date: Tue, 16 Jun 2026 17:04:19 -0500 Subject: [PATCH] Seed CDN cache from matrix job into build jobs requests-cache uses a filesystem backend at /tmp/bakery_cache/ with deterministic blake2b keys derived from the request URL. The matrix job's CDN lookups populate this cache, but each subsequent job runs on a fresh runner and re-queries the CDN independently. If the daily CDN updates between the matrix step and a build/merge step, the resolved version changes and the --image-version filter no longer matches, producing a "no targets" failure (issue #304). Upload the populated cache as a run-scoped artifact after the matrix step and restore it before each bakery invocation that follows. The restore uses continue-on-error so production builds (no dev versions, no CDN cache) degrade gracefully rather than failing. --- .github/workflows/bakery-build-native.yml | 20 ++++++++++++++++++++ .github/workflows/bakery-build-pr.yml | 14 ++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/.github/workflows/bakery-build-native.yml b/.github/workflows/bakery-build-native.yml index 2a564ee6..114ea044 100644 --- a/.github/workflows/bakery-build-native.yml +++ b/.github/workflows/bakery-build-native.yml @@ -188,6 +188,13 @@ jobs: echo "platform_matrix=$(echo "$result" | jq --compact-output .)" >> "$GITHUB_OUTPUT" echo "image_matrix=$(echo "$result" | jq --compact-output '[.[].image] | unique')" >> "$GITHUB_OUTPUT" + - name: Upload CDN cache + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: bakery-cdn-cache + path: /tmp/bakery_cache/ + if-no-files-found: ignore + build-test: name: "Build/Test ${{ matrix.img.image }}:${{ matrix.img.version }} (${{ matrix.img.platform }})" permissions: @@ -294,6 +301,12 @@ jobs: else echo "dev-spec=" >> "$GITHUB_OUTPUT" fi + - name: Restore CDN cache + continue-on-error: true + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: bakery-cdn-cache + path: /tmp/bakery_cache/ - name: Build env: GIT_SHA: ${{ github.sha }} @@ -474,6 +487,13 @@ jobs: echo "dev-spec=" >> "$GITHUB_OUTPUT" fi + - name: Restore CDN cache + continue-on-error: true + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: bakery-cdn-cache + path: /tmp/bakery_cache/ + - name: Publish env: GIT_SHA: ${{ github.sha }} diff --git a/.github/workflows/bakery-build-pr.yml b/.github/workflows/bakery-build-pr.yml index 16f249bc..3889f977 100644 --- a/.github/workflows/bakery-build-pr.yml +++ b/.github/workflows/bakery-build-pr.yml @@ -121,6 +121,13 @@ jobs: result=$(bakery ci matrix --quiet --dev-versions "$DEV_VERSIONS" --matrix-versions "$MATRIX_VERSIONS" --exclude platform --context "$BAKERY_CONTEXT") echo "versions_matrix=$(echo "$result" | jq --compact-output .)" >> "$GITHUB_OUTPUT" + - name: Upload CDN cache + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: bakery-cdn-cache + path: /tmp/bakery_cache/ + if-no-files-found: ignore + build-test: name: "Build/Test ${{ matrix.img.image }}:${{ matrix.img.version }} (${{ matrix.img.platform }})" needs: @@ -180,6 +187,13 @@ jobs: PLATFORM=${BUILD_PLATFORM#linux/} echo "platform=$PLATFORM" >> "$GITHUB_OUTPUT" + - name: Restore CDN cache + continue-on-error: true + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: bakery-cdn-cache + path: /tmp/bakery_cache/ + - name: Build env: IS_FORK: ${{ needs.detect.outputs.is-fork }}