-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathBuildImageStep.ts
More file actions
33 lines (27 loc) · 1.43 KB
/
BuildImageStep.ts
File metadata and controls
33 lines (27 loc) · 1.43 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
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { AzureWizardExecuteStep } from "@microsoft/vscode-azext-utils";
import { acrDomain } from "../../../constants";
import { localize } from "../../../utils/localize";
import { IBuildImageInAzureContext } from "./IBuildImageInAzureContext";
import { buildImageInAzure } from "./buildImageInAzure";
export class BuildImageStep extends AzureWizardExecuteStep<IBuildImageInAzureContext> {
public priority: number = 225;
public async execute(context: IBuildImageInAzureContext): Promise<void> {
context.registryDomain = acrDomain;
const run = await buildImageInAzure(context);
const outputImages = run?.outputImages;
context.telemetry.properties.outputImages = outputImages?.length?.toString();
if (outputImages) {
const image = outputImages[0];
context.image = `${image.registry}/${image.repository}:${image.tag}`;
} else {
throw new Error(localize('noImagesBuilt', 'Failed to build image.'));
}
}
public shouldExecute(context: IBuildImageInAzureContext): boolean {
return !context.image;
}
}