Skip to content

Commit

Permalink
fix: remove the container once it has failed
Browse files Browse the repository at this point in the history
This is a minor fix that removes failed containers, before the report_error function,
to free up what little space they would occupy in ram until the timeout.
  • Loading branch information
a-gave authored and aparcar committed Feb 8, 2025
1 parent 8d1cce1 commit 70d84c6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions asu/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def build(build_request: BuildRequest, job=None):
container, ["sh", "setup.sh"]
)
if returncode:
container.kill()
report_error(job, "Could not set up ImageBuilder")

returncode, job.meta["stdout"], job.meta["stderr"] = run_cmd(
Expand Down Expand Up @@ -240,6 +241,7 @@ def build(build_request: BuildRequest, job=None):
job.save_meta()

if returncode:
container.kill()
report_error(job, "Impossible package selection")

manifest: dict[str, str] = parse_manifest(job.meta["stdout"])
Expand Down Expand Up @@ -285,9 +287,11 @@ def build(build_request: BuildRequest, job=None):
job.save_meta()

if any(err in job.meta["stderr"] for err in ["is too big", "out of space?"]):
container.kill()
report_error(job, "Selected packages exceed device storage")

if returncode:
container.kill()
report_error(job, "Error while building firmware. See stdout/stderr")

json_file = bin_dir / "profiles.json"
Expand Down

0 comments on commit 70d84c6

Please sign in to comment.