osbuild: don't show log output on the terminal
The output makes it hard to see which stage is currently processed and how to enter the build container. Also, it doesn't include all relevant logs. Instead, stream log output into /tmp/output in the build container. Keep outputting it to stdout, so that osbuild can collect it in the future.
This commit is contained in:
parent
ba2a194d5d
commit
7a866aa1c3
2 changed files with 15 additions and 5 deletions
4
osbuild
4
osbuild
|
|
@ -86,7 +86,9 @@ def main(pipeline_path, from_archive, save, sit):
|
|||
f"--bind={os.getcwd()}/stages/{name}:/tmp/stage",
|
||||
"--bind=/etc/pki",
|
||||
"/tmp/run-stage", *opts, "/tmp/stage"],
|
||||
input=options_str, encoding="utf-8", check=True)
|
||||
input=options_str, encoding="utf-8",
|
||||
stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT,
|
||||
check=True)
|
||||
except KeyboardInterrupt:
|
||||
print()
|
||||
print(f"{RESET}{BOLD}{RED}Aborted{RESET}")
|
||||
|
|
|
|||
16
run-stage
16
run-stage
|
|
@ -18,16 +18,24 @@ def main(stage, sit):
|
|||
# directories owned by users that are not set up with systemd-sysusers.
|
||||
subprocess.run(["systemd-tmpfiles", "--create"])
|
||||
|
||||
r = subprocess.run([stage])
|
||||
proc = subprocess.Popen([stage], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, encoding="utf-8")
|
||||
|
||||
if sit and r.returncode != 0:
|
||||
with open("/tmp/output", "w") as output:
|
||||
for line in proc.stdout:
|
||||
sys.stdout.write(line)
|
||||
output.write(line)
|
||||
output.flush()
|
||||
|
||||
returncode = proc.wait()
|
||||
|
||||
if sit and returncode != 0:
|
||||
import signal
|
||||
print()
|
||||
print(f"{RESET}{BOLD}{RED}Stage failed with code {r.returncode}{RESET}")
|
||||
print(f"{RESET}{BOLD}{RED}Stage failed with code {returncode}{RESET}")
|
||||
print("Keeping the build environment running...")
|
||||
signal.pause()
|
||||
|
||||
return r.returncode
|
||||
return returncode
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue