From 17ca68720c271b614ab8791974c1ab78b8dba48a Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Thu, 15 Sep 2022 13:13:32 -0400 Subject: [PATCH] add a parameter 'condition' to the test-proxy ci invocations. (#3931) Co-authored-by: scbedd <45376673+scbedd@users.noreply.github.com> --- eng/common/testproxy/test-proxy-docker.yml | 6 ++++++ eng/common/testproxy/test-proxy-tool.yml | 10 +++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/eng/common/testproxy/test-proxy-docker.yml b/eng/common/testproxy/test-proxy-docker.yml index 52a7c807a..71a03d1be 100644 --- a/eng/common/testproxy/test-proxy-docker.yml +++ b/eng/common/testproxy/test-proxy-docker.yml @@ -2,24 +2,30 @@ parameters: rootFolder: '$(Build.SourcesDirectory)' targetVersion: '' templateRoot: '$(Build.SourcesDirectory)' + condition: true steps: - pwsh: | ${{ parameters.templateRoot }}/eng/common/scripts/trust-proxy-certificate.ps1 displayName: 'Language Specific Certificate Trust' + condition: and(succeeded(), ${{ parameters.condition }}) - pwsh: | docker info displayName: 'Dump active docker information' + condition: and(succeeded(), ${{ parameters.condition }}) - pwsh: | ${{ parameters.templateRoot }}/eng/common/testproxy/docker-start-proxy.ps1 -Mode start -TargetFolder "${{ parameters.rootFolder }}" -VersionOverride="${{ parameters.targetVersion }}" displayName: 'Run the docker container' + condition: and(succeeded(), ${{ parameters.condition }}) - pwsh: | docker container ls -a displayName: Check running container + condition: and(succeeded(), ${{ parameters.condition }}) - pwsh: | Write-Host "##vso[task.setvariable variable=PROXY_MANUAL_START]true" displayName: 'Set PROXY_MANUAL_START' + condition: and(succeeded(), ${{ parameters.condition }}) diff --git a/eng/common/testproxy/test-proxy-tool.yml b/eng/common/testproxy/test-proxy-tool.yml index 679ad2108..293848da1 100644 --- a/eng/common/testproxy/test-proxy-tool.yml +++ b/eng/common/testproxy/test-proxy-tool.yml @@ -3,11 +3,13 @@ parameters: runProxy: true targetVersion: '' templateRoot: '$(Build.SourcesDirectory)' + condition: true steps: - pwsh: | ${{ parameters.templateRoot }}/eng/common/scripts/trust-proxy-certificate.ps1 displayName: 'Language Specific Certificate Trust' + condition: and(succeeded(), ${{ parameters.condition }}) - pwsh: | $version = $(Get-Content "${{ parameters.templateRoot }}/eng/common/testproxy/target_version.txt" -Raw).Trim() @@ -23,6 +25,7 @@ steps: --add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json ` --version $version displayName: "Install test-proxy" + condition: and(succeeded(), ${{ parameters.condition }}) - pwsh: | Write-Host "##vso[task.prependpath]$(Build.BinariesDirectory)/test-proxy" @@ -34,19 +37,20 @@ steps: Write-Host "##vso[task.setvariable variable=ASPNETCORE_Kestrel__Certificates__Default__Password]password" Write-Host "##vso[task.setvariable variable=PROXY_MANUAL_START]true" displayName: 'Configure Kestrel and PROXY_MANUAL_START Variables' + condition: and(succeeded(), ${{ parameters.condition }}) - pwsh: | Start-Process $(Build.BinariesDirectory)/test-proxy/test-proxy.exe ` -ArgumentList "--storage-location ${{ parameters.rootFolder }}" ` -NoNewWindow -PassThru -RedirectStandardOutput ${{ parameters.templateRoot }}/test-proxy.log displayName: 'Run the testproxy - windows' - condition: and(succeeded(), eq(variables['Agent.OS'],'Windows_NT')) + condition: and(succeeded(), eq(variables['Agent.OS'],'Windows_NT'), ${{ parameters.condition }}) # nohup does NOT continue beyond the current session if you use it within powershell - bash: | nohup $(Build.BinariesDirectory)/test-proxy/test-proxy > ${{ parameters.templateRoot }}/test-proxy.log & displayName: "Run the testproxy - linux/mac" - condition: and(succeeded(), ne(variables['Agent.OS'],'Windows_NT')) + condition: and(succeeded(), ne(variables['Agent.OS'],'Windows_NT'), ${{ parameters.condition }}) workingDirectory: "${{ parameters.rootFolder }}" - pwsh: | @@ -62,4 +66,4 @@ steps: Write-Error "Could not connect to test proxy." exit 1 displayName: Test Proxy IsAlive - + condition: and(succeeded(), ${{ parameters.condition }})