mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-03 20:54:24 -07:00
Add retries for Invoke-ScriptAnalyzer in pslint.
Hopefully this will work around the intermittent CI failures due to NullReferenceException, which then succeed on a retry.
This commit is contained in:
parent
47e72063a3
commit
4bd60c313b
1 changed files with 15 additions and 1 deletions
|
@ -4,11 +4,25 @@
|
||||||
|
|
||||||
Set-StrictMode -Version 2.0
|
Set-StrictMode -Version 2.0
|
||||||
$ErrorActionPreference = "Stop"
|
$ErrorActionPreference = "Stop"
|
||||||
|
$WarningPreference = "Stop"
|
||||||
|
|
||||||
$Results = @()
|
$Results = @()
|
||||||
|
|
||||||
ForEach ($Path in $Args) {
|
ForEach ($Path in $Args) {
|
||||||
$Results += Invoke-ScriptAnalyzer -Path $Path -Setting $PSScriptRoot/settings.psd1
|
$Retries = 3
|
||||||
|
|
||||||
|
Do {
|
||||||
|
Try {
|
||||||
|
$Results += Invoke-ScriptAnalyzer -Path $Path -Setting $PSScriptRoot/settings.psd1 3> $null
|
||||||
|
$Retries = 0
|
||||||
|
}
|
||||||
|
Catch {
|
||||||
|
If (--$Retries -le 0) {
|
||||||
|
Throw
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Until ($Retries -le 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
ConvertTo-Json -InputObject $Results
|
ConvertTo-Json -InputObject $Results
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue