-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bib: implemnt
bootc-image-builder manifest
Now that we have a `bootc-image-builder build` verb we can have a `manifest` one as well that just generates the manifest but does not do the full building. This is mostly useful for testing so it's not exposed by default in the entrypoint (for now).
- Loading branch information
1 parent
220a974
commit 1b3b653
Showing
4 changed files
with
110 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import os | ||
import subprocess | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture(name="build_container", scope="session") | ||
def build_container_fixture(): | ||
"""Build a container from the Containerfile and returns the name""" | ||
if tag_from_env := os.getenv("BIB_TEST_BUILD_CONTAINER_TAG"): | ||
return tag_from_env | ||
|
||
container_tag = "bootc-image-builder-test" | ||
subprocess.check_call([ | ||
"podman", "build", | ||
"-f", "Containerfile", | ||
"-t", container_tag, | ||
]) | ||
return container_tag | ||
|
||
|
||
def container_to_build_ref(): | ||
# TODO: make this another indirect fixture input, e.g. by making | ||
# making "image_type" an "image" tuple (type, container_ref_to_test) | ||
return os.getenv( | ||
"BIB_TEST_BOOTC_CONTAINER_TAG", | ||
"quay.io/centos-bootc/fedora-bootc:eln", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import json | ||
import subprocess | ||
|
||
import pytest | ||
|
||
import testutil | ||
|
||
|
||
if not testutil.has_executable("podman"): | ||
pytest.skip("no podman, skipping integration tests that required podman", allow_module_level=True) | ||
|
||
from containerbuild import build_container_fixture, container_to_build_ref # noqa: F401 | ||
|
||
|
||
def test_manifest_smoke(build_container): | ||
output = subprocess.check_output([ | ||
"podman", "run", "--rm", | ||
f'--entrypoint=["/usr/bin/bootc-image-builder", "manifest", "{container_to_build_ref()}"]', | ||
build_container, | ||
]) | ||
manifest = json.loads(output) | ||
# just some basic validation | ||
assert manifest["version"] == "2" | ||
assert manifest["pipelines"][0]["name"] == "build" |