* Provide a channel for each project containing all the latest

[?]
Mar 4, 2009, 1:08 PM
7UJ5YV4VUSXMKB57KKXDG6KLIXMQXO45VO5UTOT46BHQJBFZ7XKQC

Dependencies

  • [2] PCK2Q2VO
  • [3] FPK5LF53 * Put the project-related actions in a separate controller. Put the
  • [4] UVMFS73T * Some jQuery / CSS hackery.
  • [5] 2JQ7WEFM
  • [6] CS7T2XFI
  • [7] 7LKUAIGC
  • [8] LBNVQXUB * Build the /build stuff in a separate controller.
  • [9] LVJKRTIK * Generate a Nix expression for the channel.
  • [10] WYN733ST * Store build duration, handle cached builds.
  • [11] K2NXFFKH
  • [12] L2E6EVE2 * Merged the Build and Job tables.
  • [13] ELCI5T2A * Show the latest build for each job.
  • [14] BPVJBR2P * Only put Nix builds in the global channel.
  • [15] WJ35RSKA
  • [16] J5UVLXOK * Start of a basic Catalyst web interface.

Change contents

  • edit in src/Hydra/lib/Hydra/Controller/Project.pm at line 6
    [3.1357]
    [3.1357]
    use base 'Hydra::Base::Controller::NixChannel';
  • edit in src/Hydra/lib/Hydra/Controller/Project.pm at line 225
    [3.9162]
    [3.9162]
    }
    # Hydra::Base::Controller::NixChannel needs this.
    sub nix : Chained('project') PathPart('channel/latest') CaptureArgs(0) {
    my ($self, $c) = @_;
    eval {
    $c->stash->{channelName} = $c->stash->{curProject}->name . "-latest";
    getChannelData($c, scalar $c->stash->{curProject}->builds);
    };
    error($c, $@) if $@;
  • replacement in src/Hydra/lib/Hydra/Controller/Root.pm at line 240
    [4.456][2.0:52](),[2.52][4.1509:1510](),[4.456][4.1509:1510](),[4.1509][4.1509:1510](),[4.1510][4.644:730](),[4.233][4.1510:1511](),[4.520][4.1510:1511](),[4.730][4.1510:1511](),[4.1510][4.1510:1511](),[4.1511][4.521:580](),[4.580][4.151:212](),[4.212][4.731:896](),[4.896][4.235:379](),[4.235][4.235:379]()
    $c->stash->{channelName} = "hydra-all-latest";
    my @builds = @{getLatestBuilds($c, $c->model('DB::Builds'), {buildStatus => 0})};
    my @storePaths = ();
    foreach my $build (@builds) {
    # !!! better do this in getLatestBuilds with a join.
    next unless $build->buildproducts->find({type => "nix-build"});
    next unless isValidPath($build->outpath);
    push @storePaths, $build->outpath;
    my $pkgName = $build->nixname . "-" . $build->system . "-" . $build->id . ".nixpkg";
    $c->stash->{nixPkgs}->{$pkgName} = $build;
    [4.456]
    [4.655]
    eval {
    $c->stash->{channelName} = "hydra-all-latest";
    getChannelData($c, $c->model('DB::Builds'));
  • replacement in src/Hydra/lib/Hydra/Controller/Root.pm at line 244
    [4.662][4.662:708]()
    $c->stash->{storePaths} = [@storePaths];
    [4.662]
    [4.708]
    error($c, $@) if $@;
  • edit in src/Hydra/lib/Hydra/Helper/CatalystUtils.pm at line 6
    [4.106]
    [4.3535]
    use Hydra::Helper::Nix;
  • replacement in src/Hydra/lib/Hydra/Helper/CatalystUtils.pm at line 10
    [4.125][3.9659:9702]()
    getBuild getBuildStats getLatestBuilds
    [4.125]
    [3.9702]
    getBuild getBuildStats getLatestBuilds getChannelData
  • edit in src/Hydra/lib/Hydra/Helper/CatalystUtils.pm at line 67
    [3.11101]
    [4.3706]
    }
    sub getChannelData {
    my ($c, $builds) = @_;
    my @builds = @{getLatestBuilds($c, $builds, {buildStatus => 0})};
    my @storePaths = ();
    foreach my $build (@builds) {
    # !!! better do this in getLatestBuilds with a join.
    next unless $build->buildproducts->find({type => "nix-build"});
    next unless isValidPath($build->outpath);
    push @storePaths, $build->outpath;
    my $pkgName = $build->nixname . "-" . $build->system . "-" . $build->id . ".nixpkg";
    $c->stash->{nixPkgs}->{$pkgName} = $build;
    };
    $c->stash->{storePaths} = [@storePaths];