Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@
"icon": "$(add)"
},
{
"command": "containerApps.deployImage",
"title": "%containerApps.deployImage%",
"category": "Azure Container Apps"
"command": "containerApps.deploy",
"title": "%containerApps.deploy%",
"category": "Azure Container Apps",
"icon": "$(cloud-upload)"
},
{
"command": "containerApps.deployImageApi",
Expand Down Expand Up @@ -151,6 +152,13 @@
}
],
"menus": {
"azureWorkspaceDeploy": [
{
"command": "containerApps.deploy",
"when": "view == azureWorkspace",
"group": "navigation@3"
}
],
Comment thread
MicroFish91 marked this conversation as resolved.
"view/item/context": [
{
"command": "containerApps.createManagedEnvironment",
Expand All @@ -168,7 +176,7 @@
"group": "3@1"
},
{
"command": "containerApps.deployImage",
"command": "containerApps.deploy",
"when": "view == azureResourceGroups && viewItem =~ /containerApp[^s]/i",
"group": "3@1"
},
Expand Down
2 changes: 1 addition & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"containerApps.enableOutputTimestamps": "Prepends each line displayed in the output channel with a timestamp.",
"containerApps.browse": "Browse",
"containerApps.createContainerApp": "Create Container App...",
"containerApps.deployImage": "Update Image in Container App...",
"containerApps.deploy": "Deploy to Container App...",
"containerApps.deployImageApi": "Update Image in Container App (API)...",
"containerApps.deleteContainerApp": "Delete Container App...",
"containerApps.disableIngress": "Disable Ingress for Container App",
Expand Down
3 changes: 3 additions & 0 deletions src/commands/createContainerApp/createContainerApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export async function createContainerApp(context: IActionContext & Partial<ICrea
showLoadingPrompt: true
});

// we want to add the quick start image _only_ for the create scenairo
wizardContext.useQuickStartImage = true;

await wizard.prompt();
const newContainerAppName = nonNullProp(wizardContext, 'newContainerAppName');

Expand Down
1 change: 1 addition & 0 deletions src/commands/deploy/IDeployBaseContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface IDeployBaseContext extends ISubscriptionActionContext {
targetContainer?: ContainerAppModel;

imageSource?: ImageSourceValues;
useQuickStartImage?: boolean;
Comment thread
bwateratmsft marked this conversation as resolved.
Outdated

// Base image attributes used as a precursor for either creating or updating a container app
image?: string;
Expand Down
9 changes: 6 additions & 3 deletions src/commands/deploy/ImageSourceListStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,21 @@ import { DeployFromRegistryConfigureStep } from "./deployFromRegistry/DeployFrom
export class ImageSourceListStep extends AzureWizardPromptStep<IDeployBaseContext> {
public async prompt(context: IDeployBaseContext): Promise<void> {
const imageSourceLabels: string[] = [
localize('quickStartImage', 'Use quickstart image'),
localize('externalRegistry', 'Use existing image'),
localize('quickStartImage', 'Use quickstart image'),
// localize('buildFromProject', 'Build from project'),
];

const placeHolder: string = localize('imageBuildSourcePrompt', 'Select an image source for the container app');
const picks: IAzureQuickPickItem<ImageSourceValues | undefined>[] = [
{ label: imageSourceLabels[0], data: ImageSource.QuickStartImage, suppressPersistence: true },
{ label: imageSourceLabels[1], data: ImageSource.ExternalRegistry, suppressPersistence: true },
{ label: imageSourceLabels[0], data: ImageSource.ExternalRegistry, suppressPersistence: true },
// { label: imageSourceLabels[2], data: undefined, suppressPersistence: true },
];

if (context.useQuickStartImage !== undefined) {
Comment thread
bwateratmsft marked this conversation as resolved.
Outdated
picks.unshift({ label: imageSourceLabels[1], data: ImageSource.QuickStartImage, suppressPersistence: true });
}

context.imageSource = (await context.ui.showQuickPick(picks, { placeHolder })).data;
}

Expand Down
52 changes: 52 additions & 0 deletions src/commands/deploy/deploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { VerifyProvidersStep } from "@microsoft/vscode-azext-azureutils";
import { AzureWizard, AzureWizardExecuteStep, AzureWizardPromptStep, ITreeItemPickerContext, createSubscriptionContext } from "@microsoft/vscode-azext-utils";
import { webProvider } from "../../constants";
import { ContainerAppItem } from "../../tree/ContainerAppItem";
import { localize } from "../../utils/localize";
import { pickContainerApp } from "../../utils/pickContainerApp";
import { ContainerAppOverwriteConfirmStep } from "./ContainerAppOverwriteConfirmStep";
import { ContainerAppUpdateStep } from "./ContainerAppUpdateStep";
import { IDeployBaseContext } from "./IDeployBaseContext";
import { ImageSourceListStep } from "./ImageSourceListStep";

export async function deploy(context: ITreeItemPickerContext & Partial<IDeployBaseContext>, node?: ContainerAppItem): Promise<void> {
if (!node) {
context.suppressCreatePick = true;
node = await pickContainerApp(context);
}

const { subscription, containerApp } = node;

const wizardContext: IDeployBaseContext = {
...context,
...createSubscriptionContext(subscription),
subscription,
targetContainer: containerApp
};

const title: string = localize('deploy', 'Deploying to "{0}"', containerApp.name);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this variable is only used in one place below on line 44. Can we just create this value inline on line 44 instead of creating a constant for it here?


const promptSteps: AzureWizardPromptStep<IDeployBaseContext>[] = [
new ContainerAppOverwriteConfirmStep(),
new ImageSourceListStep()
];

const executeSteps: AzureWizardExecuteStep<IDeployBaseContext>[] = [
new VerifyProvidersStep([webProvider]),
new ContainerAppUpdateStep()
];

const wizard: AzureWizard<IDeployBaseContext> = new AzureWizard(wizardContext, {
title,
promptSteps,
executeSteps,
showLoadingPrompt: true
});

await wizard.prompt();
await wizard.execute();
}
4 changes: 2 additions & 2 deletions src/commands/registerCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { createContainerApp } from './createContainerApp/createContainerApp';
import { createManagedEnvironment } from './createManagedEnvironment/createManagedEnvironment';
import { deleteContainerApp } from './deleteContainerApp/deleteContainerApp';
import { deleteManagedEnvironment } from './deleteManagedEnvironment/deleteManagedEnvironment';
import { deployFromRegistry } from './deploy/deployFromRegistry/deployFromRegistry';
import { deploy } from './deploy/deploy';
import { deployImageApi } from './deploy/deployFromRegistry/deployImageApi';
import { disableIngress } from './ingress/disableIngress';
import { editTargetPort } from './ingress/editTargetPort';
Expand All @@ -31,7 +31,7 @@ export function registerCommands(): void {
// container apps
registerCommandWithTreeNodeUnwrapping('containerApps.createContainerApp', createContainerApp);
registerCommandWithTreeNodeUnwrapping('containerApps.deleteContainerApp', deleteContainerApp);
registerCommandWithTreeNodeUnwrapping('containerApps.deployImage', deployFromRegistry);
registerCommandWithTreeNodeUnwrapping('containerApps.deploy', deploy);
registerCommandWithTreeNodeUnwrapping('containerApps.deployImageApi', deployImageApi);
registerCommandWithTreeNodeUnwrapping('containerApps.openConsoleInPortal', openConsoleInPortal);
registerCommandWithTreeNodeUnwrapping('containerApps.browse', browseContainerAppNode);
Expand Down