diff --git a/cmd/image-builder/main.go b/cmd/image-builder/main.go index ac1ee3aa..590e18ec 100644 --- a/cmd/image-builder/main.go +++ b/cmd/image-builder/main.go @@ -189,6 +189,10 @@ func cmdManifestWrapper(pbar progress.ProgressBar, cmd *cobra.Command, args []st if err != nil { return nil, err } + bootcDefaultFs, err := cmd.Flags().GetString("bootc-default-fs") + if err != nil { + return nil, err + } var rpmDownloader osbuild.RpmDownloader if useLibrepo { rpmDownloader = osbuild.RpmDownloaderLibrepo @@ -255,7 +259,7 @@ func cmdManifestWrapper(pbar progress.ProgressBar, cmd *cobra.Command, args []st var img *imagefilter.Result if bootcRef != "" { - distro, err := bootc.NewBootcDistro(bootcRef, nil) + distro, err := bootc.NewBootcDistro(bootcRef, &bootc.DistroOptions{DefaultFs: bootcDefaultFs}) if err != nil { return nil, err } @@ -556,6 +560,7 @@ operating systems like Fedora, CentOS and RHEL with easy customizations support. manifestCmd.Flags().String("bootc-ref", "", `bootc container ref`) manifestCmd.Flags().String("bootc-build-ref", "", `bootc build container ref`) manifestCmd.Flags().String("bootc-installer-payload-ref", "", `bootc installer payload ref`) + manifestCmd.Flags().String("bootc-default-fs", "", `default filesystem to use for the bootc install (e.g. ext4)`) manifestCmd.Flags().Bool("use-librepo", true, `use librepo to download packages (disable if you use old versions of osbuild)`) manifestCmd.Flags().Bool("with-sbom", false, `export SPDX SBOM document`) manifestCmd.Flags().Bool("ignore-warnings", false, `ignore warnings during manifest generation`) diff --git a/test/test_manifest.py b/test/test_manifest.py index ab5d9df0..c77891d8 100644 --- a/test/test_manifest.py +++ b/test/test_manifest.py @@ -161,3 +161,28 @@ def test_manifest_honors_rpmmd_cache(tmp_path, build_container): "--rpmmd-cache", "/rpmmd_cache", ], text=True) assert len(list(rpmmd_cache.rglob("repomd.xml"))) > 0 + + +@pytest.mark.parametrize("bootc_ref,defaultfs", [ + ("quay.io/fedora/fedora-bootc:42", "ext4"), + ("quay.io/centos-bootc/centos-bootc:stream10", ""), + ("quay.io/centos-bootc/centos-bootc:stream9", ""), +]) +def test_container_manifest_bootc_smoke(build_container, bootc_ref, defaultfs): + subprocess.check_call(["podman", "pull", bootc_ref]) + bootc_default_fs = [] + if defaultfs: + bootc_default_fs = ["--bootc-default-fs", defaultfs] + output = subprocess.check_output(podman_run + [ + build_container, + "manifest", + "qcow2", + "--bootc-ref", bootc_ref, + ] + bootc_default_fs, text=True) + manifest = json.loads(output) + assert manifest["version"] == "2" + if defaultfs: + pipeline = [p for p in manifest["pipelines"] if p["name"] == "image"][0] + mkfs_stages = [st for st in pipeline["stages"] + if st["type"] == f"org.osbuild.mkfs.{defaultfs}"] + assert mkfs_stages