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:
parent
781c696522
commit
50d6885714
@ -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"
|
||||
|
||||
@ -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'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user