Skip to content

Commit 704485d

Browse files
Copiloticlanton
andauthored
Fix CI: add missing useStreamingBuildCache to bridge plugin, fix WebClient private member type mismatch
Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/1b32730c-9ce0-4e75-a2e1-45f06a628960 Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com>
1 parent dd2acb4 commit 704485d

2 files changed

Lines changed: 62 additions & 58 deletions

File tree

libraries/rush-lib/src/utilities/WebClient.ts

Lines changed: 60 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ export class WebClient {
351351
url: string,
352352
options?: IGetFetchOptions | IFetchOptionsWithBody
353353
): Promise<IWebClientResponse> {
354-
const requestInit: IRequestOptions = this._buildRequestOptions(options);
354+
const requestInit: IRequestOptions = buildRequestOptions(this, options);
355355
return await WebClient._requestFn(url, requestInit);
356356
}
357357

@@ -363,68 +363,71 @@ export class WebClient {
363363
url: string,
364364
options?: IGetFetchOptions | IFetchOptionsWithBody
365365
): Promise<IWebClientStreamResponse> {
366-
const requestInit: IRequestOptions = this._buildRequestOptions(options);
366+
const requestInit: IRequestOptions = buildRequestOptions(this, options);
367367
return await WebClient._streamRequestFn(url, requestInit);
368368
}
369+
}
369370

370-
private _buildRequestOptions(options?: IGetFetchOptions | IFetchOptionsWithBody): IRequestOptions {
371-
const {
372-
headers: optionsHeaders,
373-
timeoutMs = 15 * 1000,
374-
verb,
375-
redirect,
376-
body,
377-
noDecode
378-
} = (options as IFetchOptionsWithBody | undefined) ?? {};
379-
380-
const headers: Record<string, string> = {};
381-
382-
WebClient.mergeHeaders(headers, this.standardHeaders);
383-
384-
if (optionsHeaders) {
385-
WebClient.mergeHeaders(headers, optionsHeaders);
386-
}
387-
388-
if (this.userAgent) {
389-
headers[USER_AGENT_HEADER_NAME] = this.userAgent;
390-
}
391-
392-
if (this.accept) {
393-
headers[ACCEPT_HEADER_NAME] = this.accept;
394-
}
371+
function buildRequestOptions(
372+
client: WebClient,
373+
options?: IGetFetchOptions | IFetchOptionsWithBody
374+
): IRequestOptions {
375+
const {
376+
headers: optionsHeaders,
377+
timeoutMs = 15 * 1000,
378+
verb,
379+
redirect,
380+
body,
381+
noDecode
382+
} = (options as IFetchOptionsWithBody | undefined) ?? {};
383+
384+
const headers: Record<string, string> = {};
385+
386+
WebClient.mergeHeaders(headers, client.standardHeaders);
387+
388+
if (optionsHeaders) {
389+
WebClient.mergeHeaders(headers, optionsHeaders);
390+
}
395391

396-
let proxyUrl: string = '';
392+
if (client.userAgent) {
393+
headers[USER_AGENT_HEADER_NAME] = client.userAgent;
394+
}
397395

398-
switch (this.proxy) {
399-
case WebClientProxy.Detect:
400-
if (process.env.HTTPS_PROXY) {
401-
proxyUrl = process.env.HTTPS_PROXY;
402-
} else if (process.env.HTTP_PROXY) {
403-
proxyUrl = process.env.HTTP_PROXY;
404-
}
405-
break;
406-
407-
case WebClientProxy.Fiddler:
408-
// For debugging, disable cert validation
409-
// eslint-disable-next-line
410-
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0';
411-
proxyUrl = 'http://localhost:8888/';
412-
break;
413-
}
396+
if (client.accept) {
397+
headers[ACCEPT_HEADER_NAME] = client.accept;
398+
}
414399

415-
let agent: HttpAgent | undefined = undefined;
416-
if (proxyUrl) {
417-
agent = createHttpsProxyAgent(proxyUrl);
418-
}
400+
let proxyUrl: string = '';
401+
402+
switch (client.proxy) {
403+
case WebClientProxy.Detect:
404+
if (process.env.HTTPS_PROXY) {
405+
proxyUrl = process.env.HTTPS_PROXY;
406+
} else if (process.env.HTTP_PROXY) {
407+
proxyUrl = process.env.HTTP_PROXY;
408+
}
409+
break;
410+
411+
case WebClientProxy.Fiddler:
412+
// For debugging, disable cert validation
413+
// eslint-disable-next-line
414+
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0';
415+
proxyUrl = 'http://localhost:8888/';
416+
break;
417+
}
419418

420-
return {
421-
method: verb,
422-
headers,
423-
agent,
424-
timeout: timeoutMs,
425-
redirect,
426-
body,
427-
noDecode
428-
};
419+
let agent: HttpAgent | undefined = undefined;
420+
if (proxyUrl) {
421+
agent = createHttpsProxyAgent(proxyUrl);
429422
}
423+
424+
return {
425+
method: verb,
426+
headers,
427+
agent,
428+
timeout: timeoutMs,
429+
redirect,
430+
body,
431+
noDecode
432+
};
430433
}

rush-plugins/rush-bridge-cache-plugin/src/BridgeCachePlugin.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ export class BridgeCachePlugin implements IRushPlugin {
119119
{
120120
buildCacheConfiguration,
121121
terminal,
122-
excludeAppleDoubleFiles: !!omitAppleDoubleFilesFromBuildCache
122+
excludeAppleDoubleFiles: !!omitAppleDoubleFilesFromBuildCache,
123+
useStreamingBuildCache: false
123124
}
124125
);
125126

0 commit comments

Comments
 (0)