add log diff to compare logs to previous builds

[?]
Sep 26, 2011, 2:47 PM
TH674WKJECNZ4K22DZ2N4SF53UGKG2BQRGBSNESRPDRSRND6TZHAC

Dependencies

  • [2] BIZEPF2T ignore this
  • [3] ZEEZRG2E clean up build page for build that failed with result
  • [4] HSVVEKTY * Start of a JSON API to get information about a specific build.
  • [5] SHYRGAWZ hydra: when no external url is given for diff's of git/hg input, revert to a diff done on a local available clone
  • [6] LUPEGYR7 Hydra: In case of failure, also show changes between last succesful build and the first failed build after this
  • [7] LQNG45RT hydra: description at changes section
  • [8] TW5ZQX5Z * Move up the build products in the builds page, since they're more
  • [9] 2B63JW6F * hydra: changes in list in stead of table, also showing changes of changed 'build output' inputs
  • [10] XHK7IGYI * hdyra: show last succeeded build and changes since on build status summary if build has failed
  • [11] BKOIYITR added some json responses
  • [12] ZI535LI6 * hydra: 'new' UI for project/jobset/job/build
  • [13] JBUTIGW7 hydra: description at changes section
  • [14] KJOGCBGZ hydra: current build -> this build
  • [15] 22JB5HNE make changes section more compact/readable
  • [*] SAFVRDTK * Put Hydra's dependencies so that they can easily be installed in a
  • [*] QUTWJR7P * Include more info in notification emails.
  • [*] CXRCPDSQ * added support for twitter notification
  • [*] J5UVLXOK * Start of a basic Catalyst web interface.
  • [*] MBNX3V52 hydra: disallow robots.txt for root and project all builds page

Change contents

  • edit in deps.nix at line 23
    [18.25]
    [19.0]
    perlPackages.TextDiff
    perlPackages.FileSlurp
  • edit in src/lib/Hydra/Controller/API.pm at line 13
    [5.63]
    [4.33]
    use Text::Diff;
    use File::Slurp;
  • replacement in src/lib/Hydra/Controller/API.pm at line 218
    [5.552][5.552:605]()
    $diff .= `(cd $clonePath ; hg log -r $rev1:$rev2)`;
    [5.552]
    [5.605]
    $diff .= `(cd $clonePath ; hg log -r $rev1 -r $rev2 -b $branch)`;
  • edit in src/lib/Hydra/Controller/API.pm at line 230
    [5.6138]
    [5.6138]
    sub readNormalizedLog {
    my ($file) = @_;
    my $res = read_file($file);
  • edit in src/lib/Hydra/Controller/API.pm at line 235
    [5.6139]
    [5.6139]
    $res =~ s/\/nix\/store\/[a-z0-9]*-/\/nix\/store\/...-/g;
    $res =~ s/nix-build-[a-z0-9]*-/nix-build-...-/g;
    $res =~ s/[0-9]{2}:[0-9]{2}:[0-9]{2}/00:00:00/g;
    return $res;
    }
    sub logdiff : Chained('api') PathPart('logdiff') Args(2) {
    my ($self, $c, $buildid1, $buildid2) = @_;
    my $diff = "";
    my $build1 = getBuild($c, $buildid1);
    notFound($c, "Build with ID $buildid1 doesn't exist.")
    if !defined $build1;
    my $build2 = getBuild($c, $buildid2);
    notFound($c, "Build with ID $buildid2 doesn't exist.")
    if !defined $build2;
    if (-f $build1->resultInfo->logfile && -f $build2->resultInfo->logfile) {
    my $logtext1 = readNormalizedLog($build1->resultInfo->logfile);
    my $logtext2 = readNormalizedLog($build2->resultInfo->logfile);
    $diff = diff \$logtext1, \$logtext2;
    } else {
    $c->response->status(404);
    }
    $c->stash->{'plain'} = { data => (scalar $diff) || " " };
    $c->forward('Hydra::View::Plain');
    }
  • edit in src/lib/Hydra/Controller/Root.pm at line 154
    [5.1003]
    [21.37]
    , uri_for('API', 'logdiff', [],"*", "*")
  • edit in src/root/build.tt at line 187
    [5.127][5.127:205]()
    [% IF build.resultInfo.buildstatus != 0 && prevSuccessfulBuild %]
  • edit in src/root/build.tt at line 188
    [5.29][2.0:60]()
    Changes compared to last successful build:<br/>
  • replacement in src/root/build.tt at line 192
    [3.404][3.404:727]()
    [% IF prevSuccessfulBuild && firstBrokenBuild && firstBrokenBuild.id != build.id %]<th>First broken build <tt>[% INCLUDE renderDateTime timestamp = firstBrokenBuild.timestamp %]</tt></th>[% END %]
    <th>This build <tt>[% INCLUDE renderDateTime timestamp = build.timestamp %]</tt></th>
    [3.404]
    [5.307]
    [% IF prevSuccessfulBuild && firstBrokenBuild && firstBrokenBuild.id != build.id %]
    <th>First broken build <tt>[% INCLUDE renderDateTime timestamp = firstBrokenBuild.timestamp %]</tt><br/>
    <tt>[ <a href="[% c.uri_for(c.controller('API').action_for('logdiff') prevSuccessfulBuild.id firstBrokenBuild.id ) %]">log diff</a> ]</tt>
    </th>
    [% END %]
    <th>This build <tt>[% INCLUDE renderDateTime timestamp = build.timestamp %]</tt> <br/>
    <tt>[ <a href="[% c.uri_for(c.controller('API').action_for('logdiff') prevSuccessfulBuild.id build.id) %]">log diff</a> ]</tt>
    </th>
  • edit in src/root/build.tt at line 212
    [5.44][5.554:576](),[5.1356][5.554:576](),[5.554][5.554:576]()
    [% END %]