* 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:
Rob Vermaas 2010-01-19 14:15:31 +00:00
parent 63db13be3f
commit 3b504b2370
8 changed files with 79 additions and 9 deletions

View file

@ -19,5 +19,7 @@ with pkgs;
perlPackages.EmailSimpleCreator
perlPackages.TextTable
perlPackages.NetTwitterLite
perlPackages.PadWalker
perlPackages.DataDump
]

View file

@ -120,7 +120,7 @@ sub checkInput {
error($c, "Invalid input type: $inputType") unless
$inputType eq "svn" || $inputType eq "cvs" || $inputType eq "tarball" ||
$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);
}

View file

@ -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 {
my ($db, $project, $jobset, $name, $type, $value) = @_;
@ -318,6 +360,9 @@ sub fetchInput {
elsif ($type eq "build") {
return fetchInputBuild($db, $project, $jobset, $name, $type, $value);
}
elsif ($type eq "sysbuild") {
return fetchInputSystemBuild($db, $project, $jobset, $name, $type, $value);
}
elsif ($type eq "git") {
return fetchInputGit($db, $project, $jobset, $name, $type, $value);
}
@ -351,7 +396,7 @@ sub inputsToArgs {
when ("boolean") {
push @res, "--arg", $input, $alt->{value};
}
when (["svn", "path", "build", "git", "cvs"]) {
when (["svn", "path", "build", "git", "cvs", "sysbuild"]) {
push @res, "--arg", $input, (
"{ outPath = builtins.storePath " . $alt->{storePath} . "" .
(defined $alt->{revision} ? "; rev = \"" . $alt->{revision} . "\"" : "") .
@ -397,6 +442,21 @@ sub evalJobs {
SuppressEmpty => '')
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);
}

View file

@ -255,7 +255,7 @@
<td><tt>[% input.name %]</tt></td>
<td><tt>[% type = input.type; inputTypes.$type %]</tt></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>
[% ELSIF input.type == "string" || input.type == "boolean" %]
<tt>"[% input.value %]"</tt>

View file

@ -34,7 +34,7 @@
</td>
<td>
<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 %]
[% HTML.attributes(value => build.project.name _ ':' _ build.jobset.name _ ':' _ build.job.name _ '[id="'_ build.id _ '"]' ) %]
[% ELSE %]

View file

@ -11,6 +11,7 @@
, "boolean" = "Boolean"
, "path" = "Local path"
, "build" = "Build output"
, "sysbuild" = "Build output (same system)"
}
%]

View file

@ -14,7 +14,7 @@ use Config::General;
use Text::Table;
use POSIX qw(strftime);
use Net::Twitter::Lite;
use Data::Dump qw(dump);
STDOUT->autoflush();
@ -138,7 +138,7 @@ sub sendEmailNotification {
push @lines,
[ $input->name
, $input->type
, $input->type eq "build"
, ( $input->type eq "build" || $input->type eq "sysbuild")
? $input->dependency->id
: ($input->type eq "string" || $input->type eq "boolean")
? $input->value : ($input->uri . ':' . $input->revision)

View file

@ -13,7 +13,7 @@ use Email::Simple;
use Email::Simple::Creator;
use Sys::Hostname::Long;
use Config::General;
use Data::Dump qw(dump);
STDOUT->autoflush();
@ -24,8 +24,15 @@ sub fetchInputs {
my ($project, $jobset, $inputInfo) = @_;
foreach my $input ($jobset->jobsetinputs->all) {
foreach my $alt ($input->jobsetinputalts->all) {
my $info = fetchInput($db, $project, $jobset, $input->name, $input->type, $alt->value);
push @{$$inputInfo{$input->name}}, $info if defined $info;
if($input->type eq "sysbuild") {
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;
}
}
}
}