Skip to content

METAL-1728: rhcos: add multi-stream format to rhcos.json for RHCOS 10 support#10394

Closed
honza wants to merge 1 commit intoopenshift:mainfrom
honza:rhel10-dual
Closed

METAL-1728: rhcos: add multi-stream format to rhcos.json for RHCOS 10 support#10394
honza wants to merge 1 commit intoopenshift:mainfrom
honza:rhel10-dual

Conversation

@honza
Copy link
Member

@honza honza commented Mar 16, 2026

Convert data/data/coreos/rhcos.json from a single stream.Stream object to a named map keyed by stream name. The existing RHCOS 9 content is placed under the "rhcos-4.21" key and an empty "rhel-coreos-10" placeholder is added for future population by ART.

Update pkg/rhcos/builds.go to parse the new multi-stream format:

  • Add streamStore type and DefaultCoreOSStreamName constant
  • Add FetchCoreOSBuildByStream for selecting a stream by name
  • Keep FetchCoreOSBuild as a backward-compatible wrapper

Update hack/build-coreos-manifest.go to extract the target stream from the multi-stream map before generating the coreos-bootimages ConfigMap.

Update docs/dev/pinned-coreos.md with the new jq-based workflow for updating individual streams within the multi-stream file.

@openshift-ci-robot
Copy link
Contributor

@honza: This pull request references METAL-1728 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Convert data/data/coreos/rhcos.json from a single stream.Stream object to a named map keyed by stream name. The existing RHCOS 9 content is placed under the "rhcos-4.21" key and an empty "rhel-coreos-10" placeholder is added for future population by ART.

Update pkg/rhcos/builds.go to parse the new multi-stream format:

  • Add streamStore type and DefaultCoreOSStreamName constant
  • Add FetchCoreOSBuildByStream for selecting a stream by name
  • Keep FetchCoreOSBuild as a backward-compatible wrapper

Update hack/build-coreos-manifest.go to extract the target stream from the multi-stream map before generating the coreos-bootimages ConfigMap.

Update docs/dev/pinned-coreos.md with the new jq-based workflow for updating individual streams within the multi-stream file.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 16, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 16, 2026

Walkthrough

Restructures data/data/coreos/rhcos.json to nest previous root fields under top-level rhcos-4.21 and add a new rhel-coreos-10 entry. Updates Go code to read named streams from a multi-stream store and adds FetchCoreOSBuildByStream. Documentation adds explicit plume-based stream workflows.

Changes

Cohort / File(s) Summary
CoreOS data
data/data/coreos/rhcos.json
Wraps previous root fields under top-level rhcos-4.21 and adds a new top-level rhel-coreos-10 skeleton; effectively converts the file into a multi-stream store.
Documentation
docs/dev/pinned-coreos.md
Replaces one-shot plume invocation with explicit extract/update/merge steps for rhcos-4.21; adds workflow for generating/merging rhel-coreos-10 stream and clarifies plume command references.
Go: build tooling
hack/build-coreos-manifest.go, pkg/rhcos/builds.go
Adds rhcos-4.21 default constant, reads stream files as stores, introduces streamStore type and FetchCoreOSBuildByStream(ctx, streamName); refactors getBootImages and FetchCoreOSBuild to extract a named stream and handle missing streams/marketplace merges.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.11.3)

Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions
The command is terminated due to an error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions


Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

Migrating from UI to YAML configuration.

Use the @coderabbitai configuration command in a PR comment to get a dump of all your UI settings in YAML format. You can then edit this YAML file and upload it to the root of your repository to configure CodeRabbit programmatically.

@openshift-ci openshift-ci bot requested review from andfasano and jlebon March 16, 2026 14:18
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 16, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign jhixson74 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/rhcos/builds.go (1)

71-92: ⚠️ Potential issue | 🟠 Major

Scope marketplace merging to the selected stream.

FetchCoreOSBuildByStream is stream-aware, but the marketplace merge is still global. Once rhel-coreos-10 is populated, this will return 10.x stream data decorated with the 4.21 marketplace payload.

🛠️ Minimal safeguard
  st, ok := store[streamName]
  if !ok {
  	return nil, fmt.Errorf("stream %q not found in CoreOS stream store", streamName)
  }
+
+ if streamName != DefaultCoreOSStreamName {
+ 	return st, nil
+ }
 
  // Merge marketplace json file into stream json file
  mktBody, err := fetchRawMarketplaceStream()

Longer term, the marketplace file likely needs the same multi-stream shape as rhcos.json.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/rhcos/builds.go` around lines 71 - 92, The marketplace merge is applied
globally but needs to be scoped to the selected stream returned by
FetchCoreOSBuildByStream; change the merge to only apply marketplace entries for
the specific stream key in the parsed marketplace payload (mktSt) instead of
using mktSt directly as a global map. After json.Unmarshal into
marketplaceStream, select the sub-map for the current stream (use the stream
identifier available on st, e.g. st.Stream or st.Name) and then iterate
st.Architectures merging only those entries into
arch.RHELCoreOSExtensions.Marketplace; keep the existing
nil-check/initialization for RHELCoreOSExtensions and return st as before.
🧹 Nitpick comments (1)
hack/build-coreos-manifest.go (1)

74-87: Reuse the shared default stream constant here.

This hardcodes the default stream a second time. The next stream bump now has to update both this script and pkg/rhcos.DefaultCoreOSStreamName, or the generated coreos-bootimages ConfigMap can drift from FetchCoreOSBuild().

♻️ Suggested change
-const rhcosStreamName = "rhcos-4.21"
-
 func getBootImages() ([]byte, error) {
@@
-		streamName = rhcosStreamName
+		streamName = installerrhcos.DefaultCoreOSStreamName

Add an aliased import for github.com/openshift/installer/pkg/rhcos above to avoid the existing rhcos import collision.

As per coding guidelines, "Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@hack/build-coreos-manifest.go` around lines 74 - 87, Replace the hardcoded
rhcosStreamName usage in getBootImages with the shared constant from pkg/rhcos
(pkg/rhcos.DefaultCoreOSStreamName) so the default stream value is maintained in
one place; to do this update the imports to add an aliased import for
github.com/openshift/installer/pkg/rhcos to avoid colliding with the existing
rhcos symbol, then use that aliased package's DefaultCoreOSStreamName inside
getBootImages instead of the local rhcosStreamName constant.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/dev/pinned-coreos.md`:
- Around line 47-59: The generated stream JSON lacks a "stream" field because
the plume cosa2stream invocation doesn't set the stream name; update the plume
cosa2stream command (the invocation of plume cosa2stream that writes to
/tmp/rhcos10.json) to include the flag --name rhel-coreos-10 so the produced
JSON contains the correct "stream" value before the jq merge into the
rhel-coreos-10 key in data/data/coreos/rhcos.json.

---

Outside diff comments:
In `@pkg/rhcos/builds.go`:
- Around line 71-92: The marketplace merge is applied globally but needs to be
scoped to the selected stream returned by FetchCoreOSBuildByStream; change the
merge to only apply marketplace entries for the specific stream key in the
parsed marketplace payload (mktSt) instead of using mktSt directly as a global
map. After json.Unmarshal into marketplaceStream, select the sub-map for the
current stream (use the stream identifier available on st, e.g. st.Stream or
st.Name) and then iterate st.Architectures merging only those entries into
arch.RHELCoreOSExtensions.Marketplace; keep the existing
nil-check/initialization for RHELCoreOSExtensions and return st as before.

---

Nitpick comments:
In `@hack/build-coreos-manifest.go`:
- Around line 74-87: Replace the hardcoded rhcosStreamName usage in
getBootImages with the shared constant from pkg/rhcos
(pkg/rhcos.DefaultCoreOSStreamName) so the default stream value is maintained in
one place; to do this update the imports to add an aliased import for
github.com/openshift/installer/pkg/rhcos to avoid colliding with the existing
rhcos symbol, then use that aliased package's DefaultCoreOSStreamName inside
getBootImages instead of the local rhcosStreamName constant.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 50358391-549e-48e4-9ac6-928a3e678038

📥 Commits

Reviewing files that changed from the base of the PR and between 3528292 and 7cdc3a7.

📒 Files selected for processing (4)
  • data/data/coreos/rhcos.json
  • docs/dev/pinned-coreos.md
  • hack/build-coreos-manifest.go
  • pkg/rhcos/builds.go

Convert data/data/coreos/rhcos.json from a single stream.Stream object
to a named map keyed by stream name. The existing RHCOS 9 content is
placed under the "rhcos-4.21" key and an empty "rhel-coreos-10"
placeholder is added for future population by ART.

Update pkg/rhcos/builds.go to parse the new multi-stream format:
- Add streamStore type and DefaultCoreOSStreamName constant
- Add FetchCoreOSBuildByStream for selecting a stream by name
- Keep FetchCoreOSBuild as a backward-compatible wrapper

Update hack/build-coreos-manifest.go to extract the target stream from
the multi-stream map before generating the coreos-bootimages ConfigMap.

Update docs/dev/pinned-coreos.md with the new jq-based workflow for
updating individual streams within the multi-stream file.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
docs/dev/pinned-coreos.md (1)

65-67: Missing blank line before heading.

There should be a blank line between line 66 and the heading on line 67 for proper Markdown rendering.

 - https://github.com/coreos/coreos-assembler/pull/2000
 - https://github.com/coreos/coreos-assembler/pull/2052
+
 ### Origin of stream metadata
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/dev/pinned-coreos.md` around lines 65 - 67, Add a blank line before the
"### Origin of stream metadata" heading so the preceding list items render
correctly as separate block and the heading is recognized; edit the markdown
around the "### Origin of stream metadata" heading to insert an empty line
between the list lines ("https://github.com/coreos/coreos-assembler/pull/2000" /
"https://github.com/coreos/coreos-assembler/pull/2052") and the heading.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@docs/dev/pinned-coreos.md`:
- Around line 65-67: Add a blank line before the "### Origin of stream metadata"
heading so the preceding list items render correctly as separate block and the
heading is recognized; edit the markdown around the "### Origin of stream
metadata" heading to insert an empty line between the list lines
("https://github.com/coreos/coreos-assembler/pull/2000" /
"https://github.com/coreos/coreos-assembler/pull/2052") and the heading.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7c60c4bd-8820-4144-8d16-f153cc05852e

📥 Commits

Reviewing files that changed from the base of the PR and between 7cdc3a7 and 1c92cf7.

📒 Files selected for processing (4)
  • data/data/coreos/rhcos.json
  • docs/dev/pinned-coreos.md
  • hack/build-coreos-manifest.go
  • pkg/rhcos/builds.go

elfosardo added a commit to elfosardo/machine-os-images that referenced this pull request Mar 16, 2026
Parse the new multi-stream rhcos.json format (keyed by stream name)
introduced in openshift/installer#10394. A COREOS_VERSIONS build arg
controls which versions to bundle (default: 9), and a COREOS_VERSION
runtime env var selects which version the ironic-python-agent symlinks
point to.

Backward compatible: default behavior is unchanged.
@jlebon
Copy link
Member

jlebon commented Mar 16, 2026

See #10321, which is adding logic for OSImageStream which is the abstraction being worked on for the multi-stream work.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 16, 2026

@honza: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-openstack-ovn 1c92cf7 link true /test e2e-openstack-ovn

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@honza
Copy link
Member Author

honza commented Mar 19, 2026

Closing in favour of #10321

@honza honza closed this Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants