web: do not render rc != 0 tasks when failed_when: false

This removes some noise where build output was shown as a failed task
even though failed_when: false was set since the return code did not
indicate a success.

See 'Check if pip is installed' and 'Check if tox is installed':
https://zuul.opendev.org/t/pypa/build/47bbfc21b08744a8bcfd427cbec8f3ac

Change-Id: I775c9145f5c4a4b16ada0dd698874b0928572f01
This commit is contained in:
Albin Vass 2020-11-07 20:24:38 +01:00
parent 8a3e67dc62
commit e0a17b43b8
1 changed files with 12 additions and 2 deletions

View File

@ -142,6 +142,16 @@ export function taskPathMatches (ref, test) {
export const receiveBuildOutput = (buildId, output) => {
const hosts = {}
const taskFailed = (taskResult) => {
if (taskResult.rc && taskResult.failed_when_result !== false)
return true
else if (taskResult.failed)
return true
else
return false
}
// Compute stats
output.forEach(phase => {
Object.entries(phase.stats).forEach(([host, stats]) => {
@ -161,12 +171,12 @@ export const receiveBuildOutput = (buildId, output) => {
if (task.hosts[host].results &&
task.hosts[host].results.length > 0) {
task.hosts[host].results.forEach(result => {
if (result.failed) {
if (taskFailed(result)) {
result.name = task.task.name
hosts[host].failed.push(result)
}
})
} else if (task.hosts[host].rc || task.hosts[host].failed) {
} else if (taskFailed(task.hosts[host])) {
let result = task.hosts[host]
result.name = task.task.name
hosts[host].failed.push(result)