From 7fce37a0ac47859b3b4736a9b533d7dac0d440d9 Mon Sep 17 00:00:00 2001 From: Ali Asghar <98263017+alliasgher@users.noreply.github.com> Date: Tue, 25 Aug 2026 11:42:30 -0700 Subject: [PATCH] Fix e2e cache miss on force push by saving build artifacts explicitly (#9952) * Fix e2e cache miss on force push by saving artifacts explicitly actions/cache@v4 writes the cache in a post-job hook that runs after the job reports completion. The run-e2e-test jobs (needs: build) start as soon as build completes, before that post-hook save runs, so on a force push -- where the github.sha-keyed cache has no prior entry -- they deterministically miss the cache and fail with 'stat velero.tar: no such file or directory'. Switch the build job's lookups to actions/cache/restore and add explicit actions/cache/save steps at the end of the job (CLI, image, and MinIO), so the cache is written before build reports done. The run-e2e-test reads become actions/cache/restore. Fixes #9927 Signed-off-by: alliasgher * Add changelog for #9952 Signed-off-by: alliasgher --------- Signed-off-by: alliasgher --- .github/workflows/e2e-test-kind.yaml | 35 ++++++++++++++++++++++----- changelogs/unreleased/9952-alliasgher | 1 + 2 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 changelogs/unreleased/9952-alliasgher diff --git a/.github/workflows/e2e-test-kind.yaml b/.github/workflows/e2e-test-kind.yaml index 79e07fded..fcf0d37c2 100644 --- a/.github/workflows/e2e-test-kind.yaml +++ b/.github/workflows/e2e-test-kind.yaml @@ -39,14 +39,14 @@ jobs: # Look for a CLI that's made for this PR - name: Fetch built CLI id: cli-cache - uses: actions/cache@v6 + uses: actions/cache/restore@v6 with: path: ./_output/bin/linux/amd64/velero # The cache key a combination of the current PR number and the commit SHA key: velero-cli-${{ github.event.pull_request.number }}-${{ github.sha }} - name: Fetch built image id: image-cache - uses: actions/cache@v6 + uses: actions/cache/restore@v6 with: path: ./velero.tar # The cache key a combination of the current PR number and the commit SHA @@ -64,7 +64,7 @@ jobs: docker save velero:pr-test-linux-amd64 -o ./velero.tar # Build the MinIO image once for all e2e tests, from the reviewed bitnami/containers commit. - name: Cache MinIO Image - uses: actions/cache@v6 + uses: actions/cache/restore@v6 id: minio-cache with: path: ./minio-image.tar @@ -81,6 +81,29 @@ jobs: cd /tmp/bitnami-containers/bitnami/minio/2026/debian-12 docker build -t bitnami/minio:local . docker save bitnami/minio:local > ${{ github.workspace }}/minio-image.tar + # Save the freshly built artifacts to the cache explicitly, before this + # job reports completion. actions/cache saves in a post-job hook that + # runs *after* the job finishes, so the dependent run-e2e-test jobs (which + # start as soon as build completes) would race the save and miss the cache + # on a force push. See #9927. + - name: Save built CLI to cache + if: steps.cli-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@v6 + with: + path: ./_output/bin/linux/amd64/velero + key: velero-cli-${{ github.event.pull_request.number }}-${{ github.sha }} + - name: Save built image to cache + if: steps.image-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@v6 + with: + path: ./velero.tar + key: velero-image-${{ github.event.pull_request.number }}-${{ github.sha }} + - name: Save MinIO image to cache + if: steps.minio-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@v6 + with: + path: ./minio-image.tar + key: minio-bitnami-${{ steps.minio-version.outputs.dockerfile_sha }} # Create json of k8s versions to test # from guide: https://stackoverflow.com/a/65094398/4590470 setup-test-matrix: @@ -157,7 +180,7 @@ jobs: # Fetch the pre-built MinIO image from the build job - name: Fetch built MinIO Image - uses: actions/cache@v6 + uses: actions/cache/restore@v6 id: minio-cache with: path: ./minio-image.tar @@ -176,13 +199,13 @@ jobs: node_image: "kindest/node:v${{ matrix.k8s }}" - name: Fetch built CLI id: cli-cache - uses: actions/cache@v6 + uses: actions/cache/restore@v6 with: path: ./_output/bin/linux/amd64/velero key: velero-cli-${{ github.event.pull_request.number }}-${{ github.sha }} - name: Fetch built Image id: image-cache - uses: actions/cache@v6 + uses: actions/cache/restore@v6 with: path: ./velero.tar key: velero-image-${{ github.event.pull_request.number }}-${{ github.sha }} diff --git a/changelogs/unreleased/9952-alliasgher b/changelogs/unreleased/9952-alliasgher new file mode 100644 index 000000000..0f96ef5da --- /dev/null +++ b/changelogs/unreleased/9952-alliasgher @@ -0,0 +1 @@ +Fix e2e-test-kind workflow cache miss on force push by saving build artifacts explicitly instead of relying on the actions/cache post-job hook