-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathdeploy.ts
More file actions
52 lines (44 loc) · 2.17 KB
/
deploy.ts
File metadata and controls
52 lines (44 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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);
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();
}