* Add the name of the jobset to ReleaseSetJobs, otherwise we can't
distinguish between jobs with the same name in different jobsets (e.g. "trunk" vs "stdenv-branch" for Nixpkgs). * Renamed the "attrName" field of Builds to "job". * Renamed the "id" field of BuildSteps to "build".
This commit is contained in:
@ -58,7 +58,7 @@ sub doBuild {
|
||||
{outPath => $dep}, {rows => 1, order_by => "stopTime DESC", type => 0, busy => 0});
|
||||
if ($step && $step->status != 0) {
|
||||
$buildStatus = 5;
|
||||
$failedDepBuild = $step->id->id;
|
||||
$failedDepBuild = $step->build->id;
|
||||
$failedDepStepNr = $step->stepnr;
|
||||
goto done;
|
||||
}
|
||||
@ -91,9 +91,8 @@ sub doBuild {
|
||||
|
||||
if (/^@\s+build-started\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)$/) {
|
||||
$db->txn_do(sub {
|
||||
$db->resultset('BuildSteps')->create(
|
||||
{ id => $build->id
|
||||
, stepnr => $buildStepNr++
|
||||
$build->buildsteps->create(
|
||||
{ stepnr => $buildStepNr++
|
||||
, type => 0 # = build
|
||||
, drvpath => $1
|
||||
, outpath => $2
|
||||
@ -107,8 +106,8 @@ sub doBuild {
|
||||
elsif (/^@\s+build-succeeded\s+(\S+)\s+(\S+)$/) {
|
||||
my $drvPath = $1;
|
||||
$db->txn_do(sub {
|
||||
(my $step) = $db->resultset('BuildSteps')->search(
|
||||
{id => $build->id, type => 0, drvpath => $drvPath}, {});
|
||||
(my $step) = $build->buildsteps->search(
|
||||
{type => 0, drvpath => $drvPath}, {});
|
||||
die unless $step;
|
||||
$step->update({busy => 0, status => 0, stoptime => time});
|
||||
});
|
||||
@ -119,14 +118,13 @@ sub doBuild {
|
||||
$someBuildFailed = 1;
|
||||
$thisBuildFailed = 1 if $drvPath eq $drvPathStep;
|
||||
$db->txn_do(sub {
|
||||
(my $step) = $db->resultset('BuildSteps')->search(
|
||||
{id => $build->id, type => 0, drvpath => $drvPathStep}, {});
|
||||
(my $step) = $build->buildsteps->search(
|
||||
{type => 0, drvpath => $drvPathStep}, {});
|
||||
if ($step) {
|
||||
$step->update({busy => 0, status => 1, errormsg => $4, stoptime => time});
|
||||
} else {
|
||||
$db->resultset('BuildSteps')->create(
|
||||
{ id => $build->id
|
||||
, stepnr => $buildStepNr++
|
||||
$build->buildsteps->create(
|
||||
{ stepnr => $buildStepNr++
|
||||
, type => 0 # = build
|
||||
, drvpath => $drvPathStep
|
||||
, outpath => $2
|
||||
@ -144,9 +142,8 @@ sub doBuild {
|
||||
elsif (/^@\s+substituter-started\s+(\S+)\s+(\S+)$/) {
|
||||
my $outPath = $1;
|
||||
$db->txn_do(sub {
|
||||
$db->resultset('BuildSteps')->create(
|
||||
{ id => $build->id
|
||||
, stepnr => $buildStepNr++
|
||||
$build->buildsteps->create(
|
||||
{ stepnr => $buildStepNr++
|
||||
, type => 1 # = substitution
|
||||
, outpath => $1
|
||||
, busy => 1
|
||||
@ -158,8 +155,8 @@ sub doBuild {
|
||||
elsif (/^@\s+substituter-succeeded\s+(\S+)$/) {
|
||||
my $outPath = $1;
|
||||
$db->txn_do(sub {
|
||||
(my $step) = $db->resultset('BuildSteps')->search(
|
||||
{id => $build->id, type => 1, outpath => $outPath}, {});
|
||||
(my $step) = $build->buildsteps->search(
|
||||
{type => 1, outpath => $outPath}, {});
|
||||
die unless $step;
|
||||
$step->update({busy => 0, status => 0, stoptime => time});
|
||||
});
|
||||
@ -168,8 +165,8 @@ sub doBuild {
|
||||
elsif (/^@\s+substituter-failed\s+(\S+)\s+(\S+)\s+(\S+)$/) {
|
||||
my $outPath = $1;
|
||||
$db->txn_do(sub {
|
||||
(my $step) = $db->resultset('BuildSteps')->search(
|
||||
{id => $build->id, type => 1, outpath => $outPath}, {});
|
||||
(my $step) = $build->buildsteps->search(
|
||||
{type => 1, outpath => $outPath}, {});
|
||||
die unless $step;
|
||||
$step->update({busy => 0, status => 1, errormsg => $3, stoptime => time});
|
||||
});
|
||||
|
@ -106,7 +106,7 @@ sub checkBuilds {
|
||||
# outside the transaction in case it aborts or something.
|
||||
foreach my $build (@buildsStarted) {
|
||||
my $id = $build->id;
|
||||
print "starting build $id (", $build->project->name, ":", $build->attrname, ") on ", $build->system, "\n";
|
||||
print "starting build $id (", $build->project->name, ":", $build->job, ") on ", $build->system, "\n";
|
||||
eval {
|
||||
my $logfile = $build->schedulingInfo->logfile;
|
||||
my $child = fork();
|
||||
@ -134,6 +134,12 @@ sub checkBuilds {
|
||||
}
|
||||
|
||||
|
||||
if (scalar(@ARGV) == 1 && $ARGV[0] eq "--unlock") {
|
||||
unlockDeadBuilds;
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
while (1) {
|
||||
eval {
|
||||
# Clean up zombies.
|
||||
|
@ -155,7 +155,7 @@ sub fetchInputAlt {
|
||||
|
||||
# Pick the most recent successful build of the specified job.
|
||||
(my $prevBuild) = $db->resultset('Builds')->search(
|
||||
{finished => 1, project => $project->name, jobset => $jobset->name, attrname => $jobName, buildStatus => 0},
|
||||
{finished => 1, project => $project->name, jobset => $jobset->name, job => $jobName, buildStatus => 0},
|
||||
{join => 'resultInfo', order_by => "timestamp DESC", rows => 1});
|
||||
|
||||
if (!defined $prevBuild || !isValidPath($prevBuild->outpath)) {
|
||||
@ -218,7 +218,7 @@ sub checkJob {
|
||||
$db->txn_do(sub {
|
||||
if (scalar($db->resultset('Builds')->search(
|
||||
{ project => $project->name, jobset => $jobset->name
|
||||
, attrname => $jobName, outPath => $outPath })) > 0)
|
||||
, job => $jobName, outPath => $outPath })) > 0)
|
||||
{
|
||||
print "already scheduled/done\n";
|
||||
return;
|
||||
@ -231,7 +231,7 @@ sub checkJob {
|
||||
, timestamp => time()
|
||||
, project => $project->name
|
||||
, jobset => $jobset->name
|
||||
, attrname => $jobName
|
||||
, job => $jobName
|
||||
, description => $job->{description}
|
||||
, longdescription => $job->{longDescription}
|
||||
, license => $job->{license}
|
||||
|
@ -38,14 +38,14 @@ foreach my $project ($db->resultset('Projects')->all) {
|
||||
# Go over all jobs in this project.
|
||||
|
||||
foreach my $job ($project->builds->search({},
|
||||
{select => [{distinct => 'attrname'}], as => ['attrname']}))
|
||||
{select => [{distinct => 'job'}], as => ['job']}))
|
||||
{
|
||||
print "*** looking for builds to keep in job ", $project->name, ":", $job->attrname, "\n";
|
||||
print "*** looking for builds to keep in job ", $project->name, ":", $job->job, "\n";
|
||||
|
||||
# Keep the N most recent successful builds for each job and
|
||||
# platform.
|
||||
my @recentBuilds = $project->builds->search(
|
||||
{ attrname => $job->attrname
|
||||
{ job => $job->job
|
||||
, finished => 1
|
||||
, buildStatus => 0 # == success
|
||||
},
|
||||
|
Reference in New Issue
Block a user