Skip to content

fix(ci): key E2E venv cache on the full Python version - #2333

Open
anishmehta24 wants to merge 1 commit into
data-privacy-stack:mainfrom
anishmehta24:fix/ci-e2e-cache-python-version
Open

anishmehta24 wants to merge 1 commit into
data-privacy-stack:mainfrom
anishmehta24:fix/ci-e2e-cache-python-version

Conversation

@anishmehta24

Copy link
Copy Markdown
Contributor

Change Description

Both E2E jobs cache e2e-tests/env under a key that only has the OS, platform and the requirements hash. A venv's bin/python is a symlink to the exact interpreter that created it, while setup-python with '3.10' installs whatever 3.10 patch release the runner image has. When a cache saved on one patch release is restored on another, the link dangles and python -m venv env fails before any test runs.

This happened on the amd64 E2E job in #2331 (job 112786554063):

Successfully set up CPython (3.10.21)
Cache restored from key: Linux-linux/amd64-local-e2e-3ec4fd07...
Error: [Errno 2] No such file or directory: '/home/runner/work/presidio/presidio/e2e-tests/env/bin/python'

That cache entry had been saved by a runner on 3.10.22 (run 37551204723). Re-running the job does not help while the same entry keeps being restored.

The fix gives both Set up Python steps an id and adds steps.setup-python.outputs.python-version (the full version, e.g. 3.10.21) to the cache key and the restore-key prefix. A cached venv is then only restored onto the interpreter it was built with. When the runner image moves to a new patch release, the first run misses the cache and rebuilds it.

Issue reference

No issue. Found while looking into the red E2E (amd64) check on #2331.

Checklist

  • I have reviewed the contribution guidelines
  • I agree to follow this project's Code of Conduct
  • I confirm that I have the right to submit this contribution and that it does not knowingly contain proprietary or confidential code.
  • My code includes unit tests
  • All unit tests and lint checks pass locally
  • My PR contains documentation updates / additions if required

CI-only change, so no unit tests. actionlint 1.7.7 on ci.yml reports only the ubuntu-slim runner-label warnings that main already has. The local E2E jobs on this PR exercise the new keys.

AI assistance (Claude Code) was used for this change.

The E2E cache stores e2e-tests/env, whose bin/python links to the exact
CPython the runner had when the cache was saved. setup-python resolves
'3.10' to whatever patch version the runner image has, so a cache saved
on 3.10.22 and restored on 3.10.21 leaves a dangling interpreter and
'python -m venv env' fails before any test runs.
Copilot AI balanced review requested due to automatic review settings October 7, 2026 15:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants