Skip to content

Commit 73a4b34

Browse files
authored
Add backward compatibility to API in support of the new managed identity features (#816)
1 parent b112787 commit 73a4b34

File tree

8 files changed

+42
-13
lines changed

8 files changed

+42
-13
lines changed

src/commands/api/CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
# Change Log
22

3-
### 0.0.2
3+
### 0.0.3
44

55
### Changed
6+
* [[816]](https://github.com/microsoft/vscode-azurecontainerapps/pull/816) Added backward compatibility to ensure existing functionality remains unaffected by new managed identity features.
7+
8+
### 0.0.2
69

10+
### Changed
711
* [[615]](https://github.com/microsoft/vscode-azurecontainerapps/pull/615) Removed ability to set option `ignoreExistingDeploySettings`. This will now happen automatically by default.
812

913
## 0.0.1
1014
* Initial release
1115

1216
### Added
13-
1417
* [[578]](https://github.com/microsoft/vscode-azurecontainerapps/pull/578) Added an API entry-point to the `deployWorkspaceProject` command

src/commands/api/deployWorkspaceProjectApi.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,21 @@ import { type DeployWorkspaceProjectContext } from "../deployWorkspaceProject/De
1515
import { getDeployWorkspaceProjectResults, type DeployWorkspaceProjectResults } from "../deployWorkspaceProject/getDeployWorkspaceProjectResults";
1616
import { type DeployWorkspaceProjectInternalContext } from "../deployWorkspaceProject/internal/DeployWorkspaceProjectInternalContext";
1717
import { deployWorkspaceProjectInternal } from "../deployWorkspaceProject/internal/deployWorkspaceProjectInternal";
18+
import { RegistryCredentialType } from "../registryCredentials/RegistryCredentialsAddConfigurationListStep";
1819
import type * as api from "./vscode-azurecontainerapps.api";
1920

2021
export async function deployWorkspaceProjectApi(deployWorkspaceProjectOptions: api.DeployWorkspaceProjectOptionsContract): Promise<DeployWorkspaceProjectResults> {
2122
return await callWithTelemetryAndErrorHandling('containerApps.api.deployWorkspaceProject', async (context: IActionContext): Promise<DeployWorkspaceProjectResults> => {
22-
const { resourceGroupId, rootPath, dockerfilePath, srcPath, suppressConfirmation, suppressContainerAppCreation, shouldSaveDeploySettings } = deployWorkspaceProjectOptions;
23+
const {
24+
resourceGroupId,
25+
rootPath,
26+
dockerfilePath,
27+
srcPath,
28+
suppressRegistryPrompt,
29+
suppressConfirmation,
30+
suppressContainerAppCreation,
31+
shouldSaveDeploySettings
32+
} = deployWorkspaceProjectOptions;
2333

2434
const subscription: AzureSubscription = await subscriptionExperience(context, ext.rgApiV2.resources.azureResourceTreeDataProvider, {
2535
selectBySubscriptionId: getSubscriptionIdFromOptions(deployWorkspaceProjectOptions),
@@ -38,12 +48,14 @@ export async function deployWorkspaceProjectApi(deployWorkspaceProjectOptions: a
3848
rootFolder,
3949
srcPath: srcPath ? Uri.file(srcPath).fsPath : undefined,
4050
dockerfilePath: dockerfilePath ? Uri.file(dockerfilePath).fsPath : undefined,
51+
newRegistryCredentialType: RegistryCredentialType.DockerLogin,
4152
shouldSaveDeploySettings: !!shouldSaveDeploySettings,
4253
});
4354

4455
const deployWorkspaceProjectContext: DeployWorkspaceProjectContext = await deployWorkspaceProjectInternal(deployWorkspaceProjectInternalContext, {
4556
suppressActivity: true,
4657
suppressConfirmation,
58+
suppressRegistryPrompt: suppressRegistryPrompt ?? true,
4759
suppressContainerAppCreation,
4860
suppressProgress: true,
4961
suppressWizardTitle: true,

src/commands/api/getAzureContainerAppsApiProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type * as api from "./vscode-azurecontainerapps.api";
99

1010
export function getAzureContainerAppsApiProvider(): apiUtils.AzureExtensionApiProvider {
1111
return createApiProvider([<api.AzureContainerAppsExtensionApi>{
12-
// Todo: Change this to 0.0.2 later. 0.0.2 is backwards compatible anyway so this change should be fine either way.
12+
// Todo: Change this to 0.0.3 later. 0.0.3 is backwards compatible anyway so this change should be fine either way.
1313
// For some reason it's causing a block on Function side, so just keep it at 0.0.1 until we figure out why
1414
apiVersion: '0.0.1',
1515
deployWorkspaceProject: deployWorkspaceProjectApi

src/commands/api/vscode-azurecontainerapps.api.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export interface DeployWorkspaceProjectOptionsContract {
1919
dockerfilePath?: string;
2020

2121
// Options
22+
suppressRegistryPrompt?: boolean;
2223
suppressConfirmation?: boolean; // Suppress any [resource] confirmation prompts
2324
suppressContainerAppCreation?: boolean;
2425
shouldSaveDeploySettings?: boolean;

src/commands/deployWorkspaceProject/internal/deployWorkspaceProjectInternal.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ export interface DeployWorkspaceProjectInternalOptions {
3434
* Suppress showing the wizard execution through the activity log
3535
*/
3636
suppressActivity?: boolean;
37+
/**
38+
* Suppress registry selection prompt
39+
*/
40+
suppressRegistryPrompt?: boolean;
3741
/**
3842
* Suppress any [resource] confirmation prompts
3943
*/
@@ -78,7 +82,7 @@ export async function deployWorkspaceProjectInternal(
7882
undefined :
7983
localize('loadingWorkspaceTitle', 'Loading workspace project starting configurations...')
8084
}, async () => {
81-
startingConfiguration = await getStartingConfiguration({ ...context });
85+
startingConfiguration = await getStartingConfiguration({ ...context }, options);
8286
});
8387

8488
if (startingConfiguration?.containerApp?.revisionsMode === KnownActiveRevisionsMode.Multiple) {

src/commands/deployWorkspaceProject/internal/startingConfiguration/getStartingConfiguration.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,26 @@ import { DockerfileItemStep } from "../../../image/imageSource/buildImageInAzure
1111
import { AcrBuildSupportedOS } from "../../../image/imageSource/buildImageInAzure/OSPickStep";
1212
import { RootFolderStep } from "../../../image/imageSource/buildImageInAzure/RootFolderStep";
1313
import { type DeployWorkspaceProjectInternalContext } from "../DeployWorkspaceProjectInternalContext";
14+
import { type DeployWorkspaceProjectInternalOptions } from "../deployWorkspaceProjectInternal";
1415
import { DwpAcrListStep } from "./DwpAcrListStep";
1516
import { DwpManagedEnvironmentListStep } from "./DwpManagedEnvironmentListStep";
1617
import { getResourcesFromContainerAppHelper, getResourcesFromManagedEnvironmentHelper } from "./containerAppsResourceHelpers";
1718

18-
export async function getStartingConfiguration(context: DeployWorkspaceProjectInternalContext): Promise<Partial<DeployWorkspaceProjectInternalContext>> {
19+
export async function getStartingConfiguration(context: DeployWorkspaceProjectInternalContext, options: DeployWorkspaceProjectInternalOptions): Promise<Partial<DeployWorkspaceProjectInternalContext>> {
1920
await tryAddMissingAzureResourcesToContext(context);
2021

22+
const promptSteps = [
23+
new RootFolderStep(),
24+
new DockerfileItemStep(),
25+
new DwpManagedEnvironmentListStep(),
26+
];
27+
28+
if (!options.suppressRegistryPrompt) {
29+
promptSteps.push(new DwpAcrListStep());
30+
}
31+
2132
const wizard: AzureWizard<DeployWorkspaceProjectInternalContext> = new AzureWizard(context, {
22-
promptSteps: [
23-
new RootFolderStep(),
24-
new DockerfileItemStep(),
25-
new DwpManagedEnvironmentListStep(),
26-
new DwpAcrListStep(),
27-
],
33+
promptSteps,
2834
});
2935

3036
await wizard.prompt();
@@ -38,6 +44,7 @@ export async function getStartingConfiguration(context: DeployWorkspaceProjectIn
3844
containerApp: context.containerApp,
3945
registry: context.registry,
4046
newRegistrySku: KnownSkuName.Basic,
47+
suppressEnableAdminUserPrompt: options.suppressConfirmation,
4148
imageSource: ImageSource.RemoteAcrBuild,
4249
os: AcrBuildSupportedOS.Linux,
4350
envPath: context.envPath,

src/commands/registryCredentials/dockerLogin/AcrEnableAdminUserConfirmStep.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ export class AcrEnableAdminUserConfirmStep extends AzureWizardPromptStep<DockerL
1616
}
1717

1818
public shouldPrompt(context: DockerLoginRegistryCredentialsContext): boolean {
19-
return getRegistryDomainFromContext(context) === acrDomain && !context.registry?.adminUserEnabled;
19+
return !context.suppressEnableAdminUserPrompt && getRegistryDomainFromContext(context) === acrDomain && !context.registry?.adminUserEnabled;
2020
}
2121
}

src/commands/registryCredentials/dockerLogin/DockerLoginRegistryCredentialsContext.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ export interface DockerLoginRegistryCredentialsContext extends CreateAcrContext,
1717

1818
newRegistrySecret?: Secret;
1919
newRegistryCredential?: RegistryCredentials;
20+
21+
suppressEnableAdminUserPrompt?: boolean;
2022
}

0 commit comments

Comments
 (0)