Repository navigation
ci: cache ingestion Python venv in setup-openmetadata-test-environment - #30350
Conversation
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
Two P1 comments on #30350: 1. "Resolved Interpreter Missing From Key" — setup-python can resolve "3.10" to a different patch install after a runner-image update. The old venv's shebangs point at a tool-cache path that no longer exists, and the existing "did activate exist?" check silently reuses it. Fix: capture the resolved patch version via `id: setup-python` and use `steps.setup-python.outputs.python-version` in the cache key. Also validate `env/bin/python --version` in Generate Models and rebuild the venv from scratch if it can't run, so a stale restore fails loud rather than as an opaque shebang error deeper in the step. 2. "Fallback Restores Obsolete Dependencies" — the `restore-keys` prefix fallback would restore an older venv when the exact key misses, and `uv pip install` only adds packages, never removes ones dropped from the manifest. Tests could then silently import a package the manifest no longer declares. Fix: drop the restore-keys line entirely. Cache miss now guarantees a fresh install, so the venv can never drift from the current manifest. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@greptile-apps thanks — both P1s addressed in 629495f:
|
|
Both fixes look correct. The implementation is clean:
Both P1s fully addressed. LGTM. |
| uses: actions/cache@v4 | ||
| with: | ||
| path: env | ||
| key: ${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-om-venv-${{ hashFiles('ingestion/setup.py', 'ingestion/pyproject.toml', '.github/actions/setup-openmetadata-test-environment/action.yml') }} |
There was a problem hiding this comment.
Separate dependency-mode caches The same key is used when
install-test-dependencies is either true or false, although those paths install different package sets. If a full-dependency job creates the immutable cache first, a lighter job restores packages it intentionally skipped. That job can then pass only with a warm cache while failing in a clean environment. Include the dependency-install mode in the key so each configuration restores only its own environment.
| key: ${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-om-venv-${{ hashFiles('ingestion/setup.py', 'ingestion/pyproject.toml', '.github/actions/setup-openmetadata-test-environment/action.yml') }} | |
| key: ${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-testdeps-${{ inputs.install-test-dependencies }}-om-venv-${{ hashFiles('ingestion/setup.py', 'ingestion/pyproject.toml', '.github/actions/setup-openmetadata-test-environment/action.yml') }} |
Code Review ✅ ApprovedCaches the ingestion Python virtual environment in the shared test setup action with a pinned resolved version and exact keys. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
Summary
.github/actions/setup-openmetadata-test-environmentbuilds a fresh Python venv and runsuv pip install ingestion[dev](plus, for py-tests workflows,[all]/[test]and extras). That's ~2–4 min per shard, every run.env/venv withactions/cache@v4, keyed on runner OS + python-version +hashFilesofingestion/setup.py,ingestion/pyproject.toml, and the action file itself.How it works
Generate Modelsnow only runspython3 -m venv envifenv/isn't already restored.uv pip installskips already-satisfied packages on cache hit, so they become fast no-ops. This keeps the change self-contained and safe for every consumer of this action regardless of which install steps they hit.Files changed
.github/actions/setup-openmetadata-test-environment/action.ymlImpact estimate
On postgresql-e2e run 29907894464, the
Generate Models+Install Python Dependenciessteps combined for ~5–8 min per shard. Cache hit reduces both to ~10–30 s. That's ~2–4 min saved per shard × 7 shards = ~15–25 runner-minutes per run. All Playwright / py-tests / py-cli-e2e workflows using this action benefit.Test plan
cache-hit=falseand saves at end of job.Generate Models'suv pip installbecomes near-instant.Follow-ups (out of scope for this PR)
Install Python Dependenciesfor Playwright workflows), the cache benefit is realized on the biggest step. This PR helps both before and after that lands.🤖 Generated with Claude Code
Greptile Summary
This PR caches the ingestion Python environment used by the shared test setup action. The main changes are:
env/using the runner OS, resolved Python version, and dependency manifests.Confidence Score: 4/5
The cache should be partitioned by dependency mode before merging.
Files Needing Attention: .github/actions/setup-openmetadata-test-environment/action.yml
Important Files Changed
Reviews (6): Last reviewed commit: "Merge branch 'main' into ci/cache-python..." | Re-trigger Greptile