-
Notifications
You must be signed in to change notification settings - Fork 154
cli: add install print-configuration --all
#1820
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces an --all flag to the install print-configuration command, allowing it to output all configuration options, including those usually filtered out like kernel arguments. The changes are well-implemented and straightforward. My main feedback is to suggest adding a unit test to ensure the new flag is parsed correctly, which will help with future maintenance.
| /// At the current time, the only output key is `root-fs-type` which is a string-valued | ||
| /// filesystem name suitable for passing to `mkfs.$type`. | ||
| PrintConfiguration, | ||
| PrintConfiguration(crate::install::InstallPrintConfigurationOpts), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the change itself is correct, it would be beneficial to add a unit test to verify the parsing of the new --all flag for the install print-configuration subcommand. This ensures future changes don't accidentally break this functionality.
You could add a new test function in the tests module of this file, similar to test_parse_install_args. For example:
#[test]
fn test_parse_print_configuration() {
// Default, no --all
let o = Opt::try_parse_from(["bootc", "install", "print-configuration"]).unwrap();
let o = match o {
Opt::Install(InstallOpts::PrintConfiguration(opts)) => opts,
o => panic!("Expected print-configuration opts, not {o:?}"),
};
assert!(!o.all);
// With --all
let o = Opt::try_parse_from(["bootc", "install", "print-configuration", "--all"]).unwrap();
let o = match o {
Opt::Install(InstallOpts::PrintConfiguration(opts)) => opts,
o => panic!("Expected print-configuration opts, not {o:?}"),
};
assert!(o.all);
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are good, but we can't really do this in unit tests because it operates on ambient data.
We can do it in tests-integration/src/container.rs though I think.
913dd6d to
67f07dc
Compare
|
cc #1827 - I think image builder actually wants that because we do want to capture kargs from kargs.d, not just the install config (which is scoped to day 1 only). |
cgwalters
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing DCO
Though on the structure of things, I would also say that (as you may know) my real preference here is that we cut over how we build the ISO to itself be a bootc image even at a deeper level. For example...one idea here is that on EFI platforms we use a UKI, and when we do that we'd end up rendering the kargs into that instead in which case they don't need to be provided out of band.
| kargs: Vec<String>, | ||
| } | ||
|
|
||
| let config_d = std::path::Path::new("/run/bootc/install/"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine, though I guess probably what we really need here is a workflow that combines container build + test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, it would be nice to have a combined build+test here. I can remove this part of the code again, its a bit unnecessary because the default container already has some kargs I can test for. I wanted to make this is a test-as-example thing so wanted to include the code that writes the toml but maybe I was overthinking it :) Either way is fine with me!
When `install print-configuration` is run some options (notably the kargs) are currently filtered out. This makes sense because in general `bootc install to-filesystem` takes care of them. However with the recent work in image-builder/osbuild to use bootc containers directly as inputs to build ISOs [0],[1] we would like to get access to the kernel args too because when constructing a bootable ISO we also want to add the bootc container kargs. [0] https://github.com/orgs/osbuild/discussions/45 [1] osbuild/images#1906 Signed-off-by: Michael Vogt <[email protected]>
This adds a simple integration test for ``` $ bootc install print-configuration --all ``` in the container tests. Thanks to Colin for suggesting this. Signed-off-by: Michael Vogt <[email protected]>
67f07dc to
714091f
Compare
When
install print-configurationis run some options (notably the kargs) are currently filtered out. This makes sense because in generalbootc install to-filesystemtakes care of them.However with the recent work in image-builder/osbuild to use bootc containers directly as inputs to build ISOs [0],[1] we would like to get access to the kernel args too because when constructing a bootable ISO we also want to add the bootc container kargs.
[0] https://github.com/orgs/osbuild/discussions/45
[1] osbuild/images#1906