forked from lix-project/hydra
Fix the jobset unchanged check
When checking whether the jobset is unchanged, we need to compare with the previous JobsetEval regardless of whether it had new builds. Otherwise we'll keep adding new JobsetEval rows.
This commit is contained in:
parent
27619f18e2
commit
87e4d43848
|
@ -788,11 +788,14 @@ sub addBuildProducts {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Return the most recent evaluation of the given jobset that had new
|
# Return the most recent evaluation of the given jobset (that
|
||||||
# builds, or undefined if no such evaluation exists.
|
# optionally had new builds), or undefined if no such evaluation
|
||||||
|
# exists.
|
||||||
sub getPrevJobsetEval {
|
sub getPrevJobsetEval {
|
||||||
my ($db, $jobset) = @_;
|
my ($db, $jobset, $hasNewBuilds) = @_;
|
||||||
my ($prevEval) = $jobset->jobsetevals({ hasnewbuilds => 1 }, { order_by => "id DESC", rows => 1 });
|
my ($prevEval) = $jobset->jobsetevals(
|
||||||
|
($hasNewBuilds ? { hasnewbuilds => 1 } : { }),
|
||||||
|
{ order_by => "id DESC", rows => 1 });
|
||||||
return $prevEval;
|
return $prevEval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,8 +110,7 @@ sub checkJobset {
|
||||||
# inputs. If so, bail out.
|
# inputs. If so, bail out.
|
||||||
my @args = ($jobset->nixexprinput, $jobset->nixexprpath, inputsToArgs($inputInfo));
|
my @args = ($jobset->nixexprinput, $jobset->nixexprpath, inputsToArgs($inputInfo));
|
||||||
my $argsHash = sha256_hex("@args");
|
my $argsHash = sha256_hex("@args");
|
||||||
my $prevEval = getPrevJobsetEval($db, $jobset);
|
if (getPrevJobsetEval($db, $jobset, 0)->hash eq $argsHash) {
|
||||||
if ($prevEval->hash eq $argsHash) {
|
|
||||||
print STDERR " jobset is unchanged, skipping\n";
|
print STDERR " jobset is unchanged, skipping\n";
|
||||||
txn_do($db, sub {
|
txn_do($db, sub {
|
||||||
$jobset->update({lastcheckedtime => time});
|
$jobset->update({lastcheckedtime => time});
|
||||||
|
@ -126,6 +125,8 @@ sub checkJobset {
|
||||||
|
|
||||||
txn_do($db, sub {
|
txn_do($db, sub {
|
||||||
|
|
||||||
|
my $prevEval = getPrevJobsetEval($db, $jobset, 1);
|
||||||
|
|
||||||
# Clear the "current" flag on all builds. Since we're in a
|
# Clear the "current" flag on all builds. Since we're in a
|
||||||
# transaction this will only become visible after the new
|
# transaction this will only become visible after the new
|
||||||
# current builds have been added.
|
# current builds have been added.
|
||||||
|
@ -166,6 +167,9 @@ sub checkJobset {
|
||||||
while (my ($id, $new) = each %buildIds) {
|
while (my ($id, $new) = each %buildIds) {
|
||||||
$ev->jobsetevalmembers->create({ build => $id, isnew => $new });
|
$ev->jobsetevalmembers->create({ build => $id, isnew => $new });
|
||||||
}
|
}
|
||||||
|
print STDERR " created new eval ", $ev->id, "\n";
|
||||||
|
} else {
|
||||||
|
print STDERR " created cached eval ", $ev->id, "\n";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue