Skip to content

imgtestlib: support bootc-foundry image types#2393

Open
lzap wants to merge 1 commit into
osbuild:mainfrom
lzap:imglib-bootc-pipes1
Open

imgtestlib: support bootc-foundry image types#2393
lzap wants to merge 1 commit into
osbuild:mainfrom
lzap:imglib-bootc-pipes1

Conversation

@lzap
Copy link
Copy Markdown
Contributor

@lzap lzap commented Jun 1, 2026

It looks like recent refactoring broke the boot tests for bootc-foundry images. This commit fixes the issue by updating the image type detection logic to handle the new format.


Solves:

$ test/boot.sh
Booting image from: /home/fedora/~/builds/redhat/services/products/image-builder/ci/bootc-foundry/build/bootc_hummingbird_20251124-aarch64-qcow2-bootc_foundry
Build config: /home/fedora/~/builds/redhat/services/products/image-builder/ci/bootc-foundry/build/bootc_hummingbird_20251124-aarch64-qcow2-bootc_foundry/config.json
Booting image
00:00
Traceback (most recent call last):
  File "/home/fedora/~/builds/redhat/services/products/image-builder/ci/bootc-foundry/_images/./test/scripts/boot-image", line 25, in <module>
    main()
    ~~~~^^
  File "/home/fedora/~/builds/redhat/services/products/image-builder/ci/bootc-foundry/_images/./test/scripts/boot-image", line 21, in main
    testlib.boot_image(search_path, build_config_path, keep)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.14/contextlib.py", line 85, in inner
    return func(*args, **kwds)
  File "/home/fedora/~/builds/redhat/services/products/image-builder/ci/bootc-foundry/_images/test/scripts/imgtestlib/boot.py", line 527, in boot_image
    image_path = find_image_file(search_path)
  File "/home/fedora/~/builds/redhat/services/products/image-builder/ci/bootc-foundry/_images/test/scripts/imgtestlib/core.py", line 373, in find_image_file
    files = os.listdir(os.path.join(build_path, last_pipeline))
FileNotFoundError: [Errno 2] No such file or directory: '/home/fedora/~/builds/redhat/services/products/image-builder/ci/bootc-foundry/build/bootc_hummingbird_20251124-aarch64-qcow2-bootc_foundry/gce'

I do not understand why we do this for bootc manifests, so unsure if this is a proper solution to the problem.

It looks like recent refactoring broke the boot tests for bootc-foundry images.
This commit fixes the issue by updating the image type detection logic to handle
the new format.
@supakeen
Copy link
Copy Markdown
Member

supakeen commented Jun 1, 2026

Which recent refactoring? Tests are failing here.


Found it; it got changed in this commit: 65682dc (cc @achilleas-k) note the change in implementation for find_image_file.

Perhaps we should go back to the previous find_image_file implementation, functionally it does the same as your change here.

def find_image_file(build_path: str) -> str:
    """
    Find the path to the image by reading the manifest and finding the exported pipeline's output directory.
    A manifest may contain multiple pipelines but only one is exported during a build. This function finds the
    exported pipeline by checking which pipeline directory exists in the build output.
    Raises RuntimeError if no or multiple exported directories are found, or if the directory doesn't contain
    exactly one file.
    """
    manifest_file = os.path.join(build_path, "manifest.json")
    with open(manifest_file, encoding="utf-8") as manifest:
        data = json.load(manifest)

    pipeline_names = [p["name"] for p in data["pipelines"] if p["name"] != "build"]
    export_dirs = [p for p in pipeline_names if os.path.isdir(os.path.join(build_path, p))]

    if len(export_dirs) != 1:
        raise RuntimeError(f"Expected exactly one exported pipeline directory in {build_path}, found: {export_dirs}")

    files = os.listdir(os.path.join(build_path, export_dirs[0]))
    if len(files) != 1:
        raise RuntimeError(
            f"Expected exactly one file in export directory '{export_dirs[0]}', found: {files}")

    return os.path.join(build_path, export_dirs[0], files[0])

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants