Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools for PR 8158 (#29423)
Browse files Browse the repository at this point in the history
* allow an override FILE to be honored by test-proxy-tool
* update test-utils to honor proxy override version by default

---------

Co-authored-by: Scott Beddall (from Dev Box) <[email protected]>
  • Loading branch information
azure-sdk and scbedd committed Apr 25, 2024
1 parent 7706373 commit 88d244a
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 47 deletions.
26 changes: 20 additions & 6 deletions common/tools/dev-tool/src/util/testProxyUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,7 @@ export async function isProxyToolActive(): Promise<boolean> {
}

log.info(
`Proxy tool seems to be active at http://localhost:${
process.env.TEST_PROXY_HTTP_PORT ?? 5000
`Proxy tool seems to be active at http://localhost:${process.env.TEST_PROXY_HTTP_PORT ?? 5000
}\n`,
);
return true;
Expand All @@ -299,15 +298,30 @@ export async function isProxyToolActive(): Promise<boolean> {

async function getTargetVersion() {
// Grab the tag from the `/eng/common/testproxy/target_version.txt` file [..is used to control the default version]
//
// In times of longer lived version override, the file eng/target_proxy_version.txt can be used to override this version
// in both CI and local development.
// Example content:
//
// 1.0.0-dev.20220224.2
// (Bot regularly updates the tag in the file above.)
try {
const contentInVersionFile = await fs.readFile(
`${path.join(await resolveRoot(), "eng/common/testproxy/target_version.txt")}`,
"utf-8",
);
let contentInVersionFile: string;
const overrideFile = `${path.join(await resolveRoot(), "eng/target_proxy_version.txt")}`;
const overrideExists = await fs.exists(overrideFile);

if (overrideExists) {
contentInVersionFile = await fs.readFile(
overrideFile,
"utf-8",
);
}
else {
contentInVersionFile = await fs.readFile(
`${path.join(await resolveRoot(), "eng/common/testproxy/target_version.txt")}`,
"utf-8",
);
}

const tag = contentInVersionFile.trim();

Expand Down
40 changes: 0 additions & 40 deletions eng/common/testproxy/test-proxy-docker.yml

This file was deleted.

12 changes: 11 additions & 1 deletion eng/common/testproxy/test-proxy-tool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,17 @@ steps:
pwsh: true

- pwsh: |
$version = $(Get-Content "${{ parameters.templateRoot }}/eng/common/testproxy/target_version.txt" -Raw).Trim()
$standardVersion = "${{ parameters.templateRoot }}/eng/common/testproxy/target_version.txt"
$overrideVersion = "${{ parameters.templateRoot }}/eng/target_proxy_version.txt"
$version = $(Get-Content $standardVersion -Raw).Trim()
if (Test-Path $overrideVersion) {
$version = $(Get-Content $overrideVersion -Raw).Trim()
}
Write-Host "Installing test-proxy version $version"
dotnet tool install azure.sdk.tools.testproxy `
--tool-path $(Build.BinariesDirectory)/test-proxy `
--add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json `
Expand Down
1 change: 1 addition & 0 deletions eng/target_proxy_version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.0-dev.20240410.1

0 comments on commit 88d244a

Please sign in to comment.