Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mcl/ci_matrix): Quit on error #153

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions packages/mcl/src/src/mcl/commands/ci_matrix.d
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,13 @@ static immutable string[] uselessWarnings =
"Please note that certain features, such as the test framework, may not function properly with the legacy table type.",
"If you encounter errors similar to:",
"error: The option `disko.devices.disk.disk1.content.partitions",
"this is likely due to the use of the legacy table type."
"this is likely due to the use of the legacy table type.",
"warning: system.stateVersion is not set, defaulting to",
"warning: Runner registration tokens have been deprecated and disabled by default in GitLab >= 17.0.",
"Consider migrating to runner authentication tokens by setting `services.gitlab-runner.services.codetracer.authenticationTokenConfigFile`.",
"https://docs.gitlab.com/17.0/ee/ci/runners/new_creation_workflow.html"
"for a migration you can follow the guide at https://github.com/nix-community/disko/blob/master/docs/table-to-gpt.md"

];

Package packageFromNixEvalJobsJson(
Expand Down Expand Up @@ -308,6 +314,8 @@ Package[] nixEvalJobs(string flakeAttrPrefix, string cachixUrl, bool doCheck = t
{
Package[] result = [];

bool hasError = false;

int maxMemoryMB = getAvailableMemoryMB();
int maxWorkers = getNixEvalWorkerCount();

Expand All @@ -333,6 +341,7 @@ Package[] nixEvalJobs(string flakeAttrPrefix, string cachixUrl, bool doCheck = t
if (line.indexOf("{") == -1)
{
errorf("Expected JSON object on stdout from nix-eval-jobs, got: `%s`", line);
hasError = true;
continue;
}

Expand All @@ -341,6 +350,7 @@ Package[] nixEvalJobs(string flakeAttrPrefix, string cachixUrl, bool doCheck = t
if (auto err = "error" in json)
{
logError((*err).str);
hasError = true;
continue; // drain the output
}

Expand All @@ -367,14 +377,14 @@ Package[] nixEvalJobs(string flakeAttrPrefix, string cachixUrl, bool doCheck = t
}
foreach (line; pipes.stderr.byLine)
{
if (uselessWarnings.map!((warning) => line.indexOf(warning) != -1).any)
if (line.trim == "" || uselessWarnings.map!((warning) => line.indexOf(warning) != -1).any)
continue;

logError(line.idup);
}

int status = wait(pipes.pid);
enforce(status == 0, "Command `%s` failed with status %s".fmt(args, status));
enforce(!hasError && status == 0, "Command `%s` failed with status %s".fmt(args, status));

return result;
}
Expand Down
Loading