Skip to content

[CI] Update setup-linux to work with existing Docker images on OSDC - #178973

Closed
huydhn wants to merge 14 commits into
mainfrom
huydhn/update-setup-linux
Closed

huydhn wants to merge 14 commits into
mainfrom
huydhn/update-setup-linux

Conversation

@huydhn

@huydhn huydhn commented Apr 1, 2026 •

Copy link
Copy Markdown
Contributor

The previous changes to setup-linux to support OSDC (setup-uv, choose compiler, switch CUDA version) are needed only if we want to use a single base Docker image for all CI jobs. After chatting with @malfet, we have decided to not do that for now and stick with the existing Docker images for the purpose of OSDC migration. So, the above said logic can be cleaned up. We can add them back later if needed.

On the other hand, there are 2 issues need to be fixed when using existing Docker images:

Testing

Using #177992 to run this GHA change at https://github.com/pytorch/pytorch/actions/runs/23842872594

@pytorch-bot

pytorch-bot Bot commented Apr 1, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ No Failures

As of commit 5ef1f64 with merge base 860948a (image):
💚 Looks good so far! There are no failures yet. 💚

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

@pytorch-bot pytorch-bot Bot added the topic: not user facing topic category label Apr 1, 2026
@huydhn huydhn changed the title [CI] Debug setup-linux [CI] Update setup-linux to work with existing Docker images on OSDC Apr 1, 2026
@huydhn
huydhn requested a review from malfet April 1, 2026 08:55
@huydhn
huydhn marked this pull request as ready for review April 1, 2026 09:50
@huydhn
huydhn requested a review from a team as a code owner April 1, 2026 09:50
@huydhn huydhn added the ciflow/trunk Trigger trunk jobs on your pull request label Apr 1, 2026
@huydhn

huydhn commented Apr 1, 2026

Copy link
Copy Markdown
Contributor Author

@pytorchbot rebase -b main

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/main. Check the current status here

huydhn added 12 commits April 1, 2026 18:53
Signed-off-by: Huy Do <[email protected]>
Signed-off-by: Huy Do <[email protected]>
Signed-off-by: Huy Do <[email protected]>
Signed-off-by: Huy Do <[email protected]>
Signed-off-by: Huy Do <[email protected]>
Signed-off-by: Huy Do <[email protected]>
Signed-off-by: Huy Do <[email protected]>
Signed-off-by: Huy Do <[email protected]>
Signed-off-by: Huy Do <[email protected]>
Signed-off-by: Huy Do <[email protected]>
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Successfully rebased huydhn/update-setup-linux onto refs/remotes/origin/main, please pull locally before adding more changes (for example, via git checkout huydhn/update-setup-linux && git pull --rebase)

@pytorchmergebot
pytorchmergebot force-pushed the huydhn/update-setup-linux branch from a4cc687 to 6095716 Compare April 1, 2026 18:53

@malfet malfet left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@huydhn

huydhn commented Apr 2, 2026

Copy link
Copy Markdown
Contributor Author

Oh, need to fix lint

@huydhn

huydhn commented Apr 2, 2026

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

IvanKobzarev pushed a commit to IvanKobzarev/pytorch that referenced this pull request Apr 3, 2026
…ytorch#178973)

The previous changes to setup-linux to support OSDC (setup-uv, choose compiler, switch CUDA version) are needed only if we want to use a single base Docker image for all CI jobs.  After chatting with @malfet, we have decided to not do that for now and stick with the existing Docker images for the purpose of OSDC migration.  So, the above said logic can be cleaned up. We can add them back later if needed.

On the other hand, there are 2 issues need to be fixed when using existing Docker images:

* ARC has switched to uid 1001 actions/runner-images#10936 since last year, and that uid is the one all the hooks are using. This conflicts with the current PyTorch CI image are still using uid 1000 or `ec2-user`. We can update the uid to 1001 eventually when everything migrates to ARC
* ~~Checkout is now done inside the container, and the git version on CI image is too old to support treeless checkout~~ @malfet has fixed this by upgrading git version in pytorch#179025

### Testing

Using pytorch#177992 to run this GHA change at https://github.com/pytorch/pytorch/actions/runs/23842872594
Pull Request resolved: pytorch#178973
Approved by: https://github.com/malfet, https://github.com/yangw-dev
weifengpy pushed a commit that referenced this pull request Apr 7, 2026
…178973)

The previous changes to setup-linux to support OSDC (setup-uv, choose compiler, switch CUDA version) are needed only if we want to use a single base Docker image for all CI jobs.  After chatting with @malfet, we have decided to not do that for now and stick with the existing Docker images for the purpose of OSDC migration.  So, the above said logic can be cleaned up. We can add them back later if needed.

On the other hand, there are 2 issues need to be fixed when using existing Docker images:

* ARC has switched to uid 1001 actions/runner-images#10936 since last year, and that uid is the one all the hooks are using. This conflicts with the current PyTorch CI image are still using uid 1000 or `ec2-user`. We can update the uid to 1001 eventually when everything migrates to ARC
* ~~Checkout is now done inside the container, and the git version on CI image is too old to support treeless checkout~~ @malfet has fixed this by upgrading git version in #179025

### Testing

Using #177992 to run this GHA change at https://github.com/pytorch/pytorch/actions/runs/23842872594
Pull Request resolved: #178973
Approved by: https://github.com/malfet, https://github.com/yangw-dev
nklshy-aws pushed a commit to nklshy-aws/pytorch that referenced this pull request Apr 7, 2026
…ytorch#178973)

The previous changes to setup-linux to support OSDC (setup-uv, choose compiler, switch CUDA version) are needed only if we want to use a single base Docker image for all CI jobs.  After chatting with @malfet, we have decided to not do that for now and stick with the existing Docker images for the purpose of OSDC migration.  So, the above said logic can be cleaned up. We can add them back later if needed.

On the other hand, there are 2 issues need to be fixed when using existing Docker images:

* ARC has switched to uid 1001 actions/runner-images#10936 since last year, and that uid is the one all the hooks are using. This conflicts with the current PyTorch CI image are still using uid 1000 or `ec2-user`. We can update the uid to 1001 eventually when everything migrates to ARC
* ~~Checkout is now done inside the container, and the git version on CI image is too old to support treeless checkout~~ @malfet has fixed this by upgrading git version in pytorch#179025

### Testing

Using pytorch#177992 to run this GHA change at https://github.com/pytorch/pytorch/actions/runs/23842872594
Pull Request resolved: pytorch#178973
Approved by: https://github.com/malfet, https://github.com/yangw-dev
bobrenjc93 pushed a commit to bobrenjc93/pytorch that referenced this pull request Apr 9, 2026
…ytorch#178973)

The previous changes to setup-linux to support OSDC (setup-uv, choose compiler, switch CUDA version) are needed only if we want to use a single base Docker image for all CI jobs.  After chatting with @malfet, we have decided to not do that for now and stick with the existing Docker images for the purpose of OSDC migration.  So, the above said logic can be cleaned up. We can add them back later if needed.

On the other hand, there are 2 issues need to be fixed when using existing Docker images:

* ARC has switched to uid 1001 actions/runner-images#10936 since last year, and that uid is the one all the hooks are using. This conflicts with the current PyTorch CI image are still using uid 1000 or `ec2-user`. We can update the uid to 1001 eventually when everything migrates to ARC
* ~~Checkout is now done inside the container, and the git version on CI image is too old to support treeless checkout~~ @malfet has fixed this by upgrading git version in pytorch#179025

### Testing

Using pytorch#177992 to run this GHA change at https://github.com/pytorch/pytorch/actions/runs/23842872594
Pull Request resolved: pytorch#178973
Approved by: https://github.com/malfet, https://github.com/yangw-dev
pytorch-bot Bot pushed a commit that referenced this pull request Apr 10, 2026
…178973)

The previous changes to setup-linux to support OSDC (setup-uv, choose compiler, switch CUDA version) are needed only if we want to use a single base Docker image for all CI jobs.  After chatting with @malfet, we have decided to not do that for now and stick with the existing Docker images for the purpose of OSDC migration.  So, the above said logic can be cleaned up. We can add them back later if needed.

On the other hand, there are 2 issues need to be fixed when using existing Docker images:

* ARC has switched to uid 1001 actions/runner-images#10936 since last year, and that uid is the one all the hooks are using. This conflicts with the current PyTorch CI image are still using uid 1000 or `ec2-user`. We can update the uid to 1001 eventually when everything migrates to ARC
* ~~Checkout is now done inside the container, and the git version on CI image is too old to support treeless checkout~~ @malfet has fixed this by upgrading git version in #179025

### Testing

Using #177992 to run this GHA change at https://github.com/pytorch/pytorch/actions/runs/23842872594
Pull Request resolved: #178973
Approved by: https://github.com/malfet, https://github.com/yangw-dev
@github-actions
github-actions Bot deleted the huydhn/update-setup-linux branch May 3, 2026 02:26
gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
…ytorch#178973)

The previous changes to setup-linux to support OSDC (setup-uv, choose compiler, switch CUDA version) are needed only if we want to use a single base Docker image for all CI jobs.  After chatting with @malfet, we have decided to not do that for now and stick with the existing Docker images for the purpose of OSDC migration.  So, the above said logic can be cleaned up. We can add them back later if needed.

On the other hand, there are 2 issues need to be fixed when using existing Docker images:

* ARC has switched to uid 1001 actions/runner-images#10936 since last year, and that uid is the one all the hooks are using. This conflicts with the current PyTorch CI image are still using uid 1000 or `ec2-user`. We can update the uid to 1001 eventually when everything migrates to ARC
* ~~Checkout is now done inside the container, and the git version on CI image is too old to support treeless checkout~~ @malfet has fixed this by upgrading git version in pytorch#179025

### Testing

Using pytorch#177992 to run this GHA change at https://github.com/pytorch/pytorch/actions/runs/23842872594
Pull Request resolved: pytorch#178973
Approved by: https://github.com/malfet, https://github.com/yangw-dev
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
…ytorch#178973)

The previous changes to setup-linux to support OSDC (setup-uv, choose compiler, switch CUDA version) are needed only if we want to use a single base Docker image for all CI jobs.  After chatting with @malfet, we have decided to not do that for now and stick with the existing Docker images for the purpose of OSDC migration.  So, the above said logic can be cleaned up. We can add them back later if needed.

On the other hand, there are 2 issues need to be fixed when using existing Docker images:

* ARC has switched to uid 1001 actions/runner-images#10936 since last year, and that uid is the one all the hooks are using. This conflicts with the current PyTorch CI image are still using uid 1000 or `ec2-user`. We can update the uid to 1001 eventually when everything migrates to ARC
* ~~Checkout is now done inside the container, and the git version on CI image is too old to support treeless checkout~~ @malfet has fixed this by upgrading git version in pytorch#179025

### Testing

Using pytorch#177992 to run this GHA change at https://github.com/pytorch/pytorch/actions/runs/23842872594
Pull Request resolved: pytorch#178973
Approved by: https://github.com/malfet, https://github.com/yangw-dev
huydhn added a commit to pytorch/test-infra that referenced this pull request Aug 28, 2026
The GH runner image creates GITHUB_WORKSPACE as uid 1001, while CI images
commonly default to a uid 1000 user mirroring ec2-user -- pytorch's
`USER jenkins` and executorch's `USER ci-user` both do. That user cannot unlink
the workspace, so the first step of every job dies on

  rm: cannot remove '/__w/<repo>/<repo>': Permission denied

and every later step skips. It only surfaces with a non-root image, which is why
jobs on pytorch/almalinux-builder never hit it.

linux_job_v2 avoided this by running the same cleanup under sudo by default,
gated on its no-sudo input; v3 dropped both. Restore the equivalent with a chmod
rather than `sudo rm`, so the GH hook (uid 1001) can still clean up after the
job -- the same fix pytorch/pytorch carries in .github/actions/setup-linux for
its ARC path, added in pytorch/pytorch#178973.

The chmod is only reached when the plain rm fails, so an image running as root
succeeds first time and never calls sudo, which nvidia/cuda and bare distro
images do not ship.

Both branches are covered in test_linux_job_v3.yml: test-docker-image now
asserts it runs as root, and test-non-root-docker-image runs against a uid 1000
pytorch CI image, which fails without this change.

Authored with Claude Code.
huydhn added a commit to pytorch/test-infra that referenced this pull request Aug 28, 2026
The GH hook creates GITHUB_WORKSPACE as uid 1001, while CI images commonly
default to a uid 1000 user mirroring ec2-user -- pytorch's `USER jenkins` and
executorch's `USER ci-user` both do. That user cannot unlink the workspace, so
`Clean workspace` died on

  rm: cannot remove '/__w/<repo>/<repo>': Permission denied

before any other step ran. It only surfaces with a non-root image, which is why
jobs on pytorch/almalinux-builder never hit it.

An OSDC pod is ephemeral, so there is nothing to clean in the first place: the
workspace starts empty, and the failing rm was carried over from v2, where EC2
runners were reused. What a job actually needs is to be able to write into the
directory the hook made, so chmod it and drop the removal. This is what
pytorch/pytorch does in .github/actions/setup-linux for its ARC path, added in
pytorch/pytorch#178973.

Note chmod alone would not have rescued the rm: unlinking the workspace needs
write on its parent, which chmodding the workspace does not grant.

Root images can already write and often ship no sudo, so the chmod tolerates
failure. Both paths are covered in test_linux_job_v3.yml: test-docker-image
asserts it runs as root, and test-non-root-docker-image runs against a uid 1000
pytorch CI image and probes that the workspace is writable.

Authored with Claude Code.
atalman pushed a commit to pytorch/test-infra that referenced this pull request Aug 28, 2026
…8665)

`Clean workspace`, the first step of every v3 job, dies with a non-root
image:

```
rm: cannot remove '/__w/executorch/executorch': Permission denied
```

and every later step skips. The GH hook creates `GITHUB_WORKSPACE` as
uid 1001
([runner-images#10936](actions/runner-images#10936)),
while CI images commonly default to a uid 1000 user mirroring `ec2-user`
— pytorch's `USER jenkins` and executorch's `USER ci-user` both do. It
only surfaces with a non-root image, which is why jobs on
`pytorch/almalinux-builder` have never hit it. Reproducer:
[pytorch/executorch#22245](pytorch/executorch#22245),
the first v3 caller to pass a repo CI image.

**An OSDC pod is ephemeral, so there is nothing to clean.** The
workspace starts empty — the failing `rm -rfv` printed no `removed`
lines before erroring — and the step is carried over from v2, where EC2
runners were reused between jobs. What a job actually needs is to be
able to write into the directory the hook created, so this chmods it and
drops the removal, which is what pytorch/pytorch does in
[`.github/actions/setup-linux`](https://github.com/pytorch/pytorch/blob/d3b8bf0a11cba909aac9e8cdf8b81af8d59a251e/.github/actions/setup-linux/action.yml#L53-L63)
for its ARC path
([pytorch/pytorch#178973](pytorch/pytorch#178973)).

Worth recording: adding a chmod *before* the `rm` does not work, and the
test below caught it. Unlinking the workspace needs write on its parent
`/__w/<repo>`, which chmodding the workspace does not grant — the chmod
succeeded and the `rm` failed anyway.

Root images can already write and often ship no `sudo` (`nvidia/cuda`,
bare distro images), so the chmod tolerates failure rather than being
gated on a user check.

## Tests

`test_linux_job_v3.yml` covers both paths:

- `test-docker-image` (`ghcr.io/pytorch/test-infra:cpu-x86_64-latest`)
asserts `id -u` is 0, pinning the root path that must not require sudo.
- `test-non-root-docker-image` is new, on
`ghcr.io/pytorch/ci-image:pytorch-linux-jammy-py3.10-clang21` — a uid
1000 `USER jenkins` image. It asserts a non-root user, probes that the
workspace is writable, and checks the checkout produced a git repo. It
fails on `main` today.

Authored with Claude Code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/b200 ciflow/trunk Trigger trunk jobs on your pull request Merged topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants