File tree Expand file tree Collapse file tree 4 files changed +33
-3
lines changed Expand file tree Collapse file tree 4 files changed +33
-3
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ jobs:
106
106
name : " Container testing"
107
107
needs : build-fedora
108
108
runs-on : ubuntu-latest
109
- container : quay.io/fedora /fedora-coreos:testing-devel
109
+ container : quay.io/centos-bootc /fedora-bootc:eln
110
110
steps :
111
111
- name : Download
112
112
uses : actions/download-artifact@v3
Original file line number Diff line number Diff line change @@ -118,6 +118,13 @@ pub(crate) enum InstallOpts {
118
118
ToDisk ( crate :: install:: InstallToDiskOpts ) ,
119
119
/// Install to the target filesystem
120
120
ToFilesystem ( crate :: install:: InstallToFilesystemOpts ) ,
121
+ /// Output JSON to stdout that contains the merged installation configuration
122
+ /// as it may be relevant to calling processes using `install to-filesystem`
123
+ /// that want to honor e.g. `root-fs-type`.
124
+ ///
125
+ /// At the current time, the only output key is `root-fs-type` which is a string-valued
126
+ /// filesystem name suitable for passing to `mkfs.$type`.
127
+ PrintConfiguration ,
121
128
}
122
129
123
130
/// Options for man page generation
@@ -522,6 +529,7 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
522
529
Opt :: Install ( opts) => match opts {
523
530
InstallOpts :: ToDisk ( opts) => crate :: install:: install_to_disk ( opts) . await ,
524
531
InstallOpts :: ToFilesystem ( opts) => crate :: install:: install_to_filesystem ( opts) . await ,
532
+ InstallOpts :: PrintConfiguration => crate :: install:: print_configuration ( ) ,
525
533
} ,
526
534
#[ cfg( feature = "install" ) ]
527
535
Opt :: ExecInHostMountNamespace { args } => {
Original file line number Diff line number Diff line change 6
6
7
7
// This sub-module is the "basic" installer that handles creating basic block device
8
8
// and filesystem setup.
9
- mod baseline;
9
+ pub ( crate ) mod baseline;
10
10
11
11
use std:: io:: BufWriter ;
12
12
use std:: io:: Write ;
@@ -429,6 +429,13 @@ impl SourceInfo {
429
429
}
430
430
}
431
431
432
+ pub ( crate ) fn print_configuration ( ) -> Result < ( ) > {
433
+ let mut install_config = config:: load_config ( ) ?;
434
+ install_config. filter_to_external ( ) ;
435
+ let stdout = std:: io:: stdout ( ) . lock ( ) ;
436
+ serde_json:: to_writer ( stdout, & install_config) . map_err ( Into :: into)
437
+ }
438
+
432
439
pub ( crate ) mod config {
433
440
use super :: * ;
434
441
@@ -447,6 +454,7 @@ pub(crate) mod config {
447
454
/// Root filesystem type
448
455
pub ( crate ) root_fs_type : Option < super :: baseline:: Filesystem > ,
449
456
/// Kernel arguments, applied at installation time
457
+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
450
458
pub ( crate ) kargs : Option < Vec < String > > ,
451
459
}
452
460
@@ -465,6 +473,11 @@ pub(crate) mod config {
465
473
. extend ( other_kargs)
466
474
}
467
475
}
476
+
477
+ // Remove all configuration which is handled by `install to-filesystem`.
478
+ pub ( crate ) fn filter_to_external ( & mut self ) {
479
+ self . kargs . take ( ) ;
480
+ }
468
481
}
469
482
470
483
#[ context( "Loading configuration" ) ]
Original file line number Diff line number Diff line change 1
1
use std:: process:: Command ;
2
2
3
- use anyhow:: Result ;
3
+ use anyhow:: { Context , Result } ;
4
4
use camino:: Utf8Path ;
5
5
use fn_error_context:: context;
6
6
use rustix:: fd:: AsFd ;
7
7
use xshell:: { cmd, Shell } ;
8
8
9
9
use crate :: blockdev:: LoopbackDevice ;
10
+ use crate :: install:: config:: InstallConfiguration ;
10
11
11
12
use super :: cli:: TestingOpts ;
12
13
use super :: spec:: Host ;
@@ -98,6 +99,14 @@ pub(crate) fn impl_run_container() -> Result<()> {
98
99
let stderr = String :: from_utf8 ( o. stderr ) ?;
99
100
assert ! ( stderr. contains( "requires root privileges" ) ) ;
100
101
102
+ let config = cmd ! ( sh, "bootc install print-configuration" ) . read ( ) ?;
103
+ let config: InstallConfiguration =
104
+ serde_json:: from_str ( & config) . context ( "Parsing install config" ) ?;
105
+ assert_eq ! (
106
+ config. root_fs_type. unwrap( ) ,
107
+ crate :: install:: baseline:: Filesystem :: Xfs
108
+ ) ;
109
+
101
110
println ! ( "ok container integration testing" ) ;
102
111
Ok ( ( ) )
103
112
}
You can’t perform that action at this time.
0 commit comments