Skip to content

Commit 982ba44

Browse files
committed
More feedback
1 parent e1eed98 commit 982ba44

File tree

5 files changed

+43
-28
lines changed

5 files changed

+43
-28
lines changed

src/commands/CommandAttributes.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import { type ActivityAttributes } from "@microsoft/vscode-azext-utils";
7+
8+
export class CommandAttributes {
9+
10+
static readonly DeployContainerAppContainerRegistry: ActivityAttributes = {
11+
description: `Deploys an existing image from a container registry to a target Azure Container App.
12+
The container registry and image must already be available for pulling.
13+
Supports public images from any registry, and both public and private images from Azure Container Registry (ACR).
14+
For private image deployment from other third party registries, we support deployment through the 'vscode-containers' extension
15+
via the command titled "Container Registries: Deploy Image to Azure Container Apps...".`,
16+
troubleshooting: [
17+
`If a container app resource envelope is provided in attributes, do not confuse null secrets as missing container app secrets. This is because secrets are not typically
18+
copied over with the core resource metadata. Any issues with secrets will require inspecting the remote resource directly.`,
19+
]
20+
};
21+
22+
static readonly DeployWorkspaceProjectInternal: ActivityAttributes = {
23+
description: `Takes a workspace project with a Dockerfile and deploys it to an Azure Container App.
24+
Automatically creates any required resources (resource group, managed environment, container registry, container app, log analytics workspace).
25+
Supports single repo and monorepo, with deployment settings saved and reused via local VS Code settings (.vscode/settings.json).
26+
Deployment settings are saved under "containerApps.deploymentConfigurations".
27+
Deployment is agnostic to project runtime and language.`,
28+
troubleshooting: [
29+
`When ACR build errors are present, try to inspect the Dockerfile and ACR build logs.
30+
When an error is related to the Dockerfile, offer to make direct fixes for the user.`,
31+
`If a container app resource envelope is provided in attributes, do not confuse empty secrets as missing container app secrets. This is because secrets are not typically
32+
copied over with the core resource metadata. Any issues with secrets will require inspecting the remote resource directly.`,
33+
],
34+
};
35+
}

src/commands/deployContainerApp/deployContainerApp.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { getVerifyProvidersStep } from "../../utils/getVerifyProvidersStep";
1414
import { localize } from "../../utils/localize";
1515
import { pickContainerApp } from "../../utils/pickItem/pickContainerApp";
1616
import { OpenConfirmationViewStep } from "../../webviews/OpenConfirmationViewStep";
17+
import { CommandAttributes } from "../CommandAttributes";
1718
import { ContainerAppOverwriteConfirmStep } from "../ContainerAppOverwriteConfirmStep";
1819
import { deployWorkspaceProject } from "../deployWorkspaceProject/deployWorkspaceProject";
1920
import { editContainerCommandName } from "../editContainer/editContainer";
@@ -50,17 +51,7 @@ export async function deployContainerApp(context: IActionContext, node?: Contain
5051
containerApp: item.containerApp,
5152
managedEnvironment: await getManagedEnvironmentFromContainerApp(subscriptionActionContext, item.containerApp),
5253
imageSource,
53-
activityAttributes: {
54-
description: `Deploys an existing image from a container registry to a target Azure Container App.
55-
The container registry and image must already be available for pulling.
56-
Supports public images from any registry, and both public and private images from Azure Container Registry (ACR).
57-
For private image deployment from other third party registries, we support deployment through the 'vscode-containers' extension
58-
via the command titled "Container Registries: Deploy Image to Azure Container Apps...".`,
59-
troubleshooting: [
60-
`If a container app resource envelope is provided in attributes, do not confuse null secrets as missing container app secrets. This is because secrets are not typically
61-
copied over with the core resource metadata. Any issues with secrets will require inspecting the remote resource directly.`,
62-
]
63-
},
54+
activityAttributes: CommandAttributes.DeployContainerAppContainerRegistry,
6455
};
6556

6657
if (isAzdExtensionInstalled()) {

src/commands/deployWorkspaceProject/internal/deployWorkspaceProjectInternal.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { ext } from "../../../extensionVariables";
1212
import { createActivityContext, prependOrInsertAfterLastInfoChild } from "../../../utils/activityUtils";
1313
import { getVerifyProvidersStep } from "../../../utils/getVerifyProvidersStep";
1414
import { localize } from "../../../utils/localize";
15+
import { CommandAttributes } from "../../CommandAttributes";
1516
import { ContainerAppCreateStep } from "../../createContainerApp/ContainerAppCreateStep";
1617
import { LogAnalyticsCreateStep } from "../../createManagedEnvironment/LogAnalyticsCreateStep";
1718
import { ManagedEnvironmentCreateStep } from "../../createManagedEnvironment/ManagedEnvironmentCreateStep";
@@ -95,19 +96,7 @@ export async function deployWorkspaceProjectInternal(
9596
...context,
9697
...activityContext,
9798
...startingConfiguration,
98-
activityAttributes: {
99-
description: `Takes a workspace project with a Dockerfile and deploys it to an Azure Container App.
100-
Automatically creates any required resources (resource group, managed environment, container registry, container app, log analytics workspace).
101-
Supports single repo and monorepo, with deployment settings saved and reused via local VS Code settings (.vscode/settings.json).
102-
Deployment settings are saved under "containerApps.deploymentConfigurations".
103-
Deployment is agnostic to project runtime and language.`,
104-
troubleshooting: [
105-
`When ACR build errors are present, try to inspect the Dockerfile and ACR build logs.
106-
When an error is related to the Dockerfile, offer to make direct fixes for the user.`,
107-
`If a container app resource envelope is provided in attributes, do not confuse empty secrets as missing container app secrets. This is because secrets are not typically
108-
copied over with the core resource metadata. Any issues with secrets will require inspecting the remote resource directly.`,
109-
],
110-
},
99+
activityAttributes: CommandAttributes.DeployWorkspaceProjectInternal,
111100
};
112101

113102
const promptSteps: AzureWizardPromptStep<DeployWorkspaceProjectInternalContext>[] = [

src/commands/image/imageSource/ContainerAppStartVerificationStep.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export class ContainerAppStartVerificationStep<T extends ContainerAppStartVerifi
122122
break;
123123
}
124124

125-
await delayWithExponentialBackoff(attempt, 2000 /** baseDelayMs */, maxWaitTimeMs);
125+
await delayWithExponentialBackoff(attempt, 1000 /** baseDelayMs */, maxWaitTimeMs);
126126
attempt++;
127127

128128
revision = await this._client.containerAppsRevisions.getRevision(parsedRevision.resourceGroup, containerAppName, parsedRevision.resourceName);

src/utils/delay.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ export async function delay(ms: number): Promise<void> {
1212
*
1313
* @param attempt The current attempt number (starting from 1).
1414
* @param baseDelayMs The base delay in milliseconds.
15-
* @param maxElapsedMs The maximum elapsed delay in milliseconds.
15+
* @param maxElapsedLimitMs The maximum elapsed delay in milliseconds.
1616
*/
17-
export async function delayWithExponentialBackoff(attempt: number, baseDelayMs: number, maxElapsedMs: number): Promise<void> {
17+
export async function delayWithExponentialBackoff(attempt: number, baseDelayMs: number, maxElapsedLimitMs: number): Promise<void> {
1818
const elapsedTimeMs = baseDelayMs * (Math.pow(2, attempt - 1) - 1);
1919
const nextDelayTickMs = baseDelayMs * Math.pow(2, attempt - 1);
20-
const maxWaitAdjustedMs = maxElapsedMs - elapsedTimeMs;
20+
const maxWaitAdjustedMs = maxElapsedLimitMs - elapsedTimeMs;
2121

2222
if (maxWaitAdjustedMs <= 0) {
2323
return;

0 commit comments

Comments
 (0)