ci(pytorch): add optional PyTorch git origin override to wheel builds#6782
ci(pytorch): add optional PyTorch git origin override to wheel builds#6782ethanwee1 wants to merge 1 commit into
Conversation
Add an optional `pytorch_gitrepo_origin` input to the multi-arch PyTorch wheel build workflows (Linux and Windows, kept in sync). When set, the stable checkout uses it as the `--gitrepo-origin` (for example, a fork URL for pre-merge testing); it defaults to https://github.com/ROCm/pytorch.git so existing behavior is unchanged.
❌ PR Check — Action Required
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🚫 Please fix the failed policies before requesting reviews. The following policy checks failed:
The |
| pytorch_origin="${{ inputs.pytorch_gitrepo_origin }}" | ||
| if [ -z "${pytorch_origin}" ]; then | ||
| pytorch_origin="https://github.com/ROCm/pytorch.git" | ||
| fi | ||
| ./external-builds/pytorch/pytorch_torch_repo.py checkout \ | ||
| --gitrepo-origin https://github.com/ROCm/pytorch.git \ | ||
| --gitrepo-origin "${pytorch_origin}" \ |
There was a problem hiding this comment.
I have a slight preference for this style of providing workflow inputs and default values where you load the input into an environment variable and provide a default if the input is empty:
TheRock/.github/workflows/build_portable_linux_python_packages.yml
Lines 111 to 113 in 9289636
For the approach I linked:
- multiple steps throughout the workflow can use the value like
${{ env.ARTIFACT_RUN_ID }} - The default close to where the input is
For the approach currently on this PR:
- Multiple uses would need to duplicate the default logic (possibly diverging)
- Inline bash should be avoided, see https://github.com/ROCm/TheRock/blob/main/docs/development/style_guides/github_actions_style_guide.md#prefer-python-scripts-over-inline-bash (we could clarify/extend that to also cover yaml patterns that are preferred over bash too)
| - ccache | ||
| default: sccache | ||
|
|
||
| run-name: Build Multi-Arch Windows PyTorch Wheels (${{ inputs.release_type }}, ${{ inputs.python_version }}, ${{ inputs.pytorch_git_ref }}) |
There was a problem hiding this comment.
We could also include the gitrepo_origin in the run-name if one is provided, but I think just the ref should be sufficient. What do you think? Would you want it included in the run name? We might be short on character count since repository URLs are pretty long...
If we did make that sort of change, we'd want a multiline string so optional values can be checked, like this:
TheRock/.github/workflows/multi_arch_release.yml
Lines 104 to 107 in 9289636
Summary
Add an optional
pytorch_gitrepo_origininput to the multi-arch PyTorch wheel build workflows so a build can check out PyTorch from an alternate origin (for example, a fork URL) for pre-merge testing.Split out from #6735 per review, and applied to both the Linux and Windows workflows to keep them in sync.
Changes
.github/workflows/multi_arch_build_portable_linux_pytorch_wheels.yml.github/workflows/multi_arch_build_windows_pytorch_wheels.ymlFor each: add the
pytorch_gitrepo_origininput to theworkflow_callandworkflow_dispatchinput blocks, and use it in the "Checkout PyTorch source repos (stable)" step as--gitrepo-origin.Behavior
"", which resolves tohttps://github.com/ROCm/pytorch.gitin the stable checkout step, so existing behavior is unchanged.nightlyrefs (the nightly checkout is unchanged).