generate-test-cases: export flag for osbuild call
osbuild requires the export flag otherwise it wont produce an artifact. For the older manifest format (v1), the export value is always "assembler". For v2 manifests, it is the name of the last pipeline. If an unknown version number is read the script now fails. This should help catch manifest changes that may affect test case generation in the future.
This commit is contained in:
parent
0f5936e9fe
commit
28aaa129ff
1 changed files with 13 additions and 3 deletions
|
|
@ -17,13 +17,14 @@ def get_subprocess_stdout(*args, **kwargs):
|
|||
return sp.stdout
|
||||
|
||||
|
||||
def run_osbuild(manifest, store, output):
|
||||
def run_osbuild(manifest, store, output, export):
|
||||
with tempfile.TemporaryFile(dir="/tmp", prefix="osbuild-test-case-generator-", suffix=".log") as log:
|
||||
try:
|
||||
subprocess.run(["osbuild",
|
||||
"--store", store,
|
||||
"--output-directory", output,
|
||||
"--checkpoint", "build"
|
||||
"--export", export,
|
||||
"-"],
|
||||
stdout=log,
|
||||
stderr=subprocess.STDOUT,
|
||||
|
|
@ -70,8 +71,17 @@ class TestCaseGenerator:
|
|||
|
||||
if no_image_info == False:
|
||||
with tempfile.TemporaryDirectory(dir=store, prefix="test-case-output-") as output:
|
||||
run_osbuild(self.test_case["manifest"], store, output)
|
||||
image_file = os.path.join(output, self.test_case["compose-request"]["filename"])
|
||||
manifest = self.test_case["manifest"]
|
||||
version = manifest.get("version", "1")
|
||||
if version == "1":
|
||||
export = "assembler"
|
||||
elif version == "2":
|
||||
export = manifest["pipelines"][-1]["name"]
|
||||
else:
|
||||
print(f"Unknown manifest format version {version}")
|
||||
sys.exit(1)
|
||||
run_osbuild(manifest, store, output, export)
|
||||
image_file = os.path.join(output, export, self.test_case["compose-request"]["filename"])
|
||||
image_info = get_subprocess_stdout(["tools/image-info", image_file], encoding="utf-8")
|
||||
self.test_case["image-info"] = json.loads(image_info)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue