Skip to content

Commit 31c7e52

Browse files
authored
Merge pull request #3971 from dmichon-msft/azure-auth-remove-sdk
[rush-azure-storage-plugin] Remove rush-sdk dependency from AzureStorageAuthentication
2 parents a3ea245 + 0435a72 commit 31c7e52

File tree

5 files changed

+20
-7
lines changed

5 files changed

+20
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/rush",
5+
"comment": "Remove runtime dependency on @rushstack/rush-sdk from the AzureStorageAuthentication class in @rushstack/rush-azure-storage-build-cache-plugin so that it can be used in isolation.",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@microsoft/rush"
10+
}

common/reviews/api/rush-azure-storage-build-cache-plugin.api.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export abstract class AzureAuthenticationBase {
2222
// (undocumented)
2323
protected abstract readonly _credentialNameForCache: string;
2424
// (undocumented)
25-
protected abstract readonly _credentialUpdateCommandForLogging: string | undefined;
25+
protected readonly _credentialUpdateCommandForLogging: string | undefined;
2626
// (undocumented)
2727
deleteCachedCredentialsAsync(terminal: ITerminal): Promise<void>;
2828
protected abstract _getCacheIdParts(): string[];
@@ -48,8 +48,6 @@ export class AzureStorageAuthentication extends AzureAuthenticationBase {
4848
// (undocumented)
4949
protected readonly _credentialNameForCache: string;
5050
// (undocumented)
51-
protected readonly _credentialUpdateCommandForLogging: string;
52-
// (undocumented)
5351
protected _getCacheIdParts(): string[];
5452
// (undocumented)
5553
protected _getCredentialFromDeviceCodeAsync(terminal: ITerminal, deviceCodeCredential: DeviceCodeCredential): Promise<ICredentialResult>;
@@ -70,6 +68,8 @@ export type ExpiredCredentialBehavior = 'logWarning' | 'throwError' | 'ignore';
7068
export interface IAzureAuthenticationBaseOptions {
7169
// (undocumented)
7270
azureEnvironment?: AzureEnvironmentName;
71+
// (undocumented)
72+
credentialUpdateCommandForLogging?: string | undefined;
7373
}
7474

7575
// @public (undocumented)

rush-plugins/rush-azure-storage-build-cache-plugin/src/AzureAuthenticationBase.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export type AzureEnvironmentName = keyof typeof AzureAuthorityHosts;
7272
*/
7373
export interface IAzureAuthenticationBaseOptions {
7474
azureEnvironment?: AzureEnvironmentName;
75+
credentialUpdateCommandForLogging?: string | undefined;
7576
}
7677

7778
/**
@@ -88,7 +89,7 @@ export interface IAzureAuthenticationBaseOptions {
8889
export abstract class AzureAuthenticationBase {
8990
protected abstract readonly _credentialNameForCache: string;
9091
protected abstract readonly _credentialKindForLogging: string;
91-
protected abstract readonly _credentialUpdateCommandForLogging: string | undefined;
92+
protected readonly _credentialUpdateCommandForLogging: string | undefined;
9293

9394
protected readonly _azureEnvironment: AzureEnvironmentName;
9495

@@ -109,6 +110,7 @@ export abstract class AzureAuthenticationBase {
109110

110111
public constructor(options: IAzureAuthenticationBaseOptions) {
111112
this._azureEnvironment = options.azureEnvironment || 'AzurePublicCloud';
113+
this._credentialUpdateCommandForLogging = options.credentialUpdateCommandForLogging;
112114
}
113115

114116
public async updateCachedCredentialAsync(terminal: ITerminal, credential: string): Promise<void> {

rush-plugins/rush-azure-storage-build-cache-plugin/src/AzureStorageAuthentication.ts

-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
type ServiceGetUserDelegationKeyResponse
1111
} from '@azure/storage-blob';
1212
import type { ITerminal } from '@rushstack/node-core-library';
13-
import { RushConstants } from '@rushstack/rush-sdk';
1413
import {
1514
AzureAuthenticationBase,
1615
type ICredentialResult,
@@ -34,7 +33,6 @@ const SAS_TTL_MILLISECONDS: number = 7 * 24 * 60 * 60 * 1000; // Seven days
3433
export class AzureStorageAuthentication extends AzureAuthenticationBase {
3534
protected readonly _credentialNameForCache: string = 'azure-blob-storage';
3635
protected readonly _credentialKindForLogging: string = 'Storage';
37-
protected readonly _credentialUpdateCommandForLogging: string = `rush ${RushConstants.updateCloudCredentialsCommandName}`;
3836

3937
protected readonly _storageAccountName: string;
4038
protected readonly _storageContainerName: string;

rush-plugins/rush-azure-storage-build-cache-plugin/src/AzureStorageBuildCacheProvider.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ export class AzureStorageBuildCacheProvider
4343
private _containerClient: ContainerClient | undefined;
4444

4545
public constructor(options: IAzureStorageBuildCacheProviderOptions) {
46-
super(options);
46+
super({
47+
credentialUpdateCommandForLogging: `rush ${RushConstants.updateCloudCredentialsCommandName}`,
48+
...options
49+
});
4750

4851
this._blobPrefix = options.blobPrefix;
4952
this._environmentCredential = EnvironmentConfiguration.buildCacheCredential;

0 commit comments

Comments
 (0)