osbuild: add "assembler"
An assembler is a stage that may have outputs. It is the only stage that gets the output_dir argument passed (and not input_dir).
This commit is contained in:
parent
88c1f7be3b
commit
170eadde04
1 changed files with 28 additions and 15 deletions
43
osbuild
43
osbuild
|
|
@ -99,6 +99,27 @@ class BuildRoot:
|
||||||
self.unmount()
|
self.unmount()
|
||||||
|
|
||||||
|
|
||||||
|
def run_stage_interactive(i, name, options, buildroot, input_dir=None, output_dir=None, sit=False):
|
||||||
|
print()
|
||||||
|
print(f"{RESET}{BOLD}{i}. {name}{RESET} " + json.dumps(options or {}, indent=2))
|
||||||
|
print("Inspect with:")
|
||||||
|
print(f"\t# nsenter -a --wd=/root -t `machinectl show {buildroot.machine_name} -p Leader --value`")
|
||||||
|
print()
|
||||||
|
|
||||||
|
try:
|
||||||
|
buildroot.run_stage(name, options, input_dir, output_dir, sit)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print()
|
||||||
|
print(f"{RESET}{BOLD}{RED}Aborted{RESET}")
|
||||||
|
return False
|
||||||
|
except subprocess.CalledProcessError as error:
|
||||||
|
print()
|
||||||
|
print(f"{RESET}{BOLD}{RED}{name} failed with code {error.returncode}{RESET}")
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def main(pipeline_path, input_dir, output_dir, sit):
|
def main(pipeline_path, input_dir, output_dir, sit):
|
||||||
if output_dir and len(os.listdir(output_dir)) != 0:
|
if output_dir and len(os.listdir(output_dir)) != 0:
|
||||||
print()
|
print()
|
||||||
|
|
@ -112,22 +133,14 @@ def main(pipeline_path, input_dir, output_dir, sit):
|
||||||
for i, stage in enumerate(pipeline["stages"], start=1):
|
for i, stage in enumerate(pipeline["stages"], start=1):
|
||||||
name = stage["name"]
|
name = stage["name"]
|
||||||
options = stage.get("options", {})
|
options = stage.get("options", {})
|
||||||
|
if not run_stage_interactive(i, name, options, buildroot, input_dir=input_dir, sit=sit):
|
||||||
|
return 1
|
||||||
|
|
||||||
print()
|
assembler = pipeline.get("assembler")
|
||||||
print(f"{RESET}{BOLD}{i}. {name}{RESET} " + json.dumps(options, indent=2))
|
if assembler:
|
||||||
print("Inspect with:")
|
name = assembler["name"]
|
||||||
print(f"\t# nsenter -a --wd=/root -t `machinectl show {buildroot.machine_name} -p Leader --value`")
|
options = assembler.get("options", {})
|
||||||
print()
|
if not run_stage_interactive("A", name, options, buildroot, output_dir=output_dir, sit=sit):
|
||||||
|
|
||||||
try:
|
|
||||||
buildroot.run_stage(name, options, input_dir, output_dir, sit)
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
print()
|
|
||||||
print(f"{RESET}{BOLD}{RED}Aborted{RESET}")
|
|
||||||
return 130
|
|
||||||
except subprocess.CalledProcessError as error:
|
|
||||||
print()
|
|
||||||
print(f"{RESET}{BOLD}{RED}{name} failed with code {error.returncode}{RESET}")
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue