project, or jobset, or globally, but that's not all that useful). This is useful if you want to link to the latest build.
BTUDUY6FY6UTRZOGLSPFNA4MVTSP7JXBD44VYF6BPKNFF6Y3CY2QC }# Redirect to the latest successful build.sub latest : Chained('get_builds') PathPart('latest') {my ($self, $c) = @_;my ($latest) = joinWithResultInfo($c, $c->stash->{allBuilds})->search({finished => 1, buildstatus => 0}, {order_by => ["timestamp DESC"]});notFound "There is no successful build to redirect to." unless defined $latest;$c->res->redirect($c->uri_for($c->controller('Build')->action_for("view_build"), [$latest->id]));}# Redirect to the latest successful build for a specific platform.sub latest_for : Chained('get_builds') PathPart('latest-for') {my ($self, $c, $system) = @_;notFound($c, "You need to specify a platform type in the URL.") unless defined $system;my ($latest) = joinWithResultInfo($c, $c->stash->{allBuilds})->search({finished => 1, buildstatus => 0, system => $system}, {order_by => ["timestamp DESC"]});notFound($c, "There is no successful build for platform `$system' to redirect to.") unless defined $latest;$c->res->redirect($c->uri_for($c->controller('Build')->action_for("view_build"), [$latest->id]));
<ul><li><a href="[% c.uri_for('/job' project.name jobset.name job.name'latest') %]">Latest successful build.</a></li>[% FOREACH system IN systems %]<li><a href="[% c.uri_for('/job' project.name jobset.name job.name'latest-for' system.system) %]">Latest successful build for <tt>[%system.system %]</tt>.</a></li>[% END %]</ul>