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 edeccca
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 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
14 changes: 11 additions & 3 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 @@ -605,7 +605,7 @@ def test_image_build_without_se_linux_denials(image_type):

@pytest.mark.skipif(platform.system() != "Linux", reason="boot test only runs on linux right now")
@pytest.mark.parametrize("image_type", gen_testcases("anaconda-iso"), indirect=["image_type"])
def test_iso_installs(image_type):
def test_iso_installs(tmp_path, image_type):
installer_iso_path = image_type.img_path
test_disk_path = installer_iso_path.with_name("test-disk.img")
with open(test_disk_path, "w", encoding="utf8") as fp:
Expand All @@ -620,7 +620,15 @@ def test_iso_installs(image_type):
exit_status, _ = vm.run("true", user=image_type.username, password=image_type.password)
assert exit_status == 0
assert_kernel_args(vm, image_type)

# validate that the install.img is squashfs
if not has_executable("unsquashfs"):
pytest.skip("need unsquashfs to check generate install.img")
with ExitStack as cm:
mount_point = tmp_path / "cdrom"
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"])

def osinfo_for(it: ImageBuildResult, arch: str) -> str:
base = "Media is an installer for OS"
Expand Down

0 comments on commit edeccca

Please sign in to comment.