ibcli: add new --output-name flag

This commit adds a new `--output-name` flag that will rename
the resulting artifact after it was build. All auxillary artifacts
like buildlog, sbom etc are also name based on the same basename.

See also https://github.com/osbuild/images/pull/1039 for how
this could be simpler (especially the fake osbuild).

Closes: https://github.com/osbuild/image-builder-cli/issues/43
This commit is contained in:
Michael Vogt 2025-03-13 17:30:59 +01:00 committed by Simon de Vlieger
parent 8635a22ad9
commit ccb4269b62
6 changed files with 194 additions and 60 deletions

View file

@ -22,7 +22,8 @@ def test_container_builds_image(tmp_path, build_container, use_librepo):
f"--use-librepo={use_librepo}",
])
arch = "x86_64"
assert (output_dir / f"centos-9-minimal-raw-{arch}/xz/disk.raw.xz").exists()
basename = f"centos-9-minimal-raw-{arch}"
assert (output_dir / basename / f"{basename}.raw.xz").exists()
# XXX: ensure no other leftover dirs
dents = os.listdir(output_dir)
assert len(dents) == 1, f"too many dentries in output dir: {dents}"
@ -88,8 +89,9 @@ def test_container_with_progress(tmp_path, build_fake_container, progress, needl
"-v", f"{output_dir}:/output",
build_fake_container,
"build",
"minimal-raw",
"qcow2",
"--distro", "centos-9",
"--output-dir=.",
f"--progress={progress}",
], text=True)
assert needle in output