retry ci (#1134)
This commit is contained in:
Родитель
3dbb992c50
Коммит
4658dfd395
|
@ -12,7 +12,7 @@ stages:
|
|||
name: "$(BUILD_POOL_NAME_DEFAULT_WINDOWS)"
|
||||
steps:
|
||||
- powershell: |
|
||||
powershell.exe -command "& { . .\windows.ps1; azure-npm-image $(tag)-windows-amd64 }"
|
||||
powershell.exe -command "& { . .\windows.ps1; Retry({azure-npm-image $(tag)-windows-amd64}) }"
|
||||
name: "build_npm"
|
||||
displayName: "Build"
|
||||
|
||||
|
|
21
windows.ps1
21
windows.ps1
|
@ -1,8 +1,27 @@
|
|||
# Retry({azure-npm-image $(tag)-windows-amd64})
|
||||
|
||||
function Retry([Action]$action) {
|
||||
$attempts = 3
|
||||
$sleepInSeconds = 5
|
||||
do {
|
||||
try {
|
||||
$action.Invoke();
|
||||
break;
|
||||
}
|
||||
catch [Exception] {
|
||||
Write-Host $_.Exception.Message
|
||||
}
|
||||
$attempts--
|
||||
if ($attempts -gt 0) {
|
||||
sleep $sleepInSeconds
|
||||
}
|
||||
} while ($attempts -gt 0)
|
||||
}
|
||||
|
||||
function azure-npm-image {
|
||||
$env:ACN_PACKAGE_PATH = "github.com/Azure/azure-container-networking"
|
||||
$env:NPM_AI_ID = "014c22bd-4107-459e-8475-67909e96edcb"
|
||||
$env:NPM_AI_PATH="$env:ACN_PACKAGE_PATH/npm.aiMetadata"
|
||||
$env:NPM_AI_PATH = "$env:ACN_PACKAGE_PATH/npm.aiMetadata"
|
||||
|
||||
if ($null -eq $env:VERSION) { $env:VERSION = $args[0] }
|
||||
docker build `
|
||||
|
|
Загрузка…
Ссылка в новой задаче