...

Text file src/github.com/Azure/azure-sdk-for-go/eng/common/testproxy/test-proxy-tool.yml

Documentation: github.com/Azure/azure-sdk-for-go/eng/common/testproxy

     1parameters:
     2  rootFolder: '$(Build.SourcesDirectory)'
     3  runProxy: true
     4  targetVersion: ''
     5
     6steps:
     7  - pwsh: |
     8        $(Build.SourcesDirectory)/eng/common/scripts/trust-proxy-certificate.ps1
     9    displayName: 'Language Specific Certificate Trust'
    10
    11  - pwsh: |
    12      $version = $(Get-Content "$(Build.SourcesDirectory)/eng/common/testproxy/target_version.txt" -Raw).Trim()
    13      $overrideVersion = "${{ parameters.targetVersion }}"
    14
    15      if($overrideVersion) {
    16        Write-Host "Overriding default target proxy version of '$version' with override $overrideVersion."
    17        $version = $overrideVersion
    18      }
    19
    20      dotnet tool install azure.sdk.tools.testproxy `
    21        --tool-path $(Build.BinariesDirectory)/test-proxy `
    22        --add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json `
    23        --version $version
    24    displayName: "Install test-proxy"
    25
    26  - pwsh: |
    27      Write-Host "##vso[task.prependpath]$(Build.BinariesDirectory)/test-proxy"
    28    displayName: "Prepend path with test-proxy tool install location"
    29
    30  - ${{ if eq(parameters.runProxy, 'true') }}:
    31    - pwsh: |
    32        Write-Host "##vso[task.setvariable variable=ASPNETCORE_Kestrel__Certificates__Default__Path]$(Build.SourcesDirectory)/eng/common/testproxy/dotnet-devcert.pfx"
    33        Write-Host "##vso[task.setvariable variable=ASPNETCORE_Kestrel__Certificates__Default__Password]password"
    34        Write-Host "##vso[task.setvariable variable=PROXY_MANUAL_START]true"
    35      displayName: 'Configure Kestrel and PROXY_MANUAL_START Variables'
    36
    37    - pwsh: |
    38        Start-Process $(Build.BinariesDirectory)/test-proxy/test-proxy.exe `
    39          -ArgumentList "--storage-location ${{ parameters.rootFolder }}" `
    40          -NoNewWindow -PassThru -RedirectStandardOutput $(Build.SourcesDirectory)/test-proxy.log
    41      displayName: 'Run the testproxy - windows'
    42      condition: and(succeeded(), eq(variables['Agent.OS'],'Windows_NT'))
    43
    44    # nohup does NOT continue beyond the current session if you use it within powershell
    45    - bash: |
    46        nohup $(Build.BinariesDirectory)/test-proxy/test-proxy > $(Build.SourcesDirectory)/test-proxy.log &
    47      displayName: "Run the testproxy - linux/mac"
    48      condition: and(succeeded(), ne(variables['Agent.OS'],'Windows_NT'))
    49      workingDirectory: "${{ parameters.rootFolder }}"
    50
    51    - pwsh: |
    52        for ($i = 0; $i -lt 10; $i++) {
    53            try {
    54                Invoke-WebRequest -Uri "http://localhost:5000/Admin/IsAlive" | Out-Null
    55                exit 0
    56            } catch {
    57                Write-Warning "Failed to successfully connect to test proxy. Retrying..."
    58                Start-Sleep 6
    59            }
    60        }
    61        Write-Error "Could not connect to test proxy."
    62        exit 1
    63      displayName: Test Proxy IsAlive
    64

View as plain text