Sync eng/common directory with azure-sdk-tools for PR 2219 (#3066)

* adding retry to docker container start

Co-authored-by: scbedd <45376673+scbedd@users.noreply.github.com>
This commit is contained in:
Azure SDK Bot 2021-11-05 17:32:27 -07:00 committed by GitHub
parent 781c696522
commit 50d6885714
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 1 deletions

View File

@ -64,9 +64,31 @@ if ($Mode -eq "start"){
}
# else we need to create it
else {
$attempts = 0
Write-Host "Attempting creation of Docker host $CONTAINER_NAME"
Write-Host "docker container create -v `"${root}:${Initial}/etc/testproxy`" $LinuxContainerArgs -p 5001:5001 -p 5000:5000 --name $CONTAINER_NAME $SelectedImage"
docker container create -v "${root}:${Initial}/etc/testproxy" $LinuxContainerArgs -p 5001:5001 -p 5000:5000 --name $CONTAINER_NAME $SelectedImage
while($attempts -lt 3){
docker container create -v "${root}:${Initial}/etc/testproxy" $LinuxContainerArgs -p 5001:5001 -p 5000:5000 --name $CONTAINER_NAME $SelectedImage
if($LASTEXITCODE -ne 0){
$attempts += 1
Start-Sleep -s 10
if($attempts -lt 3){
Write-Host "Attempt $attempts failed. Retrying."
}
continue
}
else {
break
}
}
if($LASTEXITCODE -ne 0){
Write-Host "Unable to successfully create docker container. Exiting."
exit(1)
}
}
Write-Host "Attempting start of Docker host $CONTAINER_NAME"

View File

@ -6,6 +6,10 @@ steps:
$(Build.SourcesDirectory)/eng/common/scripts/trust-proxy-certificate.ps1
displayName: 'Language Specific Certificate Trust'
- pwsh: |
docker info
displayName: 'Dump active docker information'
- pwsh: |
$(Build.SourcesDirectory)/eng/common/testproxy/docker-start-proxy.ps1 -Mode start -TargetFolder "${{ parameters.rootFolder }}"
displayName: 'Run the docker container'