Skip to content

Upload the wheels to R2 from a workflow_run workflow - #9765

Merged
atalman merged 1 commit into
pytorch:mainfrom
atalman:r2_upload_workflow
Nov 20, 2026
Merged

atalman merged 1 commit into
pytorch:mainfrom
atalman:r2_upload_workflow

Conversation

@atalman

@atalman atalman commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

The five wheel workflows passed the repo-level secrets.R2_* to test-infra's reusable build workflows, so a workflow in a pull request that gets a ciflow tag could read them (pytorch/FBGEMM#6852 showed this in FBGEMM; the same bot and secrets setup applies here). A reusable workflow does not see the caller's environment secrets and a calling job cannot set environment:, so the R2 upload moves to its own workflow, as in pytorch/audio#4244 and pytorch/FBGEMM#6855.

upload_wheels_r2.yml runs on workflow_run for the five wheel builds. A workflow_run workflow always comes from main. It only acts when the build was a push to nightly in this repo. get-matrix reads the build matrix, which each build workflow now saves as the build-matrix artifact, and upload-r2 (environment: pytorchbot-env) downloads each wheel from the build run and copies it to R2 with the same steps as test-infra's _binary_upload.yml. The architecture in the artifact name follows what each build passes to that upload: x86_64, aarch64, x64 and arm64 for Windows, and none for macOS. I checked these against the artifacts of the 2026-11-19 nightly runs (for example pytorch_vision__3.11_cpu_aarch64, ..._cpu_x64, ...cpu_arm64 and pytorch_vision__3.11_cpu). The run is named after the build run it handled, and its summary links to it.

The build workflows no longer pass secrets:, so the R2 steps of the reusable upload skip and its S3 upload (an AWS role through OIDC) is unchanged.

DO NOT MERGE before the R2_ACCOUNT_ID, R2_ACCESS_KEY_ID and R2_SECRET_ACCESS_KEY secrets exist in the pytorchbot-env environment. Rollout:

  1. A repo admin adds the three secrets to pytorchbot-env (keep the repo-level copies).
  2. Merge this.
  3. Check that the next nightly run triggers "Upload wheels to R2" and that the wheels reach R2.
  4. A repo admin deletes the repo-level R2 secrets.

Not verified: a workflow_run workflow only runs once it is on main, so none of this has run in vision. pytorch/audio#4244 did run this design end to end, with the environment secrets, on 2026-11-19. The workflows parse with js-yaml.

Authored with Claude Code.

The five wheel workflows passed the repo-level secrets.R2_* to test-infra's
reusable build workflows, so a workflow in a pull request that gets a ciflow
tag could read them (pytorch/FBGEMM#6852 showed this in FBGEMM; the same bot
and secrets setup applies here). A reusable workflow does not see the caller's
environment secrets and a calling job cannot set environment:, so the R2 upload
moves to its own workflow, as in pytorch/audio#4244 and pytorch/FBGEMM#6855.

upload_wheels_r2.yml runs on workflow_run for the five wheel builds. A
workflow_run workflow always comes from main. It only acts when the build was a
push to nightly in this repo. get-matrix reads the build matrix, which each
build workflow now saves as the build-matrix artifact, and upload-r2
(environment: pytorchbot-env) downloads each wheel from the build run and
copies it to R2 with the same steps as test-infra's _binary_upload.yml. The
architecture in the artifact name follows what each build passes to that upload:
x86_64, aarch64, x64 and arm64 for Windows, and none for macOS. I checked these
against the artifacts of the 2026-11-19 nightly runs (for example
pytorch_vision__3.11_cpu_aarch64, ..._cpu_x64, ..._cpu_arm64 and
pytorch_vision__3.11_cpu_). The run is named after the build run it handled,
and its summary links to it.

The build workflows no longer pass secrets:, so the R2 steps of the reusable
upload skip and its S3 upload (an AWS role through OIDC) is unchanged.

DO NOT MERGE before the R2_ACCOUNT_ID, R2_ACCESS_KEY_ID and
R2_SECRET_ACCESS_KEY secrets exist in the pytorchbot-env environment. Rollout:
1. A repo admin adds the three secrets to pytorchbot-env (keep the repo-level
   copies).
2. Merge this.
3. Check that the next nightly run triggers "Upload wheels to R2" and that the
   wheels reach R2.
4. A repo admin deletes the repo-level R2 secrets.

Not verified: a workflow_run workflow only runs once it is on main, so none of
this has run in vision. pytorch/audio#4244 did run this design end to end, with
the environment secrets, on 2026-11-19. The workflows parse with js-yaml.

Authored with Claude Code.
@pytorch-bot

pytorch-bot Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/9765

Note: Links to docs will display an error until the docs builds have been completed.

❌ 9 New Failures

As of commit 55ad56e with merge base 4260301 (image):

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the cla signed label Nov 20, 2026
@atalman
atalman merged commit 4174d08 into pytorch:main Nov 20, 2026
71 of 80 checks passed
atalman added a commit to pytorch/executorch that referenced this pull request Nov 21, 2026
Executorch wheels are not uploaded to R2 today. test-infra's reusable
build workflows (`_binary_upload.yml`) upload to R2 only when the caller
passes the R2 secrets, and none of executorch's build workflows does.
`pytorch/executorch` is already on the R2 allowlist there, so only the
secrets are missing.

Passing the repo-level `secrets.R2_*` from the build workflows would let
a workflow in a pull request that gets a ciflow tag read them
(pytorch/FBGEMM#6852 showed this in FBGEMM). A reusable workflow does
not see the caller's environment secrets, and a calling job cannot set
`environment:`, so the R2 upload gets its own workflow, as in
pytorch/vision#9765, pytorch/audio#4244 and pytorch/FBGEMM#6855.

`upload_wheels_r2.yml` runs on `workflow_run` for the seven wheel
builds: Linux, Aarch64 Linux, Linux CUDA, Aarch64 Linux CUDA, Windows,
Windows CUDA and macOS. A `workflow_run` workflow always comes from
main. It only acts when the build was a push to `nightly` in this repo.
`get-matrix` reads the build matrix, which each build workflow now saves
as the `build-matrix` artifact (the filtered matrix for the CUDA ones),
and `upload-r2` (`environment: pytorchbot-env`) downloads each wheel
from the build run and copies it to R2 with the same steps as
test-infra's `_binary_upload.yml`. The run is named after the build run
it handled, and its summary links to it.

The architecture in the artifact name follows what each build passes to
the upload: `x86_64` for Linux, `aarch64` for Aarch64 Linux, `x64` for
Windows, none for macOS. I checked these, and the CUDA names, against
the artifacts of the 2026-11-20 nightly runs (for example
`pytorch_executorch__3.11_cpu_x86_64`, `..._cu132_aarch64`,
`..._cpu_x64`, `pytorch_executorch__3.11_cpu_`).

Not included: the two Native wheel workflows. They pass `trigger-event:
development`, so they never upload, and the comment there says
executorch-native is not published yet.

The build workflows' own S3 upload (an AWS role through OIDC) is
unchanged. The only change to them is the `save-build-matrix` job.

**DO NOT MERGE** before the `R2_ACCOUNT_ID`, `R2_ACCESS_KEY_ID` and
`R2_SECRET_ACCESS_KEY` secrets exist in the `pytorchbot-env` environment
of pytorch/executorch. Rollout:
1. A repo admin adds the three secrets to `pytorchbot-env`.
2. Merge this.
3. Check that the next nightly run triggers "Upload wheels to R2" and
that the wheels reach R2.

Not verified: a `workflow_run` workflow only runs once it is on main, so
none of this has run in executorch. pytorch/audio#4244 ran this design
end to end, with the environment secrets, on 2026-11-19. I checked that
the workflows parse as YAML and that `shellcheck` is clean on the new
scripts, and that the matrix fields the upload reads (`build_name`,
`python_version`, `desired_cuda`, `upload_to_base_bucket`) are kept by
`filter_cuda_matrix.py`.

Created with Claude

Co-authored-by: Andrey Talman <atalman@users.noreply.github.com>
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