From e903cec40fed284a9222d73e4bd959f1a4caf868 Mon Sep 17 00:00:00 2001 From: Martin Ivanov Date: Wed, 23 Oct 2024 22:20:24 +0300 Subject: [PATCH] fix(mcl): Fail job on nix-eval-jobs failure --- packages/mcl/src/src/mcl/commands/ci_matrix.d | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/mcl/src/src/mcl/commands/ci_matrix.d b/packages/mcl/src/src/mcl/commands/ci_matrix.d index 1671a30a..cb143767 100755 --- a/packages/mcl/src/src/mcl/commands/ci_matrix.d +++ b/packages/mcl/src/src/mcl/commands/ci_matrix.d @@ -334,6 +334,8 @@ Package[] nixEvalJobs(string flakeAttrPrefix, string cachixUrl, bool doCheck = t errorf("Command `%s` failed with error:\n---\n%s\n---", commandString, errorMsg); } + bool jobFailed = false; + foreach (line; pipes.stdout.byLine) { if (line.indexOf("{") == -1) @@ -347,6 +349,7 @@ Package[] nixEvalJobs(string flakeAttrPrefix, string cachixUrl, bool doCheck = t if (auto err = "error" in json) { logError((*err).str); + jobFailed = true; continue; // drain the output } @@ -380,7 +383,8 @@ Package[] nixEvalJobs(string flakeAttrPrefix, string cachixUrl, bool doCheck = t logWarning(stderrLogs); int status = wait(pipes.pid); - enforce(status == 0, "Command `%s` failed with status %s".fmt(args, status)); + jobFailed = jobFailed || status != 0; + enforce(!jobFailed, "Command `%s` failed with status %s".fmt(commandString, status)); return result; }