Skip to content

Commit

Permalink
bib: use squashfs for the intermediate image
Browse files Browse the repository at this point in the history
This commit moves to the new squashfs image support in the `images`
library (c.f. osbuild/images#1105)

Closes: #733
  • Loading branch information
mvo5 committed Jan 6, 2025
1 parent 1b44549 commit 4cd30c8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
- name: Install test dependencies
run: |
sudo apt update
sudo apt install -y python3-pytest python3-paramiko python3-boto3 flake8 qemu-system-x86 qemu-efi-aarch64 qemu-system-arm qemu-user-static pylint libosinfo-bin
sudo apt install -y python3-pytest python3-paramiko python3-boto3 flake8 qemu-system-x86 qemu-efi-aarch64 qemu-system-arm qemu-user-static pylint libosinfo-bin squashfs-tools
- name: Diskspace (before)
run: |
df -h
Expand Down
4 changes: 3 additions & 1 deletion bib/cmd/bootc-image-builder/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,9 @@ 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.SquashfsCompression = "lz4"
img.RootfsType = manifest.SquashfsRootfs
img.Filename = "install.iso"

mf := manifest.New()
Expand Down
17 changes: 15 additions & 2 deletions test/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -621,7 +621,6 @@ def test_iso_installs(image_type):
assert exit_status == 0
assert_kernel_args(vm, image_type)


def osinfo_for(it: ImageBuildResult, arch: str) -> str:
base = "Media is an installer for OS"
if it.container_ref.endswith("/centos-bootc/centos-bootc:stream9"):
Expand Down Expand Up @@ -654,6 +653,20 @@ 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 a valid squashfs
subprocess.check_call(["unsquashfs", "-ls", mount_point / "images/install.img"])


@pytest.mark.parametrize("images", gen_testcases("multidisk"), indirect=["images"])
def test_multi_build_request(images):
artifacts = set()
Expand Down

0 comments on commit 4cd30c8

Please sign in to comment.