-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathbuildImageInAzure.ts
More file actions
28 lines (23 loc) · 1.21 KB
/
buildImageInAzure.ts
File metadata and controls
28 lines (23 loc) · 1.21 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
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { Run as AcrRun } from '@azure/arm-containerregistry';
import { KnownRunStatus } from '@azure/arm-containerregistry';
import { nonNullValue } from '@microsoft/vscode-azext-utils';
import { delay } from '../../../../utils/delay';
import { BuildImageInAzureImageSourceContext } from './BuildImageInAzureImageSourceContext';
const WAIT_MS = 5000;
export async function buildImageInAzure(context: BuildImageInAzureImageSourceContext): Promise<AcrRun | undefined> {
const getRun = async () => context.client.runs.get(context.resourceGroupName, context.registryName, nonNullValue(context.run.runId));
let run = await getRun();
while (
run.status === KnownRunStatus.Started ||
run.status === KnownRunStatus.Queued ||
run.status === KnownRunStatus.Running
) {
await delay(WAIT_MS);
run = await getRun();
}
return run;
}