From bfbb7d3eb1e1d3f0fdfa6631b04b6c2afdf265f2 Mon Sep 17 00:00:00 2001 From: vismishr Date: Wed, 13 May 2026 00:02:10 +0530 Subject: [PATCH 1/4] ci(workflows): replace actions/cache with EFS-backed build cache in unit tests Replace the actions/cache step with a conditional copy from the EFS-backed PV mount at /cache/go-build. Falls back gracefully when the cache directory is not present so CI is never broken by mount issues. Part-of: CNTRLPLANE-3329 --- .github/workflows/test-reusable.yaml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-reusable.yaml b/.github/workflows/test-reusable.yaml index 30bf654a229..973e3bfd542 100644 --- a/.github/workflows/test-reusable.yaml +++ b/.github/workflows/test-reusable.yaml @@ -86,12 +86,11 @@ jobs: with: go-version-file: go.mod cache: false - - name: Restore Go build cache - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: /tmp/go-build-cache - key: go-build-${{ matrix.shard }}-${{ hashFiles('go.mod') }}-${{ github.sha }} - restore-keys: go-build-${{ matrix.shard }}-${{ hashFiles('go.mod') }}- + - name: Warm Go build cache from EFS + run: | + if [ -d /cache/go-build ]; then + cp -a /cache/go-build /tmp/go-build-cache + fi - name: Run tests run: make test-shard TEST_PACKAGES="${{ matrix.packages }}" COVER_PROFILE="cover-${{ matrix.shard }}.out" - name: Upload to Codecov From e077167294c0cd661af4cb8d5007c9f870e05828 Mon Sep 17 00:00:00 2001 From: vismishr Date: Wed, 13 May 2026 01:11:54 +0530 Subject: [PATCH 2/4] ci(unit-tests): copy cache contents instead of directory Use cp -a /cache/go-build/. to copy the contents of the cache directory rather than the directory itself. This prevents a nested go-build subdirectory if /tmp/go-build-cache already exists. --- .github/workflows/test-reusable.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-reusable.yaml b/.github/workflows/test-reusable.yaml index 973e3bfd542..c607e5e4096 100644 --- a/.github/workflows/test-reusable.yaml +++ b/.github/workflows/test-reusable.yaml @@ -89,7 +89,8 @@ jobs: - name: Warm Go build cache from EFS run: | if [ -d /cache/go-build ]; then - cp -a /cache/go-build /tmp/go-build-cache + mkdir -p /tmp/go-build-cache + cp -a /cache/go-build/. /tmp/go-build-cache/ fi - name: Run tests run: make test-shard TEST_PACKAGES="${{ matrix.packages }}" COVER_PROFILE="cover-${{ matrix.shard }}.out" From 6019f5d2cb941641f52f6fa2723755c28d43ab19 Mon Sep 17 00:00:00 2001 From: vismishr Date: Thu, 14 May 2026 12:09:45 +0530 Subject: [PATCH 3/4] ci(unit-tests): extract cache warm into composite action with error handling Extract the EFS cache-warm block into a reusable composite action at .github/actions/warm-go-cache/action.yaml. This adds graceful error handling so copy failures log a warning instead of failing the job, and sets GOCACHE via GITHUB_ENV to eliminate the job-level env var. Commit-Message-Assisted-by: Claude Opus 4.6 --- .github/actions/warm-go-cache/action.yaml | 13 +++++++++++++ .github/workflows/test-reusable.yaml | 8 +------- 2 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 .github/actions/warm-go-cache/action.yaml diff --git a/.github/actions/warm-go-cache/action.yaml b/.github/actions/warm-go-cache/action.yaml new file mode 100644 index 00000000000..e6738ae48ca --- /dev/null +++ b/.github/actions/warm-go-cache/action.yaml @@ -0,0 +1,13 @@ +name: 'Warm Go build cache' +description: 'Set GOCACHE and optionally warm from EFS-backed PV' +runs: + using: composite + steps: + - shell: bash + run: | + echo "GOCACHE=/tmp/go-build-cache" >> "$GITHUB_ENV" + if [ -d /cache/go-build ]; then + mkdir -p /tmp/go-build-cache && \ + cp -a /cache/go-build/. /tmp/go-build-cache/ || \ + echo "Warning: failed to copy EFS cache, proceeding without cache" + fi diff --git a/.github/workflows/test-reusable.yaml b/.github/workflows/test-reusable.yaml index c607e5e4096..c5af0a57b53 100644 --- a/.github/workflows/test-reusable.yaml +++ b/.github/workflows/test-reusable.yaml @@ -73,7 +73,6 @@ jobs: - shard: other packages: ./karpenter-operator/... ./control-plane-pki-operator/... ./contrib/... ./ignition-server/... ./pkg/... ./dnsresolver/... ./product-cli/... ./client/... ./test/integration/... ./test/e2e/util/... ./test/util/... ./availability-prober/... ./konnectivity-socks5-proxy/... ./konnectivity-https-proxy/... ./kubernetes-default-proxy/... ./kubevirtexternalinfra/... ./etcd-defrag/... ./etcd-backup/... ./etcd-recovery/... ./etcd-upload/... ./kas-bootstrap/... ./sharedingress-config-generator/... ./sync-fg-configmap/... ./sync-global-pullsecret/... ./token-minter/... env: - GOCACHE: /tmp/go-build-cache GOMODCACHE: /tmp/go-mod-cache steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -86,12 +85,7 @@ jobs: with: go-version-file: go.mod cache: false - - name: Warm Go build cache from EFS - run: | - if [ -d /cache/go-build ]; then - mkdir -p /tmp/go-build-cache - cp -a /cache/go-build/. /tmp/go-build-cache/ - fi + - uses: ./.github/actions/warm-go-cache - name: Run tests run: make test-shard TEST_PACKAGES="${{ matrix.packages }}" COVER_PROFILE="cover-${{ matrix.shard }}.out" - name: Upload to Codecov From 468f9ab9d71016a6ce14ac8471571b6f28983590 Mon Sep 17 00:00:00 2001 From: vismishr Date: Thu, 14 May 2026 20:29:01 +0530 Subject: [PATCH 4/4] ci(unit-tests): add copy timeout and declare GOCACHE at job level Add timeout 120 to the EFS cache copy in the composite action to guard against stale NFS handles blocking the entire job. Restore GOCACHE in the job-level env block so the cache path is visible at a glance and safe against step reordering. Commit-Message-Assisted-by: Claude --- .github/actions/warm-go-cache/action.yaml | 2 +- .github/workflows/test-reusable.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/warm-go-cache/action.yaml b/.github/actions/warm-go-cache/action.yaml index e6738ae48ca..8b4a192314c 100644 --- a/.github/actions/warm-go-cache/action.yaml +++ b/.github/actions/warm-go-cache/action.yaml @@ -8,6 +8,6 @@ runs: echo "GOCACHE=/tmp/go-build-cache" >> "$GITHUB_ENV" if [ -d /cache/go-build ]; then mkdir -p /tmp/go-build-cache && \ - cp -a /cache/go-build/. /tmp/go-build-cache/ || \ + timeout 120 cp -a /cache/go-build/. /tmp/go-build-cache/ || \ echo "Warning: failed to copy EFS cache, proceeding without cache" fi diff --git a/.github/workflows/test-reusable.yaml b/.github/workflows/test-reusable.yaml index c5af0a57b53..4f86dd1919d 100644 --- a/.github/workflows/test-reusable.yaml +++ b/.github/workflows/test-reusable.yaml @@ -73,6 +73,7 @@ jobs: - shard: other packages: ./karpenter-operator/... ./control-plane-pki-operator/... ./contrib/... ./ignition-server/... ./pkg/... ./dnsresolver/... ./product-cli/... ./client/... ./test/integration/... ./test/e2e/util/... ./test/util/... ./availability-prober/... ./konnectivity-socks5-proxy/... ./konnectivity-https-proxy/... ./kubernetes-default-proxy/... ./kubevirtexternalinfra/... ./etcd-defrag/... ./etcd-backup/... ./etcd-recovery/... ./etcd-upload/... ./kas-bootstrap/... ./sharedingress-config-generator/... ./sync-fg-configmap/... ./sync-global-pullsecret/... ./token-minter/... env: + GOCACHE: /tmp/go-build-cache GOMODCACHE: /tmp/go-mod-cache steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2