Skip to content

Expose the platform ROCm build run ID - #137

Merged
marbre merged 3 commits into
developfrom
users/marbre/consumer-run-id
Nov 19, 2026
Merged

marbre merged 3 commits into
developfrom
users/marbre/consumer-run-id

Conversation

@marbre

@marbre marbre commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Motivation

Downstream consumers need a GitHub Actions run ID to fetch ROCm build artifacts with TheRock’s tools. This adds --get-run-id PLATFORM to the Quartz reader.

Technical Details

When invoked with --get-run-id PLATFORM, the reader checks the requested platform's ROCm build status. If the build succeeded, it prints the triggering workflow's run ID. The accompanying tutorial shows how to resolve that ID from a Quartz pin and use it to fetch a build stage's dependencies or assemble a local ROCm installation.

Closes #135

Test Plan

  • python -m unittest scripts.consumer.tests.read_status_json_test

Test Result

  • All 46 consumer tests passed.

Submission Checklist

Generated with Codex

@marbre
marbre requested review from a team and HereThereBeDragons November 19, 2026 14:27
Consumers need the producing run ID to fetch artifacts for a specific
platform. Let them query a successful ROCm build directly from a Quartz
pin and pass its ID to TheRock's stage fetcher or installer.

Closes #135

Test plan:
- python -m unittest scripts.consumer.tests.read_status_json_test

Test result:
- All 46 consumer tests passed.

Generated with Codex
@marbre
marbre force-pushed the users/marbre/consumer-run-id branch from f7d6e30 to 70a10d7 Compare November 19, 2026 14:32

@HereThereBeDragons HereThereBeDragons 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.

thanks. overall looks good. just a couple of questions and suggestions for improvements

Comment thread README.md Outdated
in ROCm/TheRock. Discussion:
[ROCm/TheRock#3782](https://github.com/ROCm/TheRock/discussions/3782).
- **[docs/status-json/](docs/status-json/)** - the consumer guide for `status.json`.
- **[docs/tutorial/fetch-nightly-artifacts.md](docs/tutorial/fetch-nightly-artifacts.md)** - how to fetch ROCm nightly build artifacts.

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.

Suggested change
- **[docs/tutorial/fetch-nightly-artifacts.md](docs/tutorial/fetch-nightly-artifacts.md)** - how to fetch ROCm nightly build artifacts.
- **[docs/tutorial/fetch-artifacts.md](docs/tutorial/fetch-nightly-artifacts.md)** - how to fetch ROCm build artifacts.

@@ -0,0 +1,67 @@
# Fetch ROCm nightly build artifacts

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.

rename the file and remove "nightly" fro mthe filename + from this title

this isa applicalble for any of streams quartz provides a status.json for
so just say that as an example we show how to do it for "nightly" stream

"""The detailed pipelines tree as a raw dict (per-arch, per-variant)."""
return self._data.get("pipelines", {})

def rocm_build_run_id(self, platform: str) -> int:

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.

lets change this here a bit differently:

for quartz we recommend that users first check the status and then access the variables. so in this case it would be first check if rocm build is success for your preferred platform on summary level. no need to dig into the details.

(rocm.build == success also means that the python packages/tarballs have been successfully uploaded, PR #115 introduces a new rocm.build_artifacts that returns true as soon as the build has finished and only the artifacts but not yet the packages are available; we can change to this as soon as we have merged it)

recommended change of the function body:
(feel free to adapt the error message)

        platform_status = self.platform(platform)
        build = platform_status.pipeline_build_status("rocm") if platform_status else None
        if build != Status.success:
            raise ValueError(f"No successful ROCm build for {platform} (status {build!r} - run-id {self.trigger_workflow_run_id})")
        return self.trigger_workflow_run_id

expect return type is then int | None

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed. I've let my agent update the accessor locally to check the requested platform's ROCm build status in the summary and return trigger_workflow_run_id on success. We should keep the return type as int so a missing or invalid ID produces a CLI error instead of printing None. The tests will cover both the returned trigger ID and the platform status check.

default=DEFAULT_SOURCE,
help="URL or local path to a status.json (default: latest nightly)",
)
parser.add_argument(

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.

hadnt thought about going into the direction of this becoming a cli tool, but that is also fine

but i am wondering a bit about the naming. maybe we can change it to --get-run-id or something like this to make it clear? otherwise with --run-id i would not expect "linux" or "windows" as input. and should we also support "both"?

the agent also raised that in the fetch tutorial that might be confusing because therock script expects the runid after --run-id

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No strong feelings. Will rename to --get-run-id.

Comment thread scripts/consumer/read_status_json.py Outdated
|- is_complete True once the build has finished
|- build_id (rocm_version, build_date) dedup key
|- raw, pipelines escape hatch to the raw dicts
|- rocm_build_run_id(platform) successful ROCm build workflow run ID

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.

this is not a property function. i am not sure if we should mention it here? as it is more a convenience function

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think we can keep rocm_build_run_id(platform) in the API overview. The overview already lists methods alongside properties, including platform(name) and tarball_url(...). This entry shows Python callers how to perform the same lookup as --get-run-id.

bucket.

**Fetch the dependencies of a build stage.** This example merges the inputs to
the `math-libs` stage into one prefix. Use one invocation per stage. Stage dependencies come

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.

this sentence with "This example merges..." reads very oddly if you are not familiar with the script. maybe you can rephras ehtis a bit?

TheRock revision recorded in the status document's `therock_commit` field.

```bash
RELEASE_TYPE=nightly python "$tools/artifact_manager.py" fetch --run-id "$run_id" --run-github-repo ROCm/rockrel \

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.

does this work the same for other release types? if not, maybe a small note would be good

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Release type doesn't matter, so no note needed.

}
)
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual(result.stdout, "102\n")

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.

test needs updating

artifact id is not based on linux/windows specific runs. it is the id from the triggering workflow - so should be "trigger_workflow_run_id": 100
(well it is the same id because its all workflow calls)

Comment thread docs/tutorial/fetch-artifacts.md Resolved
destination directory if it exists. Add `--dry-run` to preview the files.

```bash
RELEASE_TYPE=nightly python "$tools/install_rocm_from_artifacts.py" --run-id "$run_id" --run-github-repo ROCm/rockrel \

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.

one discussion with the agent about --run-github-repo. it seems not to be needed?

tracing the call chain on TheRock main:

  1. install_rocm_from_artifacts.py --run-id forwards --run-github-repo to artifact_manager.py fetch
  2. fetch calls create_backend_from_env(), which calls WorkflowOutputRoot.from_workflow_run() without lookup_workflow_run, so no GitHub API call
  3. get_artifacts_bucket_config() only reads the repo for RELEASE_TYPE=ci (bucket choice + owner-repo/ prefix)

for nightly / prerelease / nightly-bkc the bucket comes from RELEASE_TYPE alone. unless I'm missing a planned change, I'd drop it - otherwise it suggests the repo selects the artifact source (which is also the premise of #136).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The bucket yes, but the run-id does not and the script calls into GH first... not needed strictly but this is what it is as of today,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Looked closer. Your reasoning applies to artifact_manager.py fetch, so we can drop the flag from that example. The installer takes a different path through fetch_artifacts.py, which enables the GitHub run lookup and that's what I hit befofe. Verified that the same nightly run returns 404 under ROCm/TheRock and resolves under ROCm/rockrel.

Generated with Codex
@marbre

marbre commented Nov 19, 2026

Copy link
Copy Markdown
Member Author

Thanks for the review @HereThereBeDragons. I rather consider this as a starting point and don't think it must be perfect for the first shot. I addressed you're feedback where I think it is applicable. PTAL.

@HereThereBeDragons HereThereBeDragons 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.

thanks, good for me to merge.
only the change log needs updating.


## Unreleased
## v1.3.0 - Unreleased

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.

### Added missing .sorry i didnt catch that

Comment thread docs/changelogs/consumer.md Outdated
`2`.

## Unreleased
## v1.3.0 - Unreleased

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.

## v1.3.0 - 2026-11-19 (tagged `consumer/v1.3.0`)

@HereThereBeDragons

Copy link
Copy Markdown
Collaborator

unittest failures are unrelated

@marbre
marbre merged commit 2cdf97d into develop Nov 19, 2026
9 of 10 checks passed
@marbre
marbre deleted the users/marbre/consumer-run-id branch November 19, 2026 20:14
quartz-sync-github-app Bot pushed a commit that referenced this pull request Nov 19, 2026
2cdf97d, Expose the platform ROCm build run ID (#137), Marius Brehler (marius.brehler@amd.com), Thu Nov 19 21:14:39 2026 +0100
HereThereBeDragons added a commit that referenced this pull request Nov 25, 2026
…er bump to v1.4.0) (#138)

## Motivation

A GitHub Actions run ID alone is not enough to look up a run or fetch
its
artifacts; TheRock's tools also need the repository
(`--run-github-repo`,
which defaults to `$GITHUB_REPOSITORY` or `ROCm/TheRock`). Since #137,
consumers can read the run ID of a nightly from Quartz, but they still
have to
know that nightlies run in `ROCm/rockrel`. This PR records the
repository next
to the run ID in `status.json` and exposes it through the consumer
reader, so
consumers no longer need to hardcode it.

Closes #136

## Technical Details

status.json (schema 2.2 -> 2.3):

- New top-level field `trigger_repository` (for example `ROCm/rockrel`).
The
  setup run and the top-level orchestrator set it together with
`trigger_workflow_run_id`, so a newer run replaces both and a stale run
  changes neither.
- Any accepted write restamps an older document to 2.3. When that write
upgrades a 2.2 document, the producer also fills in `trigger_repository`
from
  the incoming run. Therefore every 2.3 document carries the key.

Producer:

- The repository now lives on the classification
(`Classification.repository`). `classify(wr, repository)` copies it from
the
dispatch envelope, so the status writer and future database ingest read
it
  from the same place.

Consumer reader (v1.4.0):

- `StatusDocument.trigger_repository` returns the recorded `owner/repo`.
Schema
2.0 - 2.2 documents do not record it; for them it returns
`ROCm/rockrel`,
where all of those workflows ran. From 2.3 on, a missing or malformed
value
  raises `ValueError`.
- New `--get-repo` CLI option prints the repository. It takes no
platform,
  since the repository belongs to the whole document, and it is mutually
  exclusive with `--get-run-id`.

Docs:

- Schema reference, status.json README, and both changelogs are updated.
- The fetch-artifacts tutorial resolves `nightly/latest.json` to its
dated
  status document once, reads the run ID and the repository from it, and
  passes both to TheRock's tools. 

## Test Plan

- `python -m pytest scripts docs`
- Live check against the published nightly: the tutorial commands
resolve
  `nightly/20261124/status.json` and return run ID `45293646167` and
  repository `ROCm/rockrel` (via the pre-2.3 fallback).

## Test Result

- 675 tests passed. `NotifyQuartzWiringTest` fails locally because it
reads a
local TheRock checkout; it fails the same way on `main` and is unrelated
to
  this change.
- New tests cover the repository on owner events, replacement by a newer
owner from a different repository, rejection of a stale re-run, the 2.2
->
2.3 upgrade through both leaf and owner events, and the consumer
fallback
  and error cases.

## Submission Checklist

- [x] Look over the contributing guidelines at
  https://github.com/ROCm/TheRock/blob/main/GOVERNANCE.md#pull-requests.

Generated with [Claude Code](https://claude.com/claude-code)
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.

2 participants