Skip to content

[ci] Resolve packages through the mirror in the manylinux image too - #65576

Merged
elliot-barn merged 1 commit into
elliot-barn/pypi-mirror-integrationfrom
elliot-barn/pypi-mirror-manylinux
Aug 19, 2026
Merged

elliot-barn merged 1 commit into
elliot-barn/pypi-mirror-integrationfrom
elliot-barn/pypi-mirror-manylinux

Conversation

@elliot-barn

Copy link
Copy Markdown
Collaborator

Stacked on #65571 — base branch is elliot-barn/pypi-mirror-integration, since the proxy and the profile.d script land there. Review after that one; GitHub will retarget this to master when it merges.

Description

Steps whose job_env is manylinux-x86_64 had none of the mirror wiring, because it lived only in forge.Dockerfile. Audited on premerge 72104:

Step runs in Mirror used? Examples
forge yes — probe logs the verdict, zero direct PyPI fetches reef tooling, lints, test-rules, ml: train minimal, serve: wheel tests
manylinux-x86_64 no wiring at all build: raydepsets: compile all dependencies, build: jar, wheel builds

That gap is what failed the build: uv fetched numpy-2.2.6-…whl.metadata straight from files.pythonhosted.org and took a 502, with no index configured to route it anywhere else (pypi/support#11895).

What changed

  • ci/install_pypi_proxy.sh — the install, extracted so forge and manylinux share it instead of carrying two copies of the same twenty lines. The next image that needs it adds one RUN.
  • ci/docker/manylinux-retag.Dockerfile — installs the proxy and the profile.d script. Steps run under bash -elic, so it is sourced there exactly as in forge; the probe, the mode selection and the fail-open path are unchanged.
  • The interpreter is discovered, not named: manylinux ships a set under /opt/python, so the Dockerfile picks the newest that satisfies the proxy's >=3.11 requirement and fails loudly (listing what it found) if there is none. That keeps working when the base image's interpreter set moves. The image's default python is untouched and the venv stays in /opt/pypiproxy.
  • Both wanda specs gain the files in srcs, without which the bind mounts have nothing to mount.

What this does not cover

docker build — the wanda: wheel py3.* steps still fetch from PyPI directly, because BuildKit RUN steps do not inherit the step container's environment. Those five fetches per build are pip's isolated build environment (setuptools, cython, wheel, pip, packaging), unpinned because python/ has no pyproject.toml. Two follow-ups are possible there and neither belongs in this PR: passing the index as a build arg, which needs a stable address so wanda's content-addressed cache key does not churn per job, or --no-build-isolation, which removes those fetches outright.

Testing

  • bash -n on the installer and on the new RUN block; pre-commit (shellcheck, semgrep, whitespace) clean over every changed file.
  • Not verified locally: the image build itself, which needs the manylinux base and a wanda run. The interpreter discovery is written to fail loudly rather than silently skip, so a wrong assumption about /opt/python shows up as a failed image build with the directory listing attached, not as a silently unwired image.
  • The real check is a build on this branch: manylinux steps should log pypi index: … the way forge steps already do.

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

Steps whose job_env is manylinux-x86_64 had none of the mirror wiring, because it
lived only in forge. That is not a cosmetic gap: `build: raydepsets: compile all
dependencies` runs there, and on premerge 72104 it was the one job that failed, with
uv fetching numpy-2.2.6's metadata straight from files.pythonhosted.org and taking a
502. The same image serves `build: jar` and the wheel builds.

Audited on that build: every forge step logged the probe and resolved through the
mirror; every manylinux step logged nothing at all.

The install moves into ci/install_pypi_proxy.sh so the two images share it rather
than keeping two copies of the same twenty lines, and the next image that needs it
adds one RUN. manylinux ships several interpreters under /opt/python, so the caller
picks the newest satisfying the proxy's >=3.11 requirement instead of naming one,
which keeps working when the base image's set moves. The image's default python is
untouched, and the venv stays self-contained in /opt/pypiproxy.

Steps run under `bash -elic`, so the profile.d script this installs is sourced there
exactly as it is in forge; nothing about the probe or the fallback changes.

Signed-off-by: elliot-barn <[email protected]>
elliot-barn added a commit that referenced this pull request Aug 19, 2026
## Description

`ci/build/build-manylinux-wheel.sh` pins cython and setuptools into the
interpreter and then never uses them. `pip wheel` builds in an isolated
environment by default, and `python/` has no `pyproject.toml`, so pip
synthesizes a build system and fetches its own copies of `setuptools`,
`cython`, `wheel`, `pip` and `packaging` — unpinned.

Observed on premerge 72104, where every `wanda: wheel py3.*` job made
exactly those five requests and nothing else:

```
#22 5.755   Running command installing build dependencies
    Obtaining dependency information for setuptools>=40.8.0 from https://files.pythonhosted.org/...
    ... cython>=3.0.12, wheel, pip, packaging>=24.0
```

Two reasons to remove them rather than route them somewhere:

- **They are the only network fetches in that job, and they have no
mirror available.** These run inside `docker build`, where BuildKit
`RUN` steps do not inherit the step container's environment, so an index
configured for CI cannot reach them. That matters while
`files.pythonhosted.org` returns intermittent 502s (pypi/support#11895)
— one failed fetch fails a release wheel build.
- **Determinism.** The versions that build the release wheels are
currently whatever is newest that day, rather than the ones this script
deliberately pins two lines earlier.

`wheel` joins the pinned set because the isolated environment had been
providing it. setuptools 80.9.0 carries `bdist_wheel` itself, so that is
belt and braces rather than strictly required, and pinning it costs
nothing.

## Related issues

Upstream cause: pypi/support#11895. Independent of the CI mirror work in
#65571 and #65576 — this path cannot use a mirror at all, which is
precisely why it is worth eliminating the fetches instead.

Not a duplicate: `gh pr list --repo ray-project/ray --state open
--search "build-isolation"` and `"build-manylinux-wheel"` return
nothing.

## Testing

- `bash -n` and `pre-commit` (shellcheck, semgrep) clean.
- The behaviour is verified by construction from the build log above:
the five packages pip fetched are exactly the ones the isolated
environment builds, and cython/setuptools are already installed by the
preceding line at the versions `setup.py` requires
(`setup_requires=["cython >= 3.0.12", ...]` against a pinned
`cython==3.0.12`).
- Not verified locally: a full manylinux wheel build, which needs the
manylinux image and a Bazel build of the core. The failure mode if a
build dependency is genuinely missing is loud and immediate — `pip
wheel` errors during the build rather than producing a subtly different
wheel.
- The check on this PR is the `wanda: wheel py3.*` jobs: they should
produce wheels with **zero** `files.pythonhosted.org` requests, where
today there are five per job.

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

---------

Signed-off-by: elliot-barn <[email protected]>
@elliot-barn
elliot-barn marked this pull request as ready for review August 19, 2026 02:36
@elliot-barn
elliot-barn requested review from a team as code owners August 19, 2026 02:36
@elliot-barn
elliot-barn merged commit 815467d into elliot-barn/pypi-mirror-integration Aug 19, 2026
3 of 4 checks passed
@elliot-barn
elliot-barn deleted the elliot-barn/pypi-mirror-manylinux branch August 19, 2026 02:36

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request refactors the PyPI index proxy installation by moving the setup logic into a shared script, ci/install_pypi_proxy.sh, and integrates it into both the forge and manylinux Dockerfiles. The review feedback suggests dynamically discovering compatible Python versions (>= 3.11) in the manylinux Dockerfile rather than hardcoding them, and explicitly setting read/execute permissions on the /opt/pypiproxy directory to prevent potential permission issues for non-root users.

Comment on lines +34 to +42
PROXY_PYTHON=""
for candidate in /opt/python/cp313-cp313/bin/python \
/opt/python/cp312-cp312/bin/python \
/opt/python/cp311-cp311/bin/python; do
if [[ -x "${candidate}" ]]; then
PROXY_PYTHON="${candidate}"
break
fi
done

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.

medium

Instead of hardcoding specific Python versions (which will require manual updates when newer Python versions like 3.14 are added to the manylinux image, or older ones are retired), we can dynamically discover the newest Python interpreter under /opt/python that is >= 3.11.

PROXY_PYTHON=""
for candidate in $(ls -d /opt/python/cp*/bin/python 2>/dev/null | sort -Vr); do
  if [[ -x "${candidate}" ]]; then
    if "${candidate}" -c 'import sys; sys.exit(0 if sys.version_info >= (3, 11) else 1)' 2>/dev/null; then
      PROXY_PYTHON="${candidate}"
      break
    fi
  fi
done

Comment thread ci/install_pypi_proxy.sh
"niquests==3.21.0" \
"starlette==1.6.0" \
"uvicorn==0.52.3"
cp pypi_index_proxy.py /opt/pypiproxy/pypi_index_proxy.py

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.

medium

Since the virtualenv /opt/pypiproxy is created by the root user during the Docker build, its files and directories might not be readable or executable by non-root users (such as the forge user or standard CI users) if the build environment has a restrictive umask. To prevent permission denied errors when starting the proxy, we should explicitly ensure that /opt/pypiproxy is readable and its directories/binaries are executable by all users.

Suggested change
cp pypi_index_proxy.py /opt/pypiproxy/pypi_index_proxy.py
cp pypi_index_proxy.py /opt/pypiproxy/pypi_index_proxy.py
chmod -R a+rX /opt/pypiproxy

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit a8ea14b. Configure here.

--mount=type=bind,source=ci/k8s/install-k8s-tools.sh,target=install-k8s-tools.sh \
--mount=type=bind,source=ci/pypi_index_proxy.py,target=pypi_index_proxy.py \
--mount=type=bind,source=ci/pypi_proxy_profile.sh,target=pypi_proxy_profile.sh \
--mount=type=bind,source=ci/install_pypi_proxy.sh,target=install_pypi_proxy.sh \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing aarch64 Wanda proxy srcs

High Severity

forge.Dockerfile is shared by x86_64 and aarch64 forge images and now bind-mounts ci/install_pypi_proxy.sh, but only forge.wanda.yaml gained that path in srcs. forge.aarch64.wanda.yaml still lists just install-k8s-tools.sh, so the aarch64 Wanda build has nothing to mount for the new install script and the image build fails.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a8ea14b. Configure here.

elliot-barn added a commit that referenced this pull request Aug 19, 2026
…65576)

**Stacked on #65571** — base branch is
`elliot-barn/pypi-mirror-integration`, since the proxy and the profile.d
script land there. Review after that one; GitHub will retarget this to
master when it merges.

## Description

Steps whose `job_env` is `manylinux-x86_64` had none of the mirror
wiring, because it lived only in `forge.Dockerfile`. Audited on premerge
72104:

| Step runs in | Mirror used? | Examples |
|---|---|---|
| forge | yes — probe logs the verdict, zero direct PyPI fetches | reef
tooling, lints, test-rules, `ml: train minimal`, `serve: wheel tests` |
| manylinux-x86_64 | **no wiring at all** | **`build: raydepsets:
compile all dependencies`**, `build: jar`, wheel builds |

That gap is what failed the build: uv fetched
`numpy-2.2.6-…whl.metadata` straight from `files.pythonhosted.org` and
took a 502, with no index configured to route it anywhere else
(pypi/support#11895).

## What changed

- `ci/install_pypi_proxy.sh` — the install, extracted so forge and
manylinux share it instead of carrying two copies of the same twenty
lines. The next image that needs it adds one `RUN`.
- `ci/docker/manylinux-retag.Dockerfile` — installs the proxy and the
`profile.d` script. Steps run under `bash -elic`, so it is sourced there
exactly as in forge; the probe, the mode selection and the fail-open
path are unchanged.
- The interpreter is **discovered, not named**: manylinux ships a set
under `/opt/python`, so the Dockerfile picks the newest that satisfies
the proxy's `>=3.11` requirement and fails loudly (listing what it
found) if there is none. That keeps working when the base image's
interpreter set moves. The image's default python is untouched and the
venv stays in `/opt/pypiproxy`.
- Both wanda specs gain the files in `srcs`, without which the bind
mounts have nothing to mount.

## What this does not cover

`docker build` — the `wanda: wheel py3.*` steps still fetch from PyPI
directly, because BuildKit `RUN` steps do not inherit the step
container's environment. Those five fetches per build are pip's
*isolated build environment* (`setuptools`, `cython`, `wheel`, `pip`,
`packaging`), unpinned because `python/` has no `pyproject.toml`. Two
follow-ups are possible there and neither belongs in this PR: passing
the index as a build arg, which needs a stable address so wanda's
content-addressed cache key does not churn per job, or
`--no-build-isolation`, which removes those fetches outright.

## Testing

- `bash -n` on the installer and on the new `RUN` block; `pre-commit`
(shellcheck, semgrep, whitespace) clean over every changed file.
- Not verified locally: the image build itself, which needs the
manylinux base and a wanda run. The interpreter discovery is written to
fail loudly rather than silently skip, so a wrong assumption about
`/opt/python` shows up as a failed image build with the directory
listing attached, not as a silently unwired image.
- The real check is a build on this branch: manylinux steps should log
`pypi index: …` the way forge steps already do.

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

Signed-off-by: Elliot Barnwell <[email protected]>
elliot-barn added a commit that referenced this pull request Aug 20, 2026
## Description

Docker builds are the one CI surface that cannot be pointed at a package
index by configuring the step: BuildKit `RUN` steps inherit nothing from
the environment of the process that started the build. On premerge 72104
that showed up as five direct `files.pythonhosted.org` fetches in every
`wanda: wheel py3.*` job, while every forge-based step in the same build
resolved elsewhere.

The only channel into a build is a build arg. This adds one on the four
roots of the CI image graph (`base.test`, `base.gpu`, `forge`,
`manylinux`) plus `ci/ray_ci/tests.env.Dockerfile`; children inherit it
through `ENV`.

**Safe for anyone building these images outside CI.** The arg is generic
and empty by default — nothing here names a host — and a build that
passes nothing resolves from `https://pypi.org/simple`, exactly as
today. The published images under `docker/` are untouched.

wanda resolves the value from `RAYCI_IMAGE_PIP_INDEX_URL` in the job
environment, so setting it is a CI-side decision rather than a repo one,
and unsetting it is a complete rollback with no code change.

## Caveat that gates turning it on

The value must be **stable across jobs**. Build args are part of wanda's
content-addressed cache key, so a per-job address would rebuild all 23
images on every build. A fixed hostname is fine; anything job-scoped is
not. It also has to be an index that works directly — pointing a build
at a metadata-only path would mirror the index and leave the artifacts
on the origin.

Until both hold, leaving the variable unset keeps this inert.

## Related issues

pypi/support#11895. Complements #65571 (steps) and #65576 (manylinux
steps); independent of #65577, which removes the build-time fetches from
the wheel builds rather than redirecting them — where that is possible
it is strictly better, since it needs no configuration at all.

Not a duplicate: no open PR touches these Dockerfiles' index
configuration.

## Testing

- `PYTHONPATH=.:release python -m pytest -q
ci/ray_ci/test_linux_tester_container.py
ci/ray_ci/test_linux_container.py` — 12 passed, including the argv
assertion for the new `--build-arg`.
- `pre-commit` clean over all 15 changed files.
- Not verified: an actual image build with the arg set, which needs a CI
job. The failure mode of a wrong value is a failed `pip install` during
the image build, not a silently mis-built image.

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

---------

Signed-off-by: elliot-barn <[email protected]>
Signed-off-by: Elliot Barnwell <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…ect#65577)

## Description

`ci/build/build-manylinux-wheel.sh` pins cython and setuptools into the
interpreter and then never uses them. `pip wheel` builds in an isolated
environment by default, and `python/` has no `pyproject.toml`, so pip
synthesizes a build system and fetches its own copies of `setuptools`,
`cython`, `wheel`, `pip` and `packaging` — unpinned.

Observed on premerge 72104, where every `wanda: wheel py3.*` job made
exactly those five requests and nothing else:

```
ray-project#22 5.755   Running command installing build dependencies
    Obtaining dependency information for setuptools>=40.8.0 from https://files.pythonhosted.org/...
    ... cython>=3.0.12, wheel, pip, packaging>=24.0
```

Two reasons to remove them rather than route them somewhere:

- **They are the only network fetches in that job, and they have no
mirror available.** These run inside `docker build`, where BuildKit
`RUN` steps do not inherit the step container's environment, so an index
configured for CI cannot reach them. That matters while
`files.pythonhosted.org` returns intermittent 502s (pypi/support#11895)
— one failed fetch fails a release wheel build.
- **Determinism.** The versions that build the release wheels are
currently whatever is newest that day, rather than the ones this script
deliberately pins two lines earlier.

`wheel` joins the pinned set because the isolated environment had been
providing it. setuptools 80.9.0 carries `bdist_wheel` itself, so that is
belt and braces rather than strictly required, and pinning it costs
nothing.

## Related issues

Upstream cause: pypi/support#11895. Independent of the CI mirror work in
ray-project#65571 and ray-project#65576 — this path cannot use a mirror at all, which is
precisely why it is worth eliminating the fetches instead.

Not a duplicate: `gh pr list --repo ray-project/ray --state open
--search "build-isolation"` and `"build-manylinux-wheel"` return
nothing.

## Testing

- `bash -n` and `pre-commit` (shellcheck, semgrep) clean.
- The behaviour is verified by construction from the build log above:
the five packages pip fetched are exactly the ones the isolated
environment builds, and cython/setuptools are already installed by the
preceding line at the versions `setup.py` requires
(`setup_requires=["cython >= 3.0.12", ...]` against a pinned
`cython==3.0.12`).
- Not verified locally: a full manylinux wheel build, which needs the
manylinux image and a Bazel build of the core. The failure mode if a
build dependency is genuinely missing is loud and immediate — `pip
wheel` errors during the build rather than producing a subtly different
wheel.
- The check on this PR is the `wanda: wheel py3.*` jobs: they should
produce wheels with **zero** `files.pythonhosted.org` requests, where
today there are five per job.

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

---------

Signed-off-by: elliot-barn <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
)

## Description

Docker builds are the one CI surface that cannot be pointed at a package
index by configuring the step: BuildKit `RUN` steps inherit nothing from
the environment of the process that started the build. On premerge 72104
that showed up as five direct `files.pythonhosted.org` fetches in every
`wanda: wheel py3.*` job, while every forge-based step in the same build
resolved elsewhere.

The only channel into a build is a build arg. This adds one on the four
roots of the CI image graph (`base.test`, `base.gpu`, `forge`,
`manylinux`) plus `ci/ray_ci/tests.env.Dockerfile`; children inherit it
through `ENV`.

**Safe for anyone building these images outside CI.** The arg is generic
and empty by default — nothing here names a host — and a build that
passes nothing resolves from `https://pypi.org/simple`, exactly as
today. The published images under `docker/` are untouched.

wanda resolves the value from `RAYCI_IMAGE_PIP_INDEX_URL` in the job
environment, so setting it is a CI-side decision rather than a repo one,
and unsetting it is a complete rollback with no code change.

## Caveat that gates turning it on

The value must be **stable across jobs**. Build args are part of wanda's
content-addressed cache key, so a per-job address would rebuild all 23
images on every build. A fixed hostname is fine; anything job-scoped is
not. It also has to be an index that works directly — pointing a build
at a metadata-only path would mirror the index and leave the artifacts
on the origin.

Until both hold, leaving the variable unset keeps this inert.

## Related issues

pypi/support#11895. Complements ray-project#65571 (steps) and ray-project#65576 (manylinux
steps); independent of ray-project#65577, which removes the build-time fetches from
the wheel builds rather than redirecting them — where that is possible
it is strictly better, since it needs no configuration at all.

Not a duplicate: no open PR touches these Dockerfiles' index
configuration.

## Testing

- `PYTHONPATH=.:release python -m pytest -q
ci/ray_ci/test_linux_tester_container.py
ci/ray_ci/test_linux_container.py` — 12 passed, including the argv
assertion for the new `--build-arg`.
- `pre-commit` clean over all 15 changed files.
- Not verified: an actual image build with the arg set, which needs a CI
job. The failure mode of a wrong value is a failed `pip install` during
the image build, not a silently mis-built image.

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

---------

Signed-off-by: elliot-barn <[email protected]>
Signed-off-by: Elliot Barnwell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant