Skip to content

sysupdate: make the .component files of a repository work - #106

Open
mvo5 wants to merge 5 commits into
mainfrom
fix-k8s-component
Open

mvo5 wants to merge 5 commits into
mainfrom
fix-k8s-component

Conversation

@mvo5

@mvo5 mvo5 commented Nov 19, 2026

Copy link
Copy Markdown
Member

I am working on installs k8s from its TUF repository [1]. It is currently a combined repo, i.e. it contains k8s-{cp,worker}. But currently sysupdate/quarry always installs k8s-cp and k8s-worker. The reason is that while we support optional feature we don't link them into the right place for components. So this PR makes that work by linking the components into the right place and also skips disabled components on update.

There might be more work following but this should unblock the next steps in testing.

[1] https://github.com/amutable/amutablectl/compare/config-k8s?expand=1

@mvo5
mvo5 force-pushed the fix-k8s-component branch from bb60af1 to 52d0c26 Compare November 19, 2026 16:49
@mvo5
mvo5 requested a review from cyphar November 20, 2026 08:01

@rata rata left a comment

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.

@mvo5 mostly LGTM. I left some nits on the tests and some questions, thanks! :)

Comment on lines +44 to +47
Details []struct {
Name string `json:"name"`
Enabled *bool `json:"enabled"`
} `json:"details"`

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.

Is the syntax for this settled already?

Not sure where this comes from, but having two different arrays for components and details and then having to iterate both, create maps and all just to filter not enabled things seems annoying.

But maybe this comes from a spec or something already established that we can't change?

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.

It comes from systemd-sysupdate and is probably already being parsed by the GnomeOS folks. But yeah I agree it's really unfortunate.

Comment thread cmd/quarry-sysupdate/utils_sysupdate.go Outdated
Components []string `json:"components"`
Details []struct {
Name string `json:"name"`
Enabled *bool `json:"enabled"`

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.

Don't we need the omitempty tag here? Or to the whole details struct either?

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.

FWIW it would be a no-op for parsing.

Comment thread internal/xsysupdate/transfer.go Resolved
mvo5 and others added 2 commits November 24, 2026 00:08
"systemd-sysupdate update" fails with an error if a component is
disabled, so we cannot just indiscriminately call it for every
component. We need to parse out (from "systemd-sysupdate components")
which components are actually enabled.

We didn't notice this issue earlier because .component files were also
not being linked into the runtime /etc at all, which will be fixed in a
later patch in this series.

This should no longer be needed after we switch to the built-in
--all-components flag for systemd-sysupdate.

Signed-off-by: Michael Vogt <michael@amutable.com>
Signed-off-by: Aleksa Sarai <aleksa@amutable.com>
Previously we would skip these files if distributed which meant that
disabled-by-default and runtime-enabled components would not be
installed correctly.

This only fixes clients consuming these files, a later patch in this
series fixes hardhat to properly generate these component files.

Signed-off-by: Aleksa Sarai <aleksa@amutable.com>
There is no need to pass around file contents as maps of paths and bytes
or having the kinda complicated collation code with restrictions about
duplicates. Really we should be merging all of the provided directory
contents as much as possible.

Fixes: 57c679a ("hardhat: publish sysupdate definitions inline with --quarry-transfer-dir")
Signed-off-by: Aleksa Sarai <aleksa@amutable.com>
Injecting a pointless [Source] Path=... value doesn't make sense for any
non-transfer / non-transfer-drop-in files.

Signed-off-by: Aleksa Sarai <aleksa@amutable.com>
…omponent

To make using the CLI easier the foo.component file is still provided
inside the component directory but we now hoist it into the top-level
directory so that it can be installed by clients properly.

This also means we now reject component directories that have a
different .component file inside them, since they will be ignored (and
are kind of weird to have in the first place).

Signed-off-by: Aleksa Sarai <aleksa@amutable.com>
@cyphar

cyphar commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

@mvo5 / @pothos Can you PTAL? I reworked it along the lines we discussed where now we now publish the component definition as .quarry/sysupdate.<foo>.component along with some other improvements. If looks okay feel free to merge.

@mvo5 mvo5 left a comment

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.

👍 Looks good to me, one tiny question but from my PoV this can go in

// top of the source is published as the component file. Any other
// *.component file is an error.
func definitionTargetPath(componentDir, rel string) (string, error) {
if !strings.HasSuffix(rel, ".component") {

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.

Should we also do something like this for .component.d drop-in dirs? Also reject?

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