-
Notifications
You must be signed in to change notification settings - Fork 16
Add changes for re running "Deploy to Container App" command #999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,7 +4,8 @@ | |||||
| *--------------------------------------------------------------------------------------------*/ | ||||||
|
|
||||||
| import { KnownActiveRevisionsMode } from "@azure/arm-appcontainers"; | ||||||
| import { AzureWizard, CopilotUserInput, createSubscriptionContext, nonNullProp, type AzureWizardPromptStep, type IActionContext, type ISubscriptionActionContext, type ISubscriptionContext } from "@microsoft/vscode-azext-utils"; | ||||||
| import { AzureWizard, createSubscriptionContext, nonNullProp, type AzureWizardPromptStep, type IActionContext, type ISubscriptionActionContext, type ISubscriptionContext } from "@microsoft/vscode-azext-utils"; | ||||||
| import { type AzureSubscription } from "@microsoft/vscode-azureresources-api"; | ||||||
| import { ImageSource } from "../../constants"; | ||||||
| import { type ContainerAppItem } from "../../tree/ContainerAppItem"; | ||||||
| import { createActivityContext } from "../../utils/activityUtils"; | ||||||
|
|
@@ -14,9 +15,11 @@ import { getVerifyProvidersStep } from "../../utils/getVerifyProvidersStep"; | |||||
| import { localize } from "../../utils/localize"; | ||||||
| import { pickContainerApp } from "../../utils/pickItem/pickContainerApp"; | ||||||
| import { OpenConfirmationViewStep } from "../../webviews/OpenConfirmationViewStep"; | ||||||
| import { OpenLoadingViewStep } from "../../webviews/OpenLoadingViewStep"; | ||||||
| import { openLoadingViewPanel } from "../../webviews/OpenLoadingViewStep"; | ||||||
| import { CommandAttributes } from "../CommandAttributes"; | ||||||
| import { ContainerAppOverwriteConfirmStep } from "../ContainerAppOverwriteConfirmStep"; | ||||||
| import { ContainerAppListStep } from "../createContainerApp/ContainerAppListStep"; | ||||||
| import { ManagedEnvironmentListStep } from "../createManagedEnvironment/ManagedEnvironmentListStep"; | ||||||
| import { deployWorkspaceProject } from "../deployWorkspaceProject/deployWorkspaceProject"; | ||||||
| import { type DeployWorkspaceProjectResults } from "../deployWorkspaceProject/getDeployWorkspaceProjectResults"; | ||||||
| import { editContainerCommandName } from "../editContainer/editContainer"; | ||||||
|
|
@@ -45,29 +48,58 @@ export async function deployContainerApp(context: IActionContext, node?: Contain | |||||
| return await deployWorkspaceProject(context, item); | ||||||
| } | ||||||
|
|
||||||
| const wizardContext: ContainerAppDeployContext = { | ||||||
| ...subscriptionActionContext, | ||||||
| ...await createActivityContext({ withChildren: true }), | ||||||
| subscription: item.subscription, | ||||||
| containerApp: item.containerApp, | ||||||
| managedEnvironment: await getManagedEnvironmentFromContainerApp(subscriptionActionContext, item.containerApp), | ||||||
| imageSource, | ||||||
| activityAttributes: CommandAttributes.DeployContainerAppContainerRegistry, | ||||||
| }; | ||||||
|
|
||||||
| if (isAzdExtensionInstalled()) { | ||||||
| wizardContext.telemetry.properties.isAzdExtensionInstalled = 'true'; | ||||||
| return await deployContainerAppInternal(subscriptionActionContext, item, imageSource); | ||||||
| } | ||||||
|
|
||||||
| export async function deployContainerAppInternal(context: ISubscriptionActionContext, node?: ContainerAppItem, imageSource?: ImageSource, subscription?: AzureSubscription): Promise<void> { | ||||||
| if (isCopilotUserInput(context)) { | ||||||
| await openLoadingViewPanel(context); | ||||||
| } | ||||||
|
|
||||||
| const promptSteps: AzureWizardPromptStep<ContainerAppDeployContext>[] = []; | ||||||
|
|
||||||
| if (!node) { | ||||||
| promptSteps.push(new ManagedEnvironmentListStep(), new ContainerAppListStep()); | ||||||
| } | ||||||
|
|
||||||
| let wizardContext: ContainerAppDeployContext = {} as ContainerAppDeployContext; | ||||||
|
|
||||||
| if (context.subscriptionId && node && imageSource) { | ||||||
| // If this command gets re run we only want the internal portion of the command to run, so we set the callbackid | ||||||
| context.callbackId = 'containerApps.deployContainerAppInternal'; | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain what this means? |
||||||
| wizardContext = { | ||||||
| ...context, | ||||||
| ...await createActivityContext({ withChildren: true }), | ||||||
| subscription: node.subscription, | ||||||
| containerApp: node.containerApp, | ||||||
| managedEnvironment: await getManagedEnvironmentFromContainerApp(context, node.containerApp), | ||||||
| imageSource, | ||||||
| activityAttributes: { | ||||||
| ...CommandAttributes.DeployContainerAppContainerRegistry, | ||||||
| subscription: node.subscription, | ||||||
| }, | ||||||
| }; | ||||||
|
|
||||||
| if (isAzdExtensionInstalled()) { | ||||||
| wizardContext.telemetry.properties.isAzdExtensionInstalled = 'true'; | ||||||
| } | ||||||
| wizardContext.telemetry.properties.revisionMode = node.containerApp.revisionsMode; | ||||||
| } else if (context.subscriptionId && subscription) { | ||||||
| wizardContext = { | ||||||
| ...context, | ||||||
| ...await createActivityContext({ withChildren: true }), | ||||||
| subscription: subscription, | ||||||
| //at the moment we are only supporting re run with container registry image source | ||||||
| imageSource: ImageSource.ContainerRegistry | ||||||
| } | ||||||
| } | ||||||
| wizardContext.telemetry.properties.revisionMode = item.containerApp.revisionsMode; | ||||||
|
|
||||||
| const confirmationViewTitle: string = localize('summary', 'Summary'); | ||||||
| let confirmationViewDescription: string = localize('viewDescription', 'Please select an input you would like to change. Note: Any input proceeding the changed input will need to change as well'); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| let confirmationViewTabTitle: string = localize('deployContainerAppTabTitle', 'Summary - Deploy Image to Container App'); | ||||||
| let title: string = localize('deployContainerAppTitle', 'Deploy image to container app'); | ||||||
|
|
||||||
| const promptSteps: AzureWizardPromptStep<ContainerAppDeployContext>[] = [] | ||||||
| if (wizardContext.ui instanceof CopilotUserInput) { | ||||||
| promptSteps.push(new OpenLoadingViewStep()); | ||||||
| if (isCopilotUserInput(wizardContext)) { | ||||||
| confirmationViewDescription = localize('viewDescription', 'Please review AI generated inputs and select any you would like to modify. Note: Any input proceeding the modified input will need to change as well'); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| confirmationViewTabTitle = localize('deployContainerAppTabTitle', 'Summary - Deploy Image to Container App using Copilot'); | ||||||
| title = localize('deployContainerAppWithCopilotTitle', 'Deploy image to container app using copilot'); | ||||||
|
|
@@ -105,3 +137,7 @@ async function promptImageSource(context: ISubscriptionActionContext): Promise<I | |||||
|
|
||||||
| return nonNullProp(promptContext, 'imageSource'); | ||||||
| } | ||||||
|
|
||||||
| function isCopilotUserInput(context: IActionContext): boolean { | ||||||
| return context.ui.constructor.name === 'CopilotUserInput'; | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you do |
||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,9 +7,9 @@ import { type RegistryCredentials } from "@azure/arm-appcontainers"; | |
| import { type SupportedRegistries } from "../../../constants"; | ||
| import { type IContainerAppContext } from "../../IContainerAppContext"; | ||
| import { type CreateAcrContext } from "../../image/imageSource/containerRegistry/acr/createAcr/CreateAcrContext"; | ||
| import { type ManagedEnvironmentRequiredContext } from "../../ManagedEnvironmentContext"; | ||
| import { type ManagedEnvironmentContext } from "../../ManagedEnvironmentContext"; | ||
|
|
||
| export interface ManagedIdentityRegistryCredentialsContext extends CreateAcrContext, ManagedEnvironmentRequiredContext, IContainerAppContext { | ||
| export interface ManagedIdentityRegistryCredentialsContext extends CreateAcrContext, ManagedEnvironmentContext, IContainerAppContext { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Context loosened from ManagedEnvironmentRequiredContext → ManagedEnvironmentContext. |
||
| registryDomain?: SupportedRegistries; | ||
| newRegistryCredential?: RegistryCredentials; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Missed localization