From a756614fa1593810746ffdd9213786d46e74e9c0 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Wed, 24 Feb 2021 11:30:33 -0500 Subject: [PATCH] RunCommand: pass homepage, description, license, system, and nixname --- src/lib/Hydra/Plugin/RunCommand.pm | 5 ++++ tests/jobs/runcommand.nix | 44 ++++++++++++++++++------------ tests/plugins/runcommand.t | 5 ++++ 3 files changed, 36 insertions(+), 18 deletions(-) diff --git a/src/lib/Hydra/Plugin/RunCommand.pm b/src/lib/Hydra/Plugin/RunCommand.pm index 8ae70c6f..fd095222 100644 --- a/src/lib/Hydra/Plugin/RunCommand.pm +++ b/src/lib/Hydra/Plugin/RunCommand.pm @@ -71,6 +71,11 @@ sub buildFinished { startTime => $build->get_column('starttime'), stopTime => $build->get_column('stoptime'), buildStatus => $build->get_column('buildstatus'), + nixName => $build->get_column('nixname'), + system => $build->get_column('system'), + homepage => $build->get_column('homepage'), + description => $build->get_column('description'), + license => $build->get_column('license'), outputs => [], products => [], metrics => [], diff --git a/tests/jobs/runcommand.nix b/tests/jobs/runcommand.nix index 3fc42e04..f4b8b0fc 100644 --- a/tests/jobs/runcommand.nix +++ b/tests/jobs/runcommand.nix @@ -1,25 +1,33 @@ with import ./config.nix; { - metrics = mkDerivation { - name = "my-build-product"; - builder = "/bin/sh"; - outputs = [ "out" "bin" ]; - args = [ - ( - builtins.toFile "builder.sh" '' - #! /bin/sh + metrics = ( + mkDerivation { + name = "my-build-product"; + builder = "/bin/sh"; + outputs = [ "out" "bin" ]; + args = [ + ( + builtins.toFile "builder.sh" '' + #! /bin/sh - echo "$PATH" + echo "$PATH" - mkdir $bin - echo "foo" > $bin/bar + mkdir $bin + echo "foo" > $bin/bar - metrics=$out/nix-support/hydra-metrics - mkdir -p "$(dirname "$metrics")" - echo "lineCoverage 18 %" >> "$metrics" - echo "maxResident 27 KiB" >> "$metrics" - '' - ) - ]; + metrics=$out/nix-support/hydra-metrics + mkdir -p "$(dirname "$metrics")" + echo "lineCoverage 18 %" >> "$metrics" + echo "maxResident 27 KiB" >> "$metrics" + '' + ) + ]; + } + ) // { + meta = { + license = "GPL"; + description = "An example meta property."; + homepage = "https://github.com/NixOS/hydra"; + }; }; } diff --git a/tests/plugins/runcommand.t b/tests/plugins/runcommand.t index 620328fc..de78cb83 100644 --- a/tests/plugins/runcommand.t +++ b/tests/plugins/runcommand.t @@ -58,10 +58,15 @@ subtest "Validate the top level fields match" => sub { is($dat->{project}, "tests", "The project matches."); is($dat->{jobset}, "basic", "The jobset matches."); is($dat->{job}, "metrics", "The job matches."); + is($dat->{nixName}, "my-build-product", "The nixName matches."); + is($dat->{system}, $newbuild->system, "The system matches."); is($dat->{drvPath}, $newbuild->drvpath, "The derivation path matches."); is($dat->{timestamp}, $newbuild->timestamp, "The result has a timestamp field."); is($dat->{startTime}, $newbuild->starttime, "The result has a startTime field."); is($dat->{stopTime}, $newbuild->stoptime, "The result has a stopTime field."); + is($dat->{homepage}, "https://github.com/NixOS/hydra", "The homepage is passed."); + is($dat->{description}, "An example meta property.", "The description is passed."); + is($dat->{license}, "GPL", "The license is passed."); }; subtest "Validate the outputs match" => sub {