Merge pull request #1104 from DeterminateSystems/builds-refs/showjobname

Builds refs: showjobname: use project / jobset from relations, not the bulids table
This commit is contained in:
Graham Christensen 2022-01-11 13:14:20 -05:00 committed by GitHub
commit 87a0782e71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View file

@ -6,7 +6,6 @@ use warnings;
use Exporter;
use ReadonlyX;
use Nix::Store;
use Hydra::Helper::Nix;
our @ISA = qw(Exporter);
our @EXPORT = qw(
@ -338,7 +337,8 @@ sub parseJobsetName {
sub showJobName {
my ($build) = @_;
return $build->get_column('project') . ":" . $build->get_column('jobset') . ":" . $build->get_column('job');
my $jobset = $build->jobset;
return $jobset->get_column('project') . ":" . $jobset->get_column('name') . ":" . $build->get_column('job');
}
@ -414,6 +414,7 @@ sub approxTableSize {
sub requireLocalStore {
my ($c) = @_;
require Hydra::Helper::Nix;
notFound($c, "Nix channels are not supported by this Hydra server.") if !Hydra::Helper::Nix::isLocalStore();
}

View file

@ -4,6 +4,13 @@ use Setup;
use Test2::V0;
use Hydra::Helper::CatalystUtils;
my $ctx = test_context();
my $builds = $ctx->makeAndEvaluateJobset(
expression => "basic.nix",
build => 1
);
subtest "trim" => sub {
my %values = (
"" => "",
@ -25,4 +32,8 @@ subtest "trim" => sub {
is(trim($uninitialized), '', "Trimming an uninitialized value");
};
subtest "showJobName" => sub {
ok(showJobName($builds->{"empty_dir"}), "showJobName succeeds");
};
done_testing;