-
-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Output evaluation errors without crashing if aggregate job is broken.
At the moment, aggregate jobs can easily break and cause the entire evaluation to fail, which is not ideal. For Nixpkgs, we do have some important aggregate jobs (like `tested`), but for debugging and building purposes it's still useful to get a partial result even if the channel won't actually advance. This commit changes the behaviour of hydra-eval-jobs such that it aggregates any errors found during the construction of an aggregate, and will instead annotate the job with the evaluation failure such that it shows up in a "cleaner" way. There are really two types of failure that we care about: one is where the attribute just ends up missing altogether in the final output, and also where the attribute is in the output but fails to evaluate. Both are handled here. Note that this does mean that the same error message may be output multiple times, but this aids debuggability because it'll be much clearer what's blocking the job from being created.
- Loading branch information
Showing
3 changed files
with
96 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
with import ./config.nix; | ||
{ | ||
broken = mkDerivation { | ||
name = "broken"; | ||
_hydraAggregate = true; | ||
constituents = [ | ||
"does-not-exist" | ||
"does-not-evaluate" | ||
]; | ||
builder = ./fail.sh; | ||
}; | ||
|
||
# does-not-exist doesn't exist. | ||
|
||
does-not-evaluate = assert false; {}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use feature 'unicode_strings'; | ||
use strict; | ||
use Setup; | ||
|
||
my %ctx = test_init(); | ||
|
||
require Hydra::Schema; | ||
require Hydra::Model::DB; | ||
|
||
use Test2::V0; | ||
|
||
my $db = Hydra::Model::DB->new; | ||
hydra_setup($db); | ||
|
||
my $project = $db->resultset('Projects')->create({name => "tests", displayname => "", owner => "root"}); | ||
|
||
my $jobset = createBaseJobset("broken-constituent", "broken-constituent.nix", $ctx{jobsdir}); | ||
|
||
ok(evalSucceeds($jobset), "Evaluating jobs/broken-constituent.nix should exit with return code 0"); | ||
is(nrQueuedBuildsForJobset($jobset), 0, "Evaluating jobs/broken-constituent.nix should not queue any builds"); | ||
|
||
like( | ||
$jobset->errormsg, | ||
qr/^does-not-exist: does not exist$/m, | ||
"Evaluating jobs/broken-constituent.nix should log an error for does-not-exist"); | ||
like( | ||
$jobset->errormsg, | ||
qr/^does-not-evaluate: error: assertion 'false' failed$/m, | ||
"Evaluating jobs/broken-constituent.nix should log an error for does-not-evaluate"); | ||
|
||
done_testing; |