diff options
author | Dan Fandrich <dan@coneharvesters.com> | 2014-09-15 21:44:23 +0200 |
---|---|---|
committer | Pascal Terjan <pterjan@gmail.com> | 2014-10-03 21:33:16 +0000 |
commit | 4a1c9e8942841ce2f635afca4ea76ac80aaf504f (patch) | |
tree | 1b584cc4373a024982303cf38ccf2d859eb705d0 /autobuild/results.php | |
parent | c931d37c4ac7df3784c76d5785f1e0298f4331ea (diff) | |
download | pkgsubmit-4a1c9e8942841ce2f635afca4ea76ac80aaf504f.tar pkgsubmit-4a1c9e8942841ce2f635afca4ea76ac80aaf504f.tar.gz pkgsubmit-4a1c9e8942841ce2f635afca4ea76ac80aaf504f.tar.bz2 pkgsubmit-4a1c9e8942841ce2f635afca4ea76ac80aaf504f.tar.xz pkgsubmit-4a1c9e8942841ce2f635afca4ea76ac80aaf504f.zip |
Display those failing builds that appear to be flaky
The flakiness algorithm is tuned for packages that are >20% flaky over
the past ~6 months, which may turn out to be too high a threshold.
Diffstat (limited to 'autobuild/results.php')
-rw-r--r-- | autobuild/results.php | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/autobuild/results.php b/autobuild/results.php index 9172a57..053d4b2 100644 --- a/autobuild/results.php +++ b/autobuild/results.php @@ -10,6 +10,7 @@ function parse_package($rpm) { } } +$db = new SQLite3('autobuild.db'); $runs = Array(); $handle = opendir('cauldron/x86_64/core/'); while (false !== ($entry = readdir($handle))) { @@ -163,6 +164,54 @@ function toggle(titleid, contentid){ <body> <div style='position:absolute;right:0;top:0;'> <?php + +# See if the pattern of recent build failures indicate a flaky build +# This looks at the last 10 builds for at least two failures +function is_flaky($history) { + if (count($history) < 10) + return false; + + # Most recent 5 builds + $num_bad = 0; + for ($i = 0; $i < 5; $i++) { + if ($history[$i] === 'build_failure') + $num_bad++; + } + if ($num_bad < 1 || $num_bad >= 5) + return false; + + # Next older 5 builds + $num_bad_older = 0; + for ($i = 5; $i < 10; $i++) { + if ($history[$i] === 'build_failure') + $num_bad_older++; + } + if ($num_bad_older < 1 || $num_bad_older >= 5) + return false; + + $num_bad = $num_bad + $num_bad_older; + if ($num_bad < 2 || $num_bad > 7) + return false; + + return true; +} + +function get_build_history($package) { + global $db; + $package_id = $db->querySingle("SELECT Id FROM Packages WHERE Name = '$package'"); + if ($package_id) { + $result = $db->query("SELECT ResultValues.Name FROM Runs, Results, ResultValues WHERE Runs.Id = Results.Run AND Results.Result = ResultValues.Id AND Results.Package = '$package_id' ORDER BY Start DESC LIMIT 10"); + if ($result) { + $build_stats = Array(); + while ($entry = $result->fetchArray(SQLITE3_ASSOC)) { + array_push($build_stats, $entry['Name']); + } + return $build_stats; + } + } + return false; +} + echo "<form><select name='run' onChange='document.location.href=\"".$_SERVER["PHP_SELF"]."?run=\"+this.form.run.value'>"; foreach ($runs as $r) { $in_progress = ($r > $latest) ? ' (in progress)' : ''; @@ -189,12 +238,17 @@ foreach ($failure as $rpm => $error) { if (file_exists("icons/error-$error.png")) { $error_html = "<img src='icons/error-$error.png' title='$error'/>"; } + $history = get_build_history($parsed['package']); + if (is_flaky($history)) { + $history_link = $history_link . " <img src='icons/warning-flaky.png' title='Flaky build' />"; + } if (file_exists("$base_dir/$rpm/")) { echo "<li>$error_html <a href='$base_dir/$rpm/'>$rpm</a> $status_html $history_link</li>\n"; } else { echo "<li>$error_html $rpm $status_html $history_link</li>\n"; } } +$db->close(); ?> </ul></div> <div style='float:right; width:50%'><h1><a class='expand-arrow' id='success-title' href='javascript:toggle("success-title","success-list");'> |