forked from osbuild/osbuild
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
osbuild: add new
"build":"org.osbuild.containers-storage:..."
This commit adds support to construct a build root for a pipeline from a container instead of a previous pipeline/tree. This is based on the idea from Ondrej in issue 1804. A bootc-image-builder manifest would look something like this: ```json { "version": "2", "pipelines": [ { "name": "image", "build": "org.osbuild.containers-storage:sha256:1234...", ... }, ], "sources": { "org.osbuild.containers-storage": { "items": { f"sha256:1234...": {} } } } } ``` Note that this is just an experiment and needs more thinking how to abstract/generalize this. It is meant as a faster way to do the org.osbuild.deploy-container stage does. We should also probably enforce the uses the container hash instead of a tag when using "build" for a start. Closes: osbuild#1804
- Loading branch information
Showing
5 changed files
with
104 additions
and
4 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
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,47 @@ | ||
import contextlib | ||
import json | ||
import os | ||
import pathlib | ||
import shutil | ||
import subprocess | ||
|
||
import pytest | ||
|
||
from osbuild.testutil import make_container | ||
from .. import test | ||
from .test_exports import osbuild_fixture, testing_libdir_fixture | ||
|
||
|
||
@pytest.mark.skipif(os.getuid() != 0, reason="root-only") | ||
def test_build_root_from_container_registry(osb, tmp_path, testing_libdir): | ||
cnt_ref = "registry.access.redhat.com/ubi9:latest" | ||
with make_container(tmp_path, {"/usr/bin/buildroot-from-container": "foo"}, cnt_ref) as fake_cnt_tag: | ||
img_id = subprocess.check_output(["podman", "inspect", "--format={{.Id}}", fake_cnt_tag], text=True).strip() | ||
jsondata = json.dumps({ | ||
"version": "2", | ||
"pipelines": [ | ||
{ | ||
"name": "image", | ||
"build": f"org.osbuild.containers-storage:sha256:{img_id}", | ||
"stages": [ | ||
{ | ||
"type": "org.osbuild.testing.injectpy", | ||
"options": { | ||
"code": [ | ||
'import os.path', | ||
'assert os.path.exists("/usr/bin/buildroot-from-container")', | ||
], | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
"sources": { | ||
"org.osbuild.containers-storage": { | ||
"items": { | ||
f"sha256:{img_id}": {} | ||
} | ||
} | ||
} | ||
}) | ||
osb.compile(jsondata, output_dir=tmp_path, exports=["image"], libdir=testing_libdir) |
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