Skip to content

Commit afd73de

Browse files
committed
handle the override file if it exists
1 parent 63232fd commit afd73de

2 files changed

Lines changed: 21 additions & 6 deletions

File tree

common/tools/dev-tool/src/util/testProxyUtils.ts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,7 @@ export async function isProxyToolActive(): Promise<boolean> {
287287
}
288288

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

300299
async function getTargetVersion() {
301300
// Grab the tag from the `/eng/common/testproxy/target_version.txt` file [..is used to control the default version]
301+
//
302+
// In times of longer lived version override, the file eng/target_proxy_version.txt can be used to override this version
303+
// in both CI and local development.
302304
// Example content:
303305
//
304306
// 1.0.0-dev.20220224.2
305307
// (Bot regularly updates the tag in the file above.)
306308
try {
307-
const contentInVersionFile = await fs.readFile(
308-
`${path.join(await resolveRoot(), "eng/common/testproxy/target_version.txt")}`,
309-
"utf-8",
310-
);
309+
let contentInVersionFile: string;
310+
const overrideFile = `${path.join(await resolveRoot(), "eng/target_proxy_version.txt")}`;
311+
const overrideExists = await fs.exists(overrideFile);
312+
313+
if (overrideExists) {
314+
contentInVersionFile = await fs.readFile(
315+
overrideFile,
316+
"utf-8",
317+
);
318+
}
319+
else {
320+
contentInVersionFile = await fs.readFile(
321+
`${path.join(await resolveRoot(), "eng/common/testproxy/target_version.txt")}`,
322+
"utf-8",
323+
);
324+
}
311325

312326
const tag = contentInVersionFile.trim();
313327

eng/target_proxy_version.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.0.0-dev.20240410.1

0 commit comments

Comments
 (0)