Skip to content

Commit

Permalink
Merge pull request #1374 from Mindavi/bugfix/rendering-issue-content-…
Browse files Browse the repository at this point in the history
…addressed

ca-derivations: fix rendering issue
  • Loading branch information
Ericson2314 committed Apr 18, 2024
2 parents ef7bf1e + 3f913a7 commit 8b48579
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/lib/Hydra/Helper/Nix.pm
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ sub findLog {

return undef if scalar @outPaths == 0;

# Filter out any NULLs. Content-addressed derivations
# that haven't built yet or failed to build may have a NULL outPath.
@outPaths = grep {defined} @outPaths;

my @steps = $c->model('DB::BuildSteps')->search(
{ path => { -in => [@outPaths] } },
{ select => ["drvpath"]
Expand Down
6 changes: 4 additions & 2 deletions t/content-addressed/basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ my $project = $db->resultset('Projects')->create({name => "tests", displayname =
my $jobset = createBaseJobset("content-addressed", "content-addressed.nix", $ctx{jobsdir});

ok(evalSucceeds($jobset), "Evaluating jobs/content-addressed.nix should exit with return code 0");
is(nrQueuedBuildsForJobset($jobset), 5, "Evaluating jobs/content-addressed.nix should result in 4 builds");
is(nrQueuedBuildsForJobset($jobset), 6, "Evaluating jobs/content-addressed.nix should result in 6 builds");

for my $build (queuedBuildsForJobset($jobset)) {
ok(runBuild($build), "Build '".$build->job."' from jobs/content-addressed.nix should exit with code 0");
my $newbuild = $db->resultset('Builds')->find($build->id);
is($newbuild->finished, 1, "Build '".$build->job."' from jobs/content-addressed.nix should be finished.");
my $expected = $build->job eq "fails" ? 1 : $build->job =~ /with_failed/ ? 6 : 0;
my $expected = $build->job eq "fails" ? 1 : $build->job =~ /with_failed/ ? 6 : $build->job =~ /FailingCA/ ? 2 : 0;
is($newbuild->buildstatus, $expected, "Build '".$build->job."' from jobs/content-addressed.nix should have buildstatus $expected.");

my $response = request("/build/".$build->id);
Expand All @@ -55,6 +55,8 @@ for my $build (queuedBuildsForJobset($jobset)) {

}

# XXX: deststoredir is undefined: Use of uninitialized value $ctx{"deststoredir"} in concatenation (.) or string at t/content-addressed/basic.t line 58.
# XXX: This test seems to not do what it seems to be doing. See documentation: https://metacpan.org/pod/Test2::V0#isnt($got,-$do_not_want,-$name)
isnt(<$ctx{deststoredir}/realisations/*>, "", "The destination store should have the realisations of the built derivations registered");

done_testing;
Expand Down
7 changes: 7 additions & 0 deletions t/jobs/content-addressed.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ rec {
FOO = empty_dir;
};

caDependingOnFailingCA =
cfg.mkContentAddressedDerivation {
name = "ca-depending-on-failing-ca";
builder = ./dir-with-file-builder.sh;
FOO = fails;
};

nonCaDependingOnCA =
cfg.mkDerivation {
name = "non-ca-depending-on-ca";
Expand Down

0 comments on commit 8b48579

Please sign in to comment.