Skip to content

Commit

Permalink
updating the original container create to a retry
Browse files Browse the repository at this point in the history
  • Loading branch information
scbedd authored and azure-sdk committed Nov 5, 2021
1 parent c807245 commit 3f70a92
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
17 changes: 16 additions & 1 deletion eng/common/testproxy/docker-start-proxy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,24 @@ 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){
continue
}
else {
break
}
$attempts += 1
}

if($LASTEXITCODE -ne 0){
exit(1)
}
}

Write-Host "Attempting start of Docker host $CONTAINER_NAME"
Expand Down
20 changes: 1 addition & 19 deletions eng/common/testproxy/test-proxy-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,9 @@ steps:
$(Build.SourcesDirectory)/eng/common/scripts/trust-proxy-certificate.ps1
displayName: 'Language Specific Certificate Trust'
# windows has a startup bug where the service is unavailable. See Azure/azure-sdk-tools#2122
- pwsh: |
docker info
# if info failed, we need to restart the service and start docker desktop
if($LASTEXITCODE -ne 0)
{
# Ensure the service is running
Get-Service com.docker.service | Restart-Service
# Start docker desktop
$dockerExeLocation = (Get-Command docker).Source
# on windows, docker.exe is shipped here:
# C:\Program Files\Docker\Docker\resources\bin\docker.exe
# Docker desktop lives in the same base path, just up a couple levels:
# C:\Program Files\Docker\Docker\Docker Desktop.exe
$dockerDesktopLocation = Resolve-Path (Join-Path -Path $dockerExeLocation -ChildPath "../../../Docker Desktop.exe")
&$dockerDesktopLocation
}
condition: and(succeededOrFailed(), eq(variables['Agent.OS'],'Windows_NT'))
displayName: 'Dump active docker information'
- pwsh: |
$(Build.SourcesDirectory)/eng/common/testproxy/docker-start-proxy.ps1 -Mode start -TargetFolder "${{ parameters.rootFolder }}"
Expand Down

0 comments on commit 3f70a92

Please sign in to comment.