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 5613 #4440

Merged
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
25 changes: 25 additions & 0 deletions eng/common/testproxy/override-proxy-version.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<#
.SYNOPSIS
Replaces target test-proxy version present in target_version.txt.
.PARAMETER TargetVersion
The replacement version. Used in its entirety, so don't exclude parts of the version definition.
#>
[cmdletbinding(SupportsShouldProcess=$True)]
param(
[Parameter(mandatory=$true)] [string] $TargetVersion
)

$versionFile = Join-Path $PSScriptRoot "target_version.txt"
$existingVersionText = Get-Content -Raw -Path $versionFile
$existingVersion = $existingVersionText.Trim()

if ($PSCmdLet.ShouldProcess($versionFile)){
Write-Host "Replacing version `"$existingVersion`" with version `"$TargetVersion`" in $versionFile."
Set-Content -Path $versionFile -Value "$TargetVersion`n"
}
else {
Write-Host "Would replace version `"$existingVersion`" with version `"$TargetVersion`" in $versionFile."
}


9 changes: 9 additions & 0 deletions eng/common/testproxy/test-proxy-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ steps:
displayName: 'Language Specific Certificate Trust'
condition: and(succeeded(), ${{ parameters.condition }})
- task: PowerShell@2
displayName: 'Override proxy version if necessary'
condition: and(succeeded(), ${{ parameters.condition }}, ne('${{ parameters.targetVersion }}', ''))
inputs:
targetType: filePath
filePath: '${{ parameters.templateRoot }}/eng/common/testproxy/override-proxy-version.ps1'
arguments: '-TargetVersion "${{ parameters.targetVersion }}"'
pwsh: true

- pwsh: |
docker info
displayName: 'Dump active docker information'
Expand Down
15 changes: 9 additions & 6 deletions eng/common/testproxy/test-proxy-tool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ steps:
displayName: 'Language Specific Certificate Trust'
condition: and(succeeded(), ${{ parameters.condition }})
- task: PowerShell@2
displayName: 'Override proxy version if necessary'
condition: and(succeeded(), ${{ parameters.condition }}, ne('${{ parameters.targetVersion }}', ''))
inputs:
targetType: filePath
filePath: '${{ parameters.templateRoot }}/eng/common/testproxy/override-proxy-version.ps1'
arguments: '-TargetVersion "${{ parameters.targetVersion }}"'
pwsh: true

- pwsh: |
$version = $(Get-Content "${{ parameters.templateRoot }}/eng/common/testproxy/target_version.txt" -Raw).Trim()
$overrideVersion = "${{ parameters.targetVersion }}"
if($overrideVersion) {
Write-Host "Overriding default target proxy version of '$version' with override $overrideVersion."
$version = $overrideVersion
}
dotnet tool install azure.sdk.tools.testproxy `
--tool-path $(Build.BinariesDirectory)/test-proxy `
Expand Down