forked from lix-project/hydra
* hydra: added variant of build input type, 'build output (same system)' to allow better continous integration in one jobset for multiple system. it makes sure that the system of the build that is passed as input for a job has the same system as the job.
This commit is contained in:
parent
63db13be3f
commit
3b504b2370
2
deps.nix
2
deps.nix
|
@ -19,5 +19,7 @@ with pkgs;
|
||||||
perlPackages.EmailSimpleCreator
|
perlPackages.EmailSimpleCreator
|
||||||
perlPackages.TextTable
|
perlPackages.TextTable
|
||||||
perlPackages.NetTwitterLite
|
perlPackages.NetTwitterLite
|
||||||
|
perlPackages.PadWalker
|
||||||
|
perlPackages.DataDump
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ sub checkInput {
|
||||||
error($c, "Invalid input type: $inputType") unless
|
error($c, "Invalid input type: $inputType") unless
|
||||||
$inputType eq "svn" || $inputType eq "cvs" || $inputType eq "tarball" ||
|
$inputType eq "svn" || $inputType eq "cvs" || $inputType eq "tarball" ||
|
||||||
$inputType eq "string" || $inputType eq "path" || $inputType eq "boolean" ||
|
$inputType eq "string" || $inputType eq "path" || $inputType eq "boolean" ||
|
||||||
$inputType eq "git" || $inputType eq "build";
|
$inputType eq "git" || $inputType eq "build" || $inputType eq "sysbuild" ;
|
||||||
|
|
||||||
return ($inputName, $inputType);
|
return ($inputName, $inputType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,6 +215,48 @@ sub fetchInputBuild {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub fetchInputSystemBuild {
|
||||||
|
my ($db, $project, $jobset, $name, $type, $value) = @_;
|
||||||
|
|
||||||
|
my ($projectName, $jobsetName, $jobName, $attrs) = parseJobName($value);
|
||||||
|
$projectName ||= $project->name;
|
||||||
|
$jobsetName ||= $jobset->name;
|
||||||
|
|
||||||
|
my @latestBuilds = $db->resultset('LatestSucceededForJob')
|
||||||
|
->search({}, {bind => [$projectName, $jobsetName, $jobName]});
|
||||||
|
|
||||||
|
my @validBuilds = ();
|
||||||
|
foreach my $build (@latestBuilds) {
|
||||||
|
if(isValidPath($build->outpath)) {
|
||||||
|
push(@validBuilds,$build);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scalar(@validBuilds) == 0) {
|
||||||
|
print STDERR "input `", $name, "': no previous build available\n";
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
my @inputs = ();
|
||||||
|
foreach my $prevBuild (@validBuilds) {
|
||||||
|
my $pkgNameRE = "(?:(?:[A-Za-z0-9]|(?:-[^0-9]))+)";
|
||||||
|
my $versionRE = "(?:[A-Za-z0-9\.\-]+)";
|
||||||
|
|
||||||
|
my $relName = ($prevBuild->resultInfo->releasename or $prevBuild->nixname);
|
||||||
|
my $version = $2 if $relName =~ /^($pkgNameRE)-($versionRE)$/;
|
||||||
|
|
||||||
|
my $input =
|
||||||
|
{ type => "sysbuild"
|
||||||
|
, storePath => $prevBuild->outpath
|
||||||
|
, id => $prevBuild->id
|
||||||
|
, version => $version
|
||||||
|
, system => $prevBuild->system
|
||||||
|
};
|
||||||
|
push(@inputs, $input);
|
||||||
|
}
|
||||||
|
return @inputs;
|
||||||
|
}
|
||||||
|
|
||||||
sub fetchInputGit {
|
sub fetchInputGit {
|
||||||
my ($db, $project, $jobset, $name, $type, $value) = @_;
|
my ($db, $project, $jobset, $name, $type, $value) = @_;
|
||||||
|
|
||||||
|
@ -318,6 +360,9 @@ sub fetchInput {
|
||||||
elsif ($type eq "build") {
|
elsif ($type eq "build") {
|
||||||
return fetchInputBuild($db, $project, $jobset, $name, $type, $value);
|
return fetchInputBuild($db, $project, $jobset, $name, $type, $value);
|
||||||
}
|
}
|
||||||
|
elsif ($type eq "sysbuild") {
|
||||||
|
return fetchInputSystemBuild($db, $project, $jobset, $name, $type, $value);
|
||||||
|
}
|
||||||
elsif ($type eq "git") {
|
elsif ($type eq "git") {
|
||||||
return fetchInputGit($db, $project, $jobset, $name, $type, $value);
|
return fetchInputGit($db, $project, $jobset, $name, $type, $value);
|
||||||
}
|
}
|
||||||
|
@ -351,7 +396,7 @@ sub inputsToArgs {
|
||||||
when ("boolean") {
|
when ("boolean") {
|
||||||
push @res, "--arg", $input, $alt->{value};
|
push @res, "--arg", $input, $alt->{value};
|
||||||
}
|
}
|
||||||
when (["svn", "path", "build", "git", "cvs"]) {
|
when (["svn", "path", "build", "git", "cvs", "sysbuild"]) {
|
||||||
push @res, "--arg", $input, (
|
push @res, "--arg", $input, (
|
||||||
"{ outPath = builtins.storePath " . $alt->{storePath} . "" .
|
"{ outPath = builtins.storePath " . $alt->{storePath} . "" .
|
||||||
(defined $alt->{revision} ? "; rev = \"" . $alt->{revision} . "\"" : "") .
|
(defined $alt->{revision} ? "; rev = \"" . $alt->{revision} . "\"" : "") .
|
||||||
|
@ -397,6 +442,21 @@ sub evalJobs {
|
||||||
SuppressEmpty => '')
|
SuppressEmpty => '')
|
||||||
or die "cannot parse XML output";
|
or die "cannot parse XML output";
|
||||||
|
|
||||||
|
my @filteredJobs = ();
|
||||||
|
foreach my $job (@{$jobs->{job}}) {
|
||||||
|
my $validJob = 1;
|
||||||
|
foreach my $arg (@{$job->{arg}}) {
|
||||||
|
my $input = $inputInfo->{$arg->{name}}->[$arg->{altnr}] ;
|
||||||
|
if($input->{type} eq "sysbuild" && ! ($input->{system} eq $job->{system}) ) {
|
||||||
|
$validJob = 0 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($validJob) {
|
||||||
|
push(@filteredJobs, $job);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$jobs->{job} = \@filteredJobs;
|
||||||
|
|
||||||
return ($jobs, $nixExprInput);
|
return ($jobs, $nixExprInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -255,7 +255,7 @@
|
||||||
<td><tt>[% input.name %]</tt></td>
|
<td><tt>[% input.name %]</tt></td>
|
||||||
<td><tt>[% type = input.type; inputTypes.$type %]</tt></td>
|
<td><tt>[% type = input.type; inputTypes.$type %]</tt></td>
|
||||||
<td>
|
<td>
|
||||||
[% IF input.type == "build" %]
|
[% IF input.type == "build" || input.type == "sysbuild" %]
|
||||||
Job [% INCLUDE renderFullJobNameOfBuild build=input.dependency %] <a href="[% c.uri_for('/build' input.dependency.id) %]">build [% input.dependency.id %]</a>
|
Job [% INCLUDE renderFullJobNameOfBuild build=input.dependency %] <a href="[% c.uri_for('/build' input.dependency.id) %]">build [% input.dependency.id %]</a>
|
||||||
[% ELSIF input.type == "string" || input.type == "boolean" %]
|
[% ELSIF input.type == "string" || input.type == "boolean" %]
|
||||||
<tt>"[% input.value %]"</tt>
|
<tt>"[% input.value %]"</tt>
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<tt><input type="text" class="string" name="input-[% input.name %]-value"
|
<tt><input type="text" class="string" name="input-[% input.name %]-value"
|
||||||
[% IF input.type == "build" %]
|
[% IF input.type == "build" || input.type == "sysbuild" %]
|
||||||
[% build = input.dependency %]
|
[% build = input.dependency %]
|
||||||
[% HTML.attributes(value => build.project.name _ ':' _ build.jobset.name _ ':' _ build.job.name _ '[id="'_ build.id _ '"]' ) %]
|
[% HTML.attributes(value => build.project.name _ ':' _ build.jobset.name _ ':' _ build.job.name _ '[id="'_ build.id _ '"]' ) %]
|
||||||
[% ELSE %]
|
[% ELSE %]
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
, "boolean" = "Boolean"
|
, "boolean" = "Boolean"
|
||||||
, "path" = "Local path"
|
, "path" = "Local path"
|
||||||
, "build" = "Build output"
|
, "build" = "Build output"
|
||||||
|
, "sysbuild" = "Build output (same system)"
|
||||||
}
|
}
|
||||||
%]
|
%]
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ use Config::General;
|
||||||
use Text::Table;
|
use Text::Table;
|
||||||
use POSIX qw(strftime);
|
use POSIX qw(strftime);
|
||||||
use Net::Twitter::Lite;
|
use Net::Twitter::Lite;
|
||||||
|
use Data::Dump qw(dump);
|
||||||
|
|
||||||
STDOUT->autoflush();
|
STDOUT->autoflush();
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ sub sendEmailNotification {
|
||||||
push @lines,
|
push @lines,
|
||||||
[ $input->name
|
[ $input->name
|
||||||
, $input->type
|
, $input->type
|
||||||
, $input->type eq "build"
|
, ( $input->type eq "build" || $input->type eq "sysbuild")
|
||||||
? $input->dependency->id
|
? $input->dependency->id
|
||||||
: ($input->type eq "string" || $input->type eq "boolean")
|
: ($input->type eq "string" || $input->type eq "boolean")
|
||||||
? $input->value : ($input->uri . ':' . $input->revision)
|
? $input->value : ($input->uri . ':' . $input->revision)
|
||||||
|
|
|
@ -13,7 +13,7 @@ use Email::Simple;
|
||||||
use Email::Simple::Creator;
|
use Email::Simple::Creator;
|
||||||
use Sys::Hostname::Long;
|
use Sys::Hostname::Long;
|
||||||
use Config::General;
|
use Config::General;
|
||||||
|
use Data::Dump qw(dump);
|
||||||
|
|
||||||
STDOUT->autoflush();
|
STDOUT->autoflush();
|
||||||
|
|
||||||
|
@ -24,8 +24,15 @@ sub fetchInputs {
|
||||||
my ($project, $jobset, $inputInfo) = @_;
|
my ($project, $jobset, $inputInfo) = @_;
|
||||||
foreach my $input ($jobset->jobsetinputs->all) {
|
foreach my $input ($jobset->jobsetinputs->all) {
|
||||||
foreach my $alt ($input->jobsetinputalts->all) {
|
foreach my $alt ($input->jobsetinputalts->all) {
|
||||||
my $info = fetchInput($db, $project, $jobset, $input->name, $input->type, $alt->value);
|
if($input->type eq "sysbuild") {
|
||||||
push @{$$inputInfo{$input->name}}, $info if defined $info;
|
my @info = fetchInput($db, $project, $jobset, $input->name, $input->type, $alt->value);
|
||||||
|
foreach my $info_el (@info) {
|
||||||
|
push @{$$inputInfo{$input->name}}, $info_el if defined $info_el;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
my $info = fetchInput($db, $project, $jobset, $input->name, $input->type, $alt->value);
|
||||||
|
push @{$$inputInfo{$input->name}}, $info if defined $info;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue