-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathTarFileStep.ts
More file actions
25 lines (20 loc) · 1.1 KB
/
TarFileStep.ts
File metadata and controls
25 lines (20 loc) · 1.1 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
/*---------------------------------------------------------------------------------------------
* 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 * as os from 'os';
import { URI, Utils } from "vscode-uri";
import { IBuildImageInAzureContext } from "./IBuildImageInAzureContext";
const idPrecision = 6;
export class TarFileStep extends AzureWizardExecuteStep<IBuildImageInAzureContext> {
public priority: number = 150;
public async execute(context: IBuildImageInAzureContext): Promise<void> {
const id: number = Math.floor(Math.random() * Math.pow(10, idPrecision));
const archive = `sourceArchive${id}.tar.gz`;
context.tarFilePath = Utils.joinPath(URI.parse(os.tmpdir()), archive).path;
}
public shouldExecute(context: IBuildImageInAzureContext): boolean {
return !context.tarFilePath;
}
}