Skip to content

Commit

Permalink
add a parameter 'condition' to the test-proxy ci invocations. (#1347)
Browse files Browse the repository at this point in the history
Co-authored-by: scbedd <45376673+scbedd@users.noreply.github.com>
  • Loading branch information
azure-sdk and scbedd authored Sep 15, 2022
1 parent fa71519 commit 5d1cc47
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 6 additions & 0 deletions eng/common/testproxy/test-proxy-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }})
10 changes: 7 additions & 3 deletions eng/common/testproxy/test-proxy-tool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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"
Expand All @@ -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: |
Expand All @@ -62,4 +66,4 @@ steps:
Write-Error "Could not connect to test proxy."
exit 1
displayName: Test Proxy IsAlive
condition: and(succeeded(), ${{ parameters.condition }})

0 comments on commit 5d1cc47

Please sign in to comment.