* Provide some redirects to the latest successful build for a job (or

[?]
Apr 7, 2009, 3:49 PM
BTUDUY6FY6UTRZOGLSPFNA4MVTSP7JXBD44VYF6BPKNFF6Y3CY2QC

Dependencies

  • [2] ODNCGFQ5 * Improved the navigation bar: don't include all projects (since that
  • [*] FPK5LF53 * Put the project-related actions in a separate controller. Put the
  • [*] AKAZKCR6 * At top-level and for each project, provide two channels: "latest"
  • [*] DEMSSSB2 * Controller for jobs which inherits all actions in ListBuilds. So

Change contents

  • edit in src/lib/Hydra/Base/Controller/ListBuilds.pm at line 59
    [5.702]
    [5.702]
    }
    # 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]));
  • edit in src/lib/Hydra/Controller/Job.pm at line 26
    [2.176]
    [6.544]
    $c->stash->{systems} = [$c->stash->{job}->builds->search({}, {select => ["system"], distinct => 1})];
  • edit in src/root/job.tt at line 24
    [2.8312]
    [2.8312]
  • edit in src/root/job.tt at line 26
    [2.8313]
    [2.8313]
    <h2>Latest builds</h2>
  • edit in src/root/job.tt at line 28
    [2.8314]
    [2.8314]
    <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>