Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync eng/common directory with azure-sdk-tools for PR 3212 #17731

Merged
merged 3 commits into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions eng/common/testproxy/docker-start-proxy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ catch {

$SELECTED_IMAGE_TAG = $(Get-Content "$PSScriptRoot/target_version.txt" -Raw).Trim()
$CONTAINER_NAME = "ambitious_azsdk_test_proxy"
$LINUX_IMAGE_SOURCE = "azsdkengsys.azurecr.io/engsys/testproxy-lin:${SELECTED_IMAGE_TAG}"
$WINDOWS_IMAGE_SOURCE = "azsdkengsys.azurecr.io/engsys/testproxy-win:${SELECTED_IMAGE_TAG}"
$IMAGE_SOURCE = "azsdkengsys.azurecr.io/engsys/testproxy:${SELECTED_IMAGE_TAG}"

if($VersionOverride) {
Write-Host "Overriding default target proxy version of '$SELECTED_IMAGE_TAG' with override $VersionOverride."
Expand All @@ -58,16 +57,13 @@ function Get-Proxy-Container(){
| Select-Object -First 1)
}


$SelectedImage = $LINUX_IMAGE_SOURCE
$Initial = ""
$AdditionalContainerArgs = "--add-host=host.docker.internal:host-gateway"

# most of the time, running this script on a windows machine will work just fine, as docker defaults to linux containers
# however, in CI, windows images default to _windows_ containers. We cannot swap them. We can tell if we're in a CI build by
# checking for the environment variable TF_BUILD.
if ($IsWindows -and $env:TF_BUILD){
$SelectedImage = $WINDOWS_IMAGE_SOURCE
$Initial = "C:"
$AdditionalContainerArgs = ""
}
Expand All @@ -93,9 +89,9 @@ if ($Mode -eq "start"){
else {
$attempts = 0
Write-Host "Attempting creation of Docker host $CONTAINER_NAME"
Write-Host "docker container create -v `"${root}:${Initial}/srv/testproxy`" $AdditionalContainerArgs -p 5001:5001 -p 5000:5000 --name $CONTAINER_NAME $SelectedImage"
Write-Host "docker container create -v `"${root}:${Initial}/srv/testproxy`" $AdditionalContainerArgs -p 5001:5001 -p 5000:5000 --name $CONTAINER_NAME $IMAGE_SOURCE"
while($attempts -lt 3){
docker container create -v "${root}:${Initial}/srv/testproxy" $AdditionalContainerArgs -p 5001:5001 -p 5000:5000 --name $CONTAINER_NAME $SelectedImage
docker container create -v "${root}:${Initial}/srv/testproxy" $AdditionalContainerArgs -p 5001:5001 -p 5000:5000 --name $CONTAINER_NAME $IMAGE_SOURCE

if($LASTEXITCODE -ne 0){
$attempts += 1
Expand Down
2 changes: 1 addition & 1 deletion eng/common/testproxy/target_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0-dev.20220224.2
1.0.0-dev.20220426.1
3 changes: 3 additions & 0 deletions eng/pipelines/templates/steps/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ steps:

- ${{ if eq(parameters.TestProxy, true) }}:
- template: /eng/common/testproxy/test-proxy-tool.yml
parameters:
targetVersion: '1.0.0-dev.20220224.2'


- task: PowerShell@2
displayName: 'Run Tests'
Expand Down