[Infra] CircleCI config cleanup and consolidation - #26226
Conversation
- Remove mypy_linting job (GHA test-linting.yml already runs this) - Remove three redundant "Install curl" apt-get steps (curl is already present on the ubuntu-2204 machine image and used successfully earlier in each affected job) - Dedupe langfuse_logging_unit_tests filter block (6x copy of the same two branch filters collapsed to 1) - Pin all docker image references by @sha256 digest so builds stay reproducible when upstream tags are updated: cimg/python:3.9, 3.11, 3.12, 3.12-browsers, 3.13.1, cimg/node:20.19, cimg/postgres:16.0, and postgres:14 used via docker run Net: -62 lines, 49 image references pinned.
Add a single install_uv command in the commands: section that encodes the uv version (0.10.9) and its SHA256 in one place, then replace all 42 inline curl|sha256|install blocks across every job that needs uv. setup_litellm_test_deps now calls install_uv too, so the shared test-dep bootstrap goes through the same path. Bumping uv version or SHA is now a one-line change instead of 43. Net: -203 lines.
Add a start_postgres command parameterized on db_name (default circle_test) that runs the postgres-db container and waits for port 5432 to accept connections. Replace all 11 inline docker run / wait_for_service blocks with a single - start_postgres call. The helm chart test overrides db_name to litellm_test; everything else uses the default. One of the 11 sites previously used a bespoke pg_isready loop instead of wait_for_service; it now goes through the same TCP-probe path everyone else uses, which is sufficient for test ordering purposes. Net: -112 lines.
Docker-executor jobs: - Consolidate base images on cimg/python:3.12. Jobs previously on 3.11 (26 jobs), 3.9 (1 historical: upload-coverage), and an incidental 3.13.1 (litellm_assistants_api_testing) now use 3.12. - installing_litellm_on_python_3_13 keeps cimg/python:3.13.1 as its explicit "latest Python supported" install-check matrix job. Machine-executor jobs: - Delete the miniconda install step from 10 jobs. uv now manages Python directly: uv sync --python 3.12 auto-downloads a python-build-standalone interpreter if the ubuntu-2204 base image's default python doesn't match. - Remove 37 "if [ -f conda.sh ]; then conda activate myenv" wrappers and 2 unconditional conda activate blocks left behind from the conda days. - proxy_build_from_pip_tests keeps its 3.13 target (it was conda create -n myenv python=3.13) via uv sync --python 3.13. Net: -301 lines.
…ine image
Follow-up cleanup after an independent review pass surfaced a few
loose ends:
- Delete a 6x-duplicated filter block in litellm_mapped_tests_proxy_part2
(same kind of copy-paste residue we fixed earlier in
langfuse_logging_unit_tests).
- Delete the empty "Install Semgrep" run step in the semgrep job — the
command body was empty because semgrep is installed on-demand via
uv tool run in the next step.
- Standardize machine-executor image: one job was on ubuntu-2204:2023.10.1
while build_docker_database_image was already on ubuntu-2204:2024.04.1.
Bumped everything to 2024.04.1.
- Remove the legacy "version: 2" inside the workflows: block — CircleCI
2.1 top-level already declares the version.
- Drop `{{ checksum ".circleci/config.yml" }}` from cache keys (13 sites).
It was busting the cache on every unrelated config edit; the uv.lock
checksum alone is the right dependency cache key.
- Add partial-restore fallbacks to every restore_cache with a single
templated key (10 sites). Jobs now fall back to the latest cache with
a matching prefix if the exact uv.lock hash isn't cached yet.
Net: -14 lines.
Greptile SummaryThis PR consolidates the CircleCI config from 3,601 to 2,934 lines by introducing two reusable commands ( Confidence Score: 5/5Safe to merge — all remaining findings are P2 style/cleanup observations that do not block correctness. The PR is a purely mechanical infrastructure refactor with no logic changes to application code. All comments are P2: a pre-existing cache path mismatch in two router jobs, and a Python version downgrade for the assistants API job that the author has explicitly acknowledged as intentional. No security issues, no data-path changes, and no test regressions are introduced. .circleci/config.yml — specifically the litellm_router_testing/litellm_router_unit_testing cache path and the litellm_assistants_api_testing Python downgrade.
|
| Filename | Overview |
|---|---|
| .circleci/config.yml | Large infrastructure cleanup: adds reusable install_uv and start_postgres commands, pins all Docker images by SHA256 digest, standardizes Python to 3.12, removes miniconda, drops mypy_linting job, improves cache keys, and removes duplicate filter entries — net −677 lines |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
subgraph commands["Reusable Commands (new)"]
IU["install_uv\ncurl install.sh → sha256sum check\n→ UV_NO_MODIFY_PATH sh\n→ $BASH_ENV PATH"]
SP["start_postgres\ndocker run postgres:14@sha256\n→ wait_for_service tcp://localhost:5432"]
end
subgraph docker_jobs["Docker Executor Jobs"]
DJ["43 jobs\ncimg/python:3.12@sha256\nor 3.13.1@sha256 (compat matrix)"]
end
subgraph machine_jobs["Machine Executor Jobs"]
MJ["8 jobs\nubuntu-2204:2024.04.1\nuv sync --python 3.12/3.13\n(no miniconda)"]
end
subgraph cache["Cache Keys"]
CK["v*-deps-checksum uv.lock\n+ partial fallback v*-deps-\n(config.yml removed from key)"]
end
IU --> DJ
IU --> MJ
SP --> MJ
CK --> DJ
CK --> MJ
Comments Outside Diff (1)
-
.circleci/config.yml, line 462-475 (link)Cache path mismatch in router testing jobs
litellm_router_testingandlitellm_router_unit_testingboth persistsave_cache: paths: /home/circleci/.pyenv, but dependency installation now usesuv sync --frozen --python 3.12, which writes packages to.venv(project root) and~/.cache/uv, not~/.pyenv. The cached path is irrelevant to uv, so these jobs will always perform a cold install. This was a pre-existing issue that the PR left unaddressed; the fix would be to save./.venvor~/.cache/uvinstead.
Reviews (1): Last reviewed commit: "[Infra] CCI config cleanup — dead step, ..." | Re-trigger Greptile
| steps: | ||
| - checkout | ||
| - setup_google_dns | ||
| - install_uv |
There was a problem hiding this comment.
Silent Python version downgrade for assistants API tests
litellm_assistants_api_testing was previously pinned to cimg/python:3.13.1 and is now running on cimg/python:3.12. If any test in this job exercised Python-version-specific behavior (type narrowing, asyncio changes, exception group syntax, etc.), those assertions now run one minor version back without a corresponding installing_litellm_on_python_3_13 equivalent. The PR description labels this change "incidental," but it is a downgrade, not an upgrade — worth confirming the assistants API test suite has no 3.13-specific expectations.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…ab13f [Infra] CircleCI config cleanup and consolidation
Relevant issues
Summary
Problem
The CircleCI config had grown to 3,601 lines with significant duplication and drift:
uvinstaller block (curl | sha256 | sh, 6 lines) was copy-pasted in 43 places, with the version string and SHA256 hardcoded in every copy.docker run ... postgres:14+wait_for_serviceblock was copy-pasted in 11 places.uv sync'd into that environment.cimg/python:3.12).mypy_lintingjob duplicated a check that GitHub Actions'test-linting.ymlalready runs.Install curlsteps even though curl is already on the base image.{{ checksum ".circleci/config.yml" }}, which busts the cache on every unrelated config edit.Fix
Five commits, one per change class, so review is navigable even though the PR is large:
mypy_linting+ 3×Install curl+ dedup one filter block. Append@sha256:<digest>to everycimg/*andpostgres:14reference so upstream tag moves can't silently change what runs.install_uvreusable command and migrate all call sites — one command defines uv 0.10.9 + SHA256 in one place. All 43 inline install blocks replaced with- install_uv.start_postgresreusable command and migrate call sites — parameterized ondb_name(defaultcircle_test, override tolitellm_testfor the helm job). All 11 inlinedocker run+wait_for_servicepairs collapsed into- start_postgres.cimg/python:3.11tocimg/python:3.12; one incidental 3.13.1 and one historical 3.9 image similarly consolidated.installing_litellm_on_python_3_13keeps 3.13.1 as its explicit compat matrix. Machine-executor jobs drop the miniconda install entirely and useuv sync --python 3.12, which auto-downloads a python-build-standalone interpreter when needed.Install Semgreprun step, bump the remainingubuntu-2204:2023.10.1machine images to2024.04.1(already used bybuild_docker_database_image), remove the legacyversion: 2insideworkflows:, dropconfig.ymlchecksum from cache keys, and add partial-restore fallbacks for graceful cache degradation.Changes
Net −677 lines (3,601 → 2,934). Two new reusable commands, one uv install definition instead of 43, one postgres-start definition instead of 11, one Python default instead of five.
Testing
Behavioral surface is unchanged: same jobs run the same tests on the same triggers. The mechanical changes are covered by running the full CCI pipeline on this PR.
First-run watchpoints:
uv sync --python 3.12, which downloads a python-build-standalone interpreter on first use. Expect a ~3–5s one-time download per cold cache.proxy_build_from_pip_testsretains Python 3.13 viauv sync --python 3.13(wasconda create python=3.13).pg_isreadyloop instead ofwait_for_service; now goes through the shared TCP probe path. Functionally equivalent for test ordering.Type
🚄 Infrastructure
🧹 Refactoring