Skip to content

Commit f90efac

Browse files
ci(warm-deps): key cache on pristine lock hash so fork restores hit (#831) (#850)
The warmer computed its cache key with hashFiles('**/poetry.lock') AFTER setup-poetry ran `poetry lock`, which rewrites poetry.lock in place. The PR jobs' restore-deps hashes the PRISTINE committed poetry.lock (it runs before setup-poetry). The two hashes therefore never matched — a fork PR looked up e.g. forkvenv-...-46e4852b... while the warmer had saved forkvenv-...-143cf261... so every fork restore missed and fell back to the JFrog path (which forks can't auth to), failing all jobs. Capture the pristine lock hash in a step BEFORE setup-poetry and use that for the cache key, matching what restore-deps computes. Found via the fork verification PR #849 (all Unit Tests legs missed the cache). Refs #831 Co-authored-by: Isaac Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
1 parent 54e479c commit f90efac

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

.github/workflows/warm-deps-cache.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,18 @@ jobs:
129129
git checkout FETCH_HEAD -- poetry.lock pyproject.toml
130130
echo "Overlaid poetry.lock / pyproject.toml from the fork branch."
131131
132+
# Capture the lock hash from the PRISTINE, committed poetry.lock BEFORE
133+
# setup-poetry runs (it calls `poetry lock`, which rewrites poetry.lock
134+
# in place and changes hashFiles's result). restore-deps in the PR jobs
135+
# hashes the pristine lock, so the warmer MUST hash it at the same point
136+
# or the keys never match and every fork restore misses.
137+
- name: Capture pristine lock hash
138+
id: lockhash
139+
run: |
140+
set -euo pipefail
141+
echo "value=${{ hashFiles('**/poetry.lock') }}" >> "$GITHUB_OUTPUT"
142+
echo "Pristine poetry.lock hash: ${{ hashFiles('**/poetry.lock') }}"
143+
132144
- name: Install Kerberos system dependencies
133145
if: matrix.extras == 'pyarrow' || matrix.extras == 'kernel'
134146
run: |
@@ -186,7 +198,9 @@ jobs:
186198
run: |
187199
set -euo pipefail
188200
TIMESTAMP=$(date -u +%Y%m%d%H%M%S)
189-
LOCK_HASH="${{ hashFiles('**/poetry.lock') }}"
201+
# Pristine hash captured BEFORE setup-poetry's `poetry lock` mutated
202+
# the file — matches what restore-deps computes in the PR jobs.
203+
LOCK_HASH="${{ steps.lockhash.outputs.value }}"
190204
PY="${{ matrix.python-version }}"
191205
DEP="${{ matrix.dependency-version }}"
192206
EXTRAS="${{ matrix.extras || 'base' }}"

0 commit comments

Comments
 (0)