hydra: at evaluation, check if path is already built, and mark as built in stead of adding to the queue.
This commit is contained in:
parent
2e02291092
commit
d7487ab0d9
@ -10,7 +10,7 @@ use Digest::SHA qw(sha256_hex);
|
|||||||
use File::Path;
|
use File::Path;
|
||||||
|
|
||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
our @EXPORT = qw(fetchInput evalJobs checkBuild inputsToArgs captureStdoutStderr);
|
our @EXPORT = qw(fetchInput evalJobs checkBuild inputsToArgs captureStdoutStderr getReleaseName);
|
||||||
|
|
||||||
sub scmPath {
|
sub scmPath {
|
||||||
return getHydraPath . "/scm" ;
|
return getHydraPath . "/scm" ;
|
||||||
@ -29,6 +29,18 @@ sub getStorePathHash {
|
|||||||
return $hash;
|
return $hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub getReleaseName {
|
||||||
|
my ($outPath) = @_;
|
||||||
|
|
||||||
|
my $releaseName;
|
||||||
|
if (-e "$outPath/nix-support/hydra-release-name") {
|
||||||
|
open FILE, "$outPath/nix-support/hydra-release-name" or die;
|
||||||
|
$releaseName = <FILE>;
|
||||||
|
chomp $releaseName;
|
||||||
|
close FILE;
|
||||||
|
}
|
||||||
|
return $releaseName;
|
||||||
|
}
|
||||||
|
|
||||||
sub parseJobName {
|
sub parseJobName {
|
||||||
# Parse a job specification of the form `<project>:<jobset>:<job>
|
# Parse a job specification of the form `<project>:<jobset>:<job>
|
||||||
@ -607,10 +619,12 @@ sub checkBuild {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $time = time();
|
||||||
|
|
||||||
# Nope, so add it.
|
# Nope, so add it.
|
||||||
$build = $job->builds->create(
|
$build = $job->builds->create(
|
||||||
{ finished => 0
|
{ finished => 0
|
||||||
, timestamp => time()
|
, timestamp => $time
|
||||||
, description => $buildInfo->{description}
|
, description => $buildInfo->{description}
|
||||||
, longdescription => $buildInfo->{longDescription}
|
, longdescription => $buildInfo->{longDescription}
|
||||||
, license => $buildInfo->{license}
|
, license => $buildInfo->{license}
|
||||||
@ -627,15 +641,29 @@ sub checkBuild {
|
|||||||
, nixexprpath => $jobset->nixexprpath
|
, nixexprpath => $jobset->nixexprpath
|
||||||
});
|
});
|
||||||
|
|
||||||
print STDERR "added to queue as build ", $build->id, "\n";
|
|
||||||
|
|
||||||
$currentBuilds->{$build->id} = 1;
|
$currentBuilds->{$build->id} = 1;
|
||||||
|
|
||||||
$build->create_related('buildschedulinginfo',
|
if(isValidPath($outPath)) {
|
||||||
{ priority => $priority
|
print STDERR "marked as cached build ", $build->id, "\n";
|
||||||
, busy => 0
|
$build->update({ finished => 1 });
|
||||||
, locker => ""
|
$build->create_related('buildresultinfo',
|
||||||
});
|
{ iscachedbuild => 1
|
||||||
|
, buildstatus => 0
|
||||||
|
, starttime => $time
|
||||||
|
, stoptime => $time
|
||||||
|
, logfile => getBuildLog($drvPath)
|
||||||
|
, errormsg => ""
|
||||||
|
, releasename => getReleaseName($outPath)
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
print STDERR "added to queue as build ", $build->id, "\n";
|
||||||
|
$build->create_related('buildschedulinginfo',
|
||||||
|
{ priority => $priority
|
||||||
|
, busy => 0
|
||||||
|
, locker => ""
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
my %inputs;
|
my %inputs;
|
||||||
$inputs{$jobset->nixexprinput} = $nixExprInput;
|
$inputs{$jobset->nixexprinput} = $nixExprInput;
|
||||||
|
@ -83,7 +83,7 @@ sub sendEmailNotification {
|
|||||||
|
|
||||||
die unless defined $build->resultInfo;
|
die unless defined $build->resultInfo;
|
||||||
|
|
||||||
return if ! ( $build->jobset->enableemail && ($build->maintainers neq "" || $build->jobset->emailoverride neq "") );
|
return if ! ( $build->jobset->enableemail && ($build->maintainers ne "" || $build->jobset->emailoverride ne "") );
|
||||||
|
|
||||||
# Do we want to send mail?
|
# Do we want to send mail?
|
||||||
|
|
||||||
@ -376,13 +376,7 @@ sub doBuild {
|
|||||||
txn_do($db, sub {
|
txn_do($db, sub {
|
||||||
$build->update({finished => 1, timestamp => time});
|
$build->update({finished => 1, timestamp => time});
|
||||||
|
|
||||||
my $releaseName;
|
my $releaseName = getReleaseName($outPath);
|
||||||
if (-e "$outPath/nix-support/hydra-release-name") {
|
|
||||||
open FILE, "$outPath/nix-support/hydra-release-name" or die;
|
|
||||||
$releaseName = <FILE>;
|
|
||||||
chomp $releaseName;
|
|
||||||
close FILE;
|
|
||||||
}
|
|
||||||
|
|
||||||
$db->resultset('BuildResultInfo')->create(
|
$db->resultset('BuildResultInfo')->create(
|
||||||
{ id => $build->id
|
{ id => $build->id
|
||||||
|
Loading…
x
Reference in New Issue
Block a user