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

Builds refs: showjobname: use project / jobset from relations, not the bulids table #1104

Merged
merged 3 commits into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions src/lib/Hydra/Helper/CatalystUtils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use warnings;
use Exporter;
use ReadonlyX;
use Nix::Store;
use Hydra::Helper::Nix;

our @ISA = qw(Exporter);
our @EXPORT = qw(
Expand Down Expand Up @@ -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');
}


Expand Down Expand Up @@ -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();
}

Expand Down
11 changes: 11 additions & 0 deletions t/Hydra/Helper/CatalystUtils.t
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
"" => "",
Expand All @@ -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;