Keep the most recent successful build of current jobs

[?]
Jun 11, 2015, 11:58 AM
AGNPN3WHGRYVVTCTLFQDHSSSGRKWAP6N5QMO6MFK6CHRF4IVUKEQC

Dependencies

  • [2] SLBM7H4Q hydra-update-gc-roots: Keep derivations of failed builds
  • [*] WZ3AEJ67 * hydra_update_gc_roots.pl registers build outputs that should be kept
  • [*] KJQWSRCC Speed up hydra-update-gc-roots
  • [*] 4X6NS66Q * Keep the most recent builds for each job.
  • [*] MUBBWJPA Keep builds that failed with output
  • [*] I3X25POI hydra-update-gc-roots: Keep the most recent evaluations
  • [*] KNAVU6BH * Do not garbage collect releases.

Change contents

  • edit in src/script/hydra-update-gc-roots at line 26
    [2.113]
    [4.1073]
    my %seenBuilds;
  • edit in src/script/hydra-update-gc-roots at line 31
    [2.153]
    [5.153]
    return if defined $seenBuilds{$build->id};
    $seenBuilds{$build->id} = 1;
  • edit in src/script/hydra-update-gc-roots at line 115
    [6.798]
    [2.812]
    # Note: we also keep the derivations of failed builds so that
    # they can be restarted.
  • edit in src/script/hydra-update-gc-roots at line 119
    [2.1011]
    [7.146]
    , finished => 1
  • edit in src/script/hydra-update-gc-roots at line 122
    [8.702]
    [9.407]
    print STDERR "*** looking for the most recent successful builds of current jobs in ",
    $project->name, ":", $jobset->name, "\n";
    # Keep the most recently succeeded build of a current job. Oh
    # I really need to stop using DBIx::Class.
    keepBuild($_, 1) foreach $jobset->builds->search(
    { id => { -in => $jobset->builds->search(
    { finished => 1
    , buildstatus => [0, 6]
    , job => { -in => $jobset->builds->search(
    { eval => { -in => [@evals] } },
    { select => "job", distinct => 1, join => "jobsetevalmembers" }
    )->as_query }
    },
    { group_by => 'job'
    , select => [ { max => 'id', -as => 'm' } ]
    })->as_query }
    },
    { columns => [ @columns ] });