retry logic on push in case of 502 errors (#136)

This commit is contained in:
John
2024-11-19 13:07:55 -08:00
committed by GitHub
parent 841d775b73
commit 5a185c9575
+18
View File
@@ -117,6 +117,24 @@ ForEach($platform in $platforms.Split(",")) {
if($push -eq $true) {
ForEach($t in ($tags + ($tag -ne '' ? @("$tag") : @()))) {
$retries = 0
$maxRetries = 3
$success = $false
while(-not $success -and $retries -lt $maxRetries) {
try {
exec buildah manifest push --all "$manifest" "docker://$t"
$success = $true
} catch {
$retries++
Write-Host "Error encountered during push. Retrying... ($retries/$maxRetries)"
Start-Sleep -Seconds 2
}
}
if(-not $success) {
Write-Host "Failed to push after $maxRetries attempts."
exit 1
}
}
}