From e2acfa8a0e4038c8aa3cb9b2a10fb0a744df7cd6 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 6 Jan 2025 11:28:05 +0100 Subject: [PATCH] bib: use plain squashfs for the ISO rootfs This commit moves to the new "flat" squashfs rootfs image that is now available in the `images` library (c.f. https://github.com/osbuild/images/pull/1105). This will ensures we are no longer using the previous "ext4" intermediate image that gave problems for big rootfses. Closes: https://github.com/osbuild/bootc-image-builder/issues/733 --- .github/workflows/tests.yml | 2 +- bib/cmd/bootc-image-builder/image.go | 3 ++- test/test_build.py | 18 +++++++++++++++++- test/test_manifest.py | 2 +- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0a5cc063b..a253e66aa 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -79,7 +79,7 @@ jobs: - name: Install test dependencies run: | sudo apt update - sudo apt install -y python3-pytest python3-paramiko python3-boto3 flake8 pylint libosinfo-bin + sudo apt install -y python3-pytest python3-paramiko python3-boto3 flake8 pylint libosinfo-bin squashfs-tools - name: Diskspace (before) run: | df -h diff --git a/bib/cmd/bootc-image-builder/image.go b/bib/cmd/bootc-image-builder/image.go index c16fe245f..c34bb93fc 100644 --- a/bib/cmd/bootc-image-builder/image.go +++ b/bib/cmd/bootc-image-builder/image.go @@ -518,7 +518,8 @@ func manifestForISO(c *ManifestConfig, rng *rand.Rand) (*manifest.Manifest, erro default: return nil, fmt.Errorf("unsupported architecture %v", c.Architecture) } - + // see https://github.com/osbuild/bootc-image-builder/issues/733 + img.RootfsType = manifest.SquashfsRootfs img.Filename = "install.iso" mf := manifest.New() diff --git a/test/test_build.py b/test/test_build.py index 193f466b2..c8ab91516 100644 --- a/test/test_build.py +++ b/test/test_build.py @@ -9,7 +9,7 @@ import subprocess import tempfile import uuid -from contextlib import contextmanager +from contextlib import contextmanager, ExitStack from typing import NamedTuple from dataclasses import dataclass @@ -654,6 +654,22 @@ def test_iso_os_detection(image_type): assert osinfo_output == expected_output +@pytest.mark.skipif(platform.system() != "Linux", reason="osinfo detect test only runs on linux right now") +@pytest.mark.skipif(not testutil.has_executable("unsquashfs"), reason="need unsquashfs") +@pytest.mark.parametrize("image_type", gen_testcases("anaconda-iso"), indirect=["image_type"]) +def test_iso_install_img_is_squashfs(tmp_path, image_type): + installer_iso_path = image_type.img_path + with ExitStack() as cm: + mount_point = tmp_path / "cdrom" + mount_point.mkdir() + subprocess.check_call(["mount", installer_iso_path, os.fspath(mount_point)]) + cm.callback(subprocess.check_call, ["umount", os.fspath(mount_point)]) + # ensure install.img is the "flat" squashfs, before PR#777 the content + # was an intermediate ext4 image "squashfs-root/LiveOS/rootfs.img" + output = subprocess.check_output(["unsquashfs", "-ls", mount_point / "images/install.img"], text=True) + assert "usr/bin/bootc" in output + + @pytest.mark.parametrize("images", gen_testcases("multidisk"), indirect=["images"]) def test_multi_build_request(images): artifacts = set() diff --git a/test/test_manifest.py b/test/test_manifest.py index 6c4712b09..4ad3af1a8 100644 --- a/test/test_manifest.py +++ b/test/test_manifest.py @@ -58,7 +58,7 @@ def test_iso_manifest_smoke(build_container, tc): ]) manifest = json.loads(output) # just some basic validation - expected_pipeline_names = ["build", "anaconda-tree", "rootfs-image", "efiboot-tree", "bootiso-tree", "bootiso"] + expected_pipeline_names = ["build", "anaconda-tree", "efiboot-tree", "bootiso-tree", "bootiso"] assert manifest["version"] == "2" assert [pipeline["name"] for pipeline in manifest["pipelines"]] == expected_pipeline_names