Skip to content

Commit 6cc0042

Browse files
authored
Fix cache warmer: add Windows runner, timestamp-based cache keys (#1395)
## Summary Two fixes for the forked PR dependency cache: 1. **Add Windows runner to warmer matrix.** GitHub Actions cache is OS-scoped — a cache saved on Linux cannot be restored on Windows. The warmer must run on both OS. 2. **Timestamp-based cache keys.** GitHub caches are immutable (can't overwrite). Previously required manual deletion before re-running warmer. Now uses key format `maven-deps-{timestamp}-{hash}`, so each run creates a new entry. The restore step uses prefix `maven-deps-` to match the latest. Old entries auto-expire after 7 days. Also runs exact same Maven commands as PR CI workflows (8 steps) to ensure all plugins are cached. ## Test plan - [ ] Trigger warmer from this branch — verify both Linux and Windows jobs pass - [ ] After merge: trigger warmer on main, re-run PR #1371 CI NO_CHANGELOG=true This pull request was AI-assisted by Isaac. Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
1 parent 2fd7949 commit 6cc0042

1 file changed

Lines changed: 24 additions & 6 deletions

File tree

.github/workflows/warmMavenCache.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ permissions:
2929

3030
jobs:
3131
warm-cache:
32-
# Run on Linux only. Maven repository contents (JARs/POMs) are platform-independent.
33-
# Windows forked PRs restore this same cache via the restore-keys prefix match.
34-
# Note: Windows runners in databricks-protected-runner-group lack bash, which
35-
# is required for the OIDC token exchange scripts.
32+
# Run on both Linux and Windows. GitHub Actions cache is OS-scoped —
33+
# a cache saved on Linux cannot be restored on Windows and vice versa.
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
github-runner: [linux-ubuntu-latest, windows-server-latest]
3638
runs-on:
3739
group: databricks-protected-runner-group
38-
labels: linux-ubuntu-latest
40+
labels: ${{ matrix.github-runner }}
3941

4042
steps:
4143
- name: Set up JDK
@@ -44,6 +46,10 @@ jobs:
4446
java-version: 21
4547
distribution: 'adopt'
4648

49+
- name: Enable long paths (Windows)
50+
if: runner.os == 'Windows'
51+
run: git config --system core.longpaths true
52+
4753
# If PR number provided, checkout only pom.xml files from the fork (security: no source code)
4854
- name: Checkout PR pom.xml files (sparse)
4955
if: inputs.pr_number != ''
@@ -176,8 +182,20 @@ jobs:
176182
find ~/.m2/repository -name '_remote.repositories' -exec sed -i 's/jfrog-central/central/g' {} \;
177183
echo "Normalized ${COUNT} _remote.repositories markers (jfrog-central -> central)"
178184
185+
- name: Generate cache key with timestamp
186+
id: cache-key
187+
shell: bash
188+
run: |
189+
# Include timestamp so each warmer run creates a new cache entry
190+
# (GitHub Actions caches are immutable — can't overwrite existing keys).
191+
# The restore step uses prefix 'maven-deps-' to match the latest entry.
192+
# Old entries auto-expire after 7 days of no access.
193+
TIMESTAMP=$(date -u +%Y%m%d%H%M%S)
194+
POM_HASH=${{ hashFiles('**/pom.xml') }}
195+
echo "key=maven-deps-${TIMESTAMP}-${POM_HASH}" >> $GITHUB_OUTPUT
196+
179197
- name: Save Maven dependency cache
180198
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
181199
with:
182200
path: ~/.m2/repository
183-
key: maven-deps-${{ hashFiles('**/pom.xml') }}
201+
key: ${{ steps.cache-key.outputs.key }}

0 commit comments

Comments
 (0)