Skip to content

manifest/raw_bootc: support subscription registration on first boot (HMS-10897)#2528

Open
lucasgarfield wants to merge 2 commits into
osbuild:mainfrom
lucasgarfield:bootc-subscription
Open

manifest/raw_bootc: support subscription registration on first boot (HMS-10897)#2528
lucasgarfield wants to merge 2 commits into
osbuild:mainfrom
lucasgarfield:bootc-subscription

Conversation

@lucasgarfield

Copy link
Copy Markdown
Contributor

Wire up customizations.subscription for bootc disk images (qcow2, ami, ...).
The shared subscriptionService() machinery now runs in the RawBootcImage
pipeline: it creates the first-boot registration unit in /etc (not /usr, which
is immutable ostree content) and reruns Insights collection on boot so the
console reflects the new commit hash after upgrades — same options the
standalone Subscription pipeline uses for ostree systems.

Only the disk variant is wired for now.

While in there, URI-backed file customizations now return a clear error at
manifest generation time — they were previously silently broken in this
pipeline (missing manifest source).

@lucasgarfield
lucasgarfield requested a review from a team as a code owner July 17, 2026 11:39
Comment thread pkg/manifest/raw_bootc.go Outdated
// insights on boot
InsightsOnBoot: true,
UnitPath: osbuild.EtcUnitPath,
PermissiveRHC: common.ValueOrEmpty(p.OSCustomizations.PermissiveRHC),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This isn't actually ever set right? Not a blocker but also just a no-op at the moment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Correct. I went ahead and added a comment (// no-op for now: manifestForDisk never sets OSCustomizations.PermissiveRHC) but we could probably also wire it up without too much effort.

supakeen
supakeen previously approved these changes Jul 17, 2026
@supakeen

Copy link
Copy Markdown
Member

Needs linter appeasement otherwise OK.

This only takes effect once callers populate
OSCustomizations.Subscription; see the follow-up commit.

Previously, the only source of inline data was Customizations.Files.
Now we also need to create inline sources for files needed for
subscription. For the sake of consistency with the OS pipeline in
os.go, we add an inlineData field to RawBootcImage. The getInline()
method just becomes a getter for the inlineData field. A new helper,
genFileStagesAndRecordInlineData(), roughly mirrors
(*OS).addStagesForAllFilesAndInlineData. Unlike the OS pipeline,
however, there is no fileRefs() implementation here, so the helper
returns an error for URI-backed files; previously these silently
produced a manifest referencing a source that was never defined.

In addition to files, the subscriptionService() function also enables
a service. Instead of enabling it in the subscription code block, we
add it to enabledServices later on. This is again similar to how we
serialize the OS pipeline and will make supporting
Customizations.Services easy to add later.

For subscriptionServiceOptions, InsightsOnBoot creates a drop-in that
reruns Insights collection on every healthy boot so that after an
upgrade the console reflects the new commit hash (see a6ecc32).
UnitPath needs to be /etc/ because /usr/ is immutable.

For the most part, the tests attempt to mirror the relevant tests for
os.go.
Copy the requested subscription options into the image customizations in
manifestForDisk, so bootc disk images (qcow2, ami, ...) register on first
boot via the machinery added in the previous commit.
Comment thread pkg/manifest/raw_bootc.go

// single point where enabled services are collected, as in the OS
// pipeline; OSCustomizations.EnabledServices is not honoured yet
var enabledServices []string

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why have 2 lists for enabled services? You have already populated subscriptionEnabledServices and all this does is copy it.

Comment thread pkg/manifest/raw_bootc.go
// would need to be added to the manifest sources via a
// fileRefs() implementation like the one in the OS pipeline
if file.URI() != "" {
return nil, fmt.Errorf("cannot create file %q from %q: files from an URI are not supported for bootc disk images yet", file.Path(), file.URI())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd drop the yet, no need to speculate in error messages and get people's hopes up :)

return ""
}

func collectMkdirPaths(stages []*osbuild.Stage) []string {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

May as well use this in the TestRawBootcPXE function, probably in a new commit just to keep things clean.

@brlane-rht

Copy link
Copy Markdown
Contributor

Is there a reason you didn't add this to PXE and ISO types?

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.

3 participants