forked from mtusi2026/mtusi2026lab3
Preserve failed scaling setup logs with revision metadata
This commit is contained in:
+3
-1
@@ -215,9 +215,11 @@ def apply(base, settings, env, out):
|
|||||||
compose("up", "-d", "--wait", "--wait-timeout", "180", env=env)
|
compose("up", "-d", "--wait", "--wait-timeout", "180", env=env)
|
||||||
break
|
break
|
||||||
except subprocess.CalledProcessError as error:
|
except subprocess.CalledProcessError as error:
|
||||||
log = Path(out) / "compose-up-failed.log"
|
log = Path(out) / "compose-up-failed.txt"
|
||||||
with log.open("a") as handle:
|
with log.open("a") as handle:
|
||||||
stamp = time.strftime("%FT%TZ", time.gmtime())
|
stamp = time.strftime("%FT%TZ", time.gmtime())
|
||||||
|
commit = subprocess.check_output(["git", "rev-parse", "HEAD"], text=True).strip()
|
||||||
|
handle.write(f"date: {stamp} commit: {commit}\n")
|
||||||
handle.write(f"== {stamp} {base} attempt {attempt + 1}\n")
|
handle.write(f"== {stamp} {base} attempt {attempt + 1}\n")
|
||||||
handle.write(error.stdout + error.stderr + "\n")
|
handle.write(error.stdout + error.stderr + "\n")
|
||||||
print(json.dumps({"compose_up_failed": attempt + 1, "log": str(log)}))
|
print(json.dumps({"compose_up_failed": attempt + 1, "log": str(log)}))
|
||||||
|
|||||||
Reference in New Issue
Block a user