Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add persistence mechanism between stages; write result report to provisioned system #1250

Merged
merged 5 commits into from
Jul 22, 2021
Merged

Conversation

bgilbert
Copy link
Contributor

@bgilbert bgilbert commented Jul 21, 2021

Increasingly, we need to persist small bits of state between stages. Add a general mechanism for this, which serializes a struct to a JSON file in /run at the end of each stage and loads it at the beginning of the next stage. For now, use the mechanism to record the fetched-config summaries that are reported to the journal, plus LUKS keyfiles for the files stage.

Additionally, use this functionality to write a JSON file to /var/lib/ignition/result.json that contains the provisioning timestamp and a flag indicating whether a user config was used. The idea is to move this functionality upstream, allowing distros to display summary information about how provisioning went.

The state mechanism is intended to be an internal API that can change without warning. The result file format is intended to be reasonably stable, but since it's easy to add compatibility hacks when writing it, I don't think we need to be overly careful when adding things to the format.

It'd be great if we could eventually use the status file to replace the structured journal entries, since the latter seems like a fairly awkward and obscure interface. It's unclear how much of a compatibility issue that would pose, though.

internal/main.go Outdated Show resolved Hide resolved
internal/main.go Outdated Show resolved Hide resolved
internal/state/state.go Show resolved Hide resolved
internal/exec/stages/files/files.go Show resolved Hide resolved
internal/exec/stages/files/filesystemEntries.go Outdated Show resolved Hide resolved
bgilbert added 5 commits July 22, 2021 14:24
Serialize a struct to a JSON file in /run at the end of each stage and load
it at the beginning of the next stage.  This is intended to be an internal
mechanism that can change incompatibly without warning.
Record some bits of information that the distro might want to know for
display purposes.  This file is intended to be a reasonably stable
interface for distro use.
@bgilbert
Copy link
Contributor Author

bgilbert commented Jul 22, 2021

Updated! And added the boot ID from coreos/fedora-coreos-config#1128 (comment).

Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

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

Nice work!

@bgilbert bgilbert enabled auto-merge July 22, 2021 19:05
@bgilbert bgilbert merged commit 0395ec3 into coreos:main Jul 22, 2021
@bgilbert bgilbert deleted the state branch July 22, 2021 20:02
bgilbert added a commit to coreos/fedora-coreos-config that referenced this pull request Aug 6, 2021
As of coreos/ignition#1250, Ignition produces
its own report similar to ignition.info.json, so use that instead of
making our own.
HuijingHei pushed a commit to HuijingHei/fedora-coreos-config that referenced this pull request Oct 10, 2023
As of coreos/ignition#1250, Ignition produces
its own report similar to ignition.info.json, so use that instead of
making our own.
HuijingHei pushed a commit to HuijingHei/fedora-coreos-config that referenced this pull request Oct 10, 2023
As of coreos/ignition#1250, Ignition produces
its own report similar to ignition.info.json, so use that instead of
making our own.
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