mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-13 11:34:54 +00:00
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 <alliasgher123@gmail.com> * Add changelog for #9952 Signed-off-by: alliasgher <alliasgher123@gmail.com> --------- Signed-off-by: alliasgher <alliasgher123@gmail.com>
This commit is contained in:
@@ -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 }}
|
||||
|
||||
Reference in New Issue
Block a user