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 }})
