It redirects to the latest successful build from a finished evaluation. This is mostly useful for the Nixpkgs/NixOS mirroring script, which need the latest finished evaluation in which some aggregate job (such as ‘tested’ in NixOS) succeeded.
CJRWFVKZVTU2FBPN4J7OVIHO5YVPLW2QUKISN4PCTLXSOABDIA2QC
N4ODPYP7XKBCZRAA6R3U23VHUUXEIB7KFQG2QAPDHFKYCUKF673AC
LZVO64YG43JD7YMZSCTZNOBS5ROZA4FMPKJW2YOMHX2V5PTGBVWQC
IHUZXOK2USQOGDTS4CULSPXLHVGGDPKPP4RIQDBS4OLNTDE4GXMAC
BTUDUY6FY6UTRZOGLSPFNA4MVTSP7JXBD44VYF6BPKNFF6Y3CY2QC
3PNG7NIBQQURUUPRVQXYL342OT7JUUYOMY2JJNP6YDX7SYJDZMYAC
FPK5LF53CFUEKFYJ3IYXT4UTVC6IITWJOCFATMC4PLHEUP5SIEAAC
HAI5TY47TDWH3KGW6JPMZ3AB4EHJUFLUK7KZCLBOX6INVDQGG56QC
J5UVLXOK6EDIL5I7VKWH4V2QDS4DPD7FHRK6XBWSXFRQS4JKXFZQC
WGUKOIQZOQ64I6OJHGR4RSRI2HPH4RXADNSPFBWRETKO7OWCET4QC
ODNCGFQ5FPKFI624BVMLW7PJ2EFJOR3TY66OCZM42UNNTWBCF2TQC
$c->res->redirect($c->uri_for($c->controller('Build')->action_for("build"), [$latest->id], @rest));
}
# Redirect to the latest successful build in a finished evaluation
# (i.e. an evaluation that has no unfinished builds).
sub latest_finished : Chained('get_builds') PathPart('latest-finished') {
my ($self, $c, @rest) = @_;
my $latest = $c->stash->{allBuilds}->find(
{ finished => 1, buildstatus => 0 },
{ order_by => ["id DESC"], rows => 1, join => ["jobsetevalmembers"]
, where => \
"not exists (select 1 from jobsetevalmembers m2 join builds b2 on jobsetevalmembers.eval = m2.eval and m2.build = b2.id and b2.finished = 0)"
});
notFound($c, "There is no successful build to redirect to.") unless defined $latest;