diff options
Diffstat (limited to 'autobuild')
-rw-r--r-- | autobuild/icons/warning-flaky.png | bin | 0 -> 417 bytes | |||
-rw-r--r-- | autobuild/results.php | 54 |
2 files changed, 54 insertions, 0 deletions
diff --git a/autobuild/icons/warning-flaky.png b/autobuild/icons/warning-flaky.png Binary files differnew file mode 100644 index 0000000..9254cad --- /dev/null +++ b/autobuild/icons/warning-flaky.png 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");'> |