Treat outputs like we treat trees: store them in the object store. This simplifies using osbuild and allows returning a cached version if one is available. This makes the `--output` parameter redundant. Remove it.
28 lines
868 B
Python
28 lines
868 B
Python
import json
|
|
import logging
|
|
import subprocess
|
|
import sys
|
|
|
|
from .config import *
|
|
|
|
|
|
def run_osbuild(pipeline: str, build_pipeline: str):
|
|
cmd = OSBUILD + ["--json", "--store", OBJECTS, pipeline]
|
|
if build_pipeline:
|
|
cmd += ["--build-pipeline", build_pipeline]
|
|
logging.info(f"Running osbuild: {cmd}")
|
|
osbuild = subprocess.run(cmd, capture_output=True)
|
|
if osbuild.returncode != 0:
|
|
logging.error(f"{RED}osbuild failed!{RESET}")
|
|
print(f"{BOLD}STDERR{RESET}")
|
|
print(osbuild.stderr.decode())
|
|
print(f"{BOLD}STDOUT{RESET}")
|
|
print(osbuild.stdout.decode())
|
|
sys.exit(1)
|
|
|
|
result = json.loads(osbuild.stdout.decode())
|
|
return result["tree_id"], result.get("output_id")
|
|
|
|
|
|
def build_testing_image(pipeline_full_path, build_pipeline_full_path):
|
|
run_osbuild(pipeline_full_path, build_pipeline_full_path)
|