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
|
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 {
|
function Get-LogSummary {
|
||||||
param([Parameter(Mandatory)][string]$LogText)
|
param(
|
||||||
|
[Parameter(Mandatory)][string]$LogText,
|
||||||
|
[switch]$IgnoreErrors
|
||||||
|
)
|
||||||
|
|
||||||
if ([string]::IsNullOrWhiteSpace($LogText)) {
|
if ([string]::IsNullOrWhiteSpace($LogText)) {
|
||||||
return @{
|
return @{
|
||||||
@@ -397,11 +406,13 @@ function Get-LogSummary {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$isError = $false
|
$isError = $false
|
||||||
foreach ($pattern in $Config.ErrorPatterns) {
|
if (-not $IgnoreErrors) {
|
||||||
if ($trimmed -match $pattern) {
|
foreach ($pattern in $Config.ErrorPatterns) {
|
||||||
$isError = $true
|
if ($trimmed -match $pattern) {
|
||||||
$hasErrors = $true
|
$isError = $true
|
||||||
break
|
$hasErrors = $true
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -442,7 +453,10 @@ function Get-Severity {
|
|||||||
)
|
)
|
||||||
|
|
||||||
$normalized = $Status.ToLowerInvariant()
|
$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'
|
return 'Critical'
|
||||||
}
|
}
|
||||||
if ($IsSlow -or $HasWarnings) {
|
if ($IsSlow -or $HasWarnings) {
|
||||||
@@ -460,6 +474,7 @@ function Analyze-Build {
|
|||||||
$conclusion = Get-ObjectValue -Object $Job -Name 'conclusion'
|
$conclusion = Get-ObjectValue -Object $Job -Name 'conclusion'
|
||||||
$jobStatus = Get-ObjectValue -Object $Job -Name 'status'
|
$jobStatus = Get-ObjectValue -Object $Job -Name 'status'
|
||||||
$status = if ($conclusion) { [string]$conclusion } elseif ($jobStatus) { [string]$jobStatus } else { 'unknown' }
|
$status = if ($conclusion) { [string]$conclusion } elseif ($jobStatus) { [string]$jobStatus } else { 'unknown' }
|
||||||
|
$isSuccessfulStatus = Test-IsSuccessfulStatus -Status $status
|
||||||
$duration = Get-Duration -Job $Job
|
$duration = Get-Duration -Job $Job
|
||||||
$isSlow = $duration.TotalMinutes -ge [double]$Config.SlowBuildThresholdMins
|
$isSlow = $duration.TotalMinutes -ge [double]$Config.SlowBuildThresholdMins
|
||||||
$logText = ''
|
$logText = ''
|
||||||
@@ -469,7 +484,7 @@ function Analyze-Build {
|
|||||||
$logText = Get-JobLogText -Repository $Repository -Job $Job
|
$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
|
$severity = Get-Severity -Status $status -HasErrors $logSummary.HasErrors -HasWarnings $logSummary.HasWarnings -IsSlow $isSlow
|
||||||
|
|
||||||
$shouldAlert = $severity -ne 'Info'
|
$shouldAlert = $severity -ne 'Info'
|
||||||
|
|||||||
Reference in New Issue
Block a user