STUPID STUPID DUMB DUMB BOMBADILO CROCADILO
All checks were successful
Build Org Website / build (push) Successful in 43s
All checks were successful
Build Org Website / build (push) Successful in 43s
This commit is contained in:
@@ -375,8 +375,17 @@ function Format-Duration {
|
||||
return '{0}s' -f [int]$Duration.TotalSeconds
|
||||
}
|
||||
|
||||
function Test-IsSuccessfulStatus {
|
||||
param([Parameter(Mandatory)][string]$Status)
|
||||
|
||||
return $Status.ToLowerInvariant() -in @('success', 'succeeded', 'skipped', 'neutral')
|
||||
}
|
||||
|
||||
function Get-LogSummary {
|
||||
param([Parameter(Mandatory)][string]$LogText)
|
||||
param(
|
||||
[Parameter(Mandatory)][string]$LogText,
|
||||
[switch]$IgnoreErrors
|
||||
)
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($LogText)) {
|
||||
return @{
|
||||
@@ -397,11 +406,13 @@ function Get-LogSummary {
|
||||
}
|
||||
|
||||
$isError = $false
|
||||
foreach ($pattern in $Config.ErrorPatterns) {
|
||||
if ($trimmed -match $pattern) {
|
||||
$isError = $true
|
||||
$hasErrors = $true
|
||||
break
|
||||
if (-not $IgnoreErrors) {
|
||||
foreach ($pattern in $Config.ErrorPatterns) {
|
||||
if ($trimmed -match $pattern) {
|
||||
$isError = $true
|
||||
$hasErrors = $true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,7 +453,10 @@ function Get-Severity {
|
||||
)
|
||||
|
||||
$normalized = $Status.ToLowerInvariant()
|
||||
if ($normalized -in @('failure', 'failed', 'cancelled', 'timed_out') -or $HasErrors) {
|
||||
if ($normalized -in @('failure', 'failed', 'cancelled', 'timed_out')) {
|
||||
return 'Critical'
|
||||
}
|
||||
if ((-not (Test-IsSuccessfulStatus -Status $Status)) -and $HasErrors) {
|
||||
return 'Critical'
|
||||
}
|
||||
if ($IsSlow -or $HasWarnings) {
|
||||
@@ -460,6 +474,7 @@ function Analyze-Build {
|
||||
$conclusion = Get-ObjectValue -Object $Job -Name 'conclusion'
|
||||
$jobStatus = Get-ObjectValue -Object $Job -Name 'status'
|
||||
$status = if ($conclusion) { [string]$conclusion } elseif ($jobStatus) { [string]$jobStatus } else { 'unknown' }
|
||||
$isSuccessfulStatus = Test-IsSuccessfulStatus -Status $status
|
||||
$duration = Get-Duration -Job $Job
|
||||
$isSlow = $duration.TotalMinutes -ge [double]$Config.SlowBuildThresholdMins
|
||||
$logText = ''
|
||||
@@ -469,7 +484,7 @@ function Analyze-Build {
|
||||
$logText = Get-JobLogText -Repository $Repository -Job $Job
|
||||
}
|
||||
|
||||
$logSummary = Get-LogSummary -LogText $logText
|
||||
$logSummary = Get-LogSummary -LogText $logText -IgnoreErrors:$isSuccessfulStatus
|
||||
$severity = Get-Severity -Status $status -HasErrors $logSummary.HasErrors -HasWarnings $logSummary.HasWarnings -IsSlow $isSlow
|
||||
|
||||
$shouldAlert = $severity -ne 'Info'
|
||||
|
||||
Reference in New Issue
Block a user