[ci] Fetch external CI sources through fetch_sources.py #9854
<!-- therock-pr-bot-policy-check -->
✅ All Checks Passed — Ready for Review
| Check | Status | Details |
|---|:---:|---|
| 📝 PR Description | ✅ Pass | — |
| ⛔ Forbidden Files | ✅ Pass | — |
| 🧪 Unit Test | ✅ Pass | — |
| 🔎 pre-commit | ✅ Pass | — |
| 🚫 Draft PR | 🔜 To Be Enabled | — |
| 🚩 Feature Flag | 🔜 To Be Enabled | — |
| 📊 Code Coverage | 🔜 To Be Enabled | — |
| 🤖 therock-pr-bot | ✅ Pass | — |
🎉 All checks passed! This PR is ready for review.
📖 Need help? See the Policy FAQ for details on every check and how to fix failures.
<!-- therock-pr-bot-fix-policies -->
🎉 All checks passed! This PR is ready for review.
needs a rebase?
this has landed! https://github.com/ROCm/TheRock/pull/9853
rebase! i reviewed and it landed here: https://github.com/ROCm/TheRock/pull/9853/changes
nit: i see this in https://github.com/ROCm/rocm-libraries/actions/runs/42720646408/job/129527701470#step:11:43 and it works! (needed to confirm)
however, it's quite deep and hidden, really had to hunt for it. when we did have the checkout step, it was nice to confirm what hash it was (and it was very easy to find)
could we perhaps add some logging to indicating that we got a custom checkout and this is hash? from EXTERNAL_REPO?
lgtm, few comments
Just an artifact of using github's stacked PRs. The second commit is what's new in this PR. I can rebase to make that more clear.
Sure, will do.
I think I'll add logs/output in two places:
1. During submodule fetching in this script itself
2. During CI configure, highlighting the current branch and which commits of both TheRock and submodule overrides are used. That is also available in the manifest file but we can make it more directly usable by working it into the output here: <img width="798" height="648" alt="image" src="https://github.com/user-attachments/assets/79345fa5-4712-4ba2-9c78-6f9372dc7964" />
Leaning towards text like
> Trigger: workflow_dispatch on users/scotttodd/unify-external-source-fetching, release variant.
>
> Source: TheRock at be98e6d575a7 with submodule override rocm-libraries at e32d55782c6b.
Working here: https://github.com/ROCm/rocm-libraries/actions/runs/42933356473
<img width="1149" height="683" alt="image" src="https://github.com/user-attachments/assets/65f78319-ca80-4465-8fbd-90d89f6fbe4d" />
Pushed a commit changing the logging / summary information. I'll let the CI runs complete on those test runs and plan on merging tomorrow.
geomin12
ScottTodd
Motivation
Part 2/2 of following up on https://github.com/ROCm/TheRock/pull/9618#discussion_r4461999657 to solve https://github.com/ROCm/TheRock/issues/9573 cleanly.
This folds away a large chunk of code custom to "external repo" CI runs.
Technical Details
We currently have code in
build_tools/github_actions/detect_external_repo_config.pythat passes arguments likeThis feeds into
1. One job running
actions/checkout, only for "external repo" CI runs:2. Another job running
build_tools/fetch_sources.pywith the extra--skip-submodules rocm-libraries --dvc-projects external-rocm-libraries rocm-systemsargs:Instead we can teach
fetch_sources.pyto directly readsubmodule_pathandreffromEXTERNAL_REPO_CONFIGand use that to decide whether to redirect a particular submodule during checkout (_if_ checkout is needed).This guarantees (without forking implementation code from other files) that we
1. Only fetch git submodules that are required by each build stage
2. Only fetch DVC files when we fetch the associated git submodules
3. Benefit from shared optimizations to checkout performance (e.g. git mirrors)
The implementation in
fetch_sources.pyusesgit config --file .gitmodulesto cheaply edit the git submodule state prior to runninggit submodule update. We could implement something similar as a layer on top of git by using our manifest files as the checkout source.Test Plan
Unit tests on this PR
1. No "Checkout external repository"
2. compiler-runtime stage clones llvm, rocm-systems, etc. and _not_ rocm-libraries
4. math-libs stage clones rocm-libraries from the
EXTERNAL_REPO_CONFIGrefSubmission Checklist