Skip to content

Commit c96c4f0

Browse files
committed
fix(toolkit-lib): deploy options is missing importExistingResources and hotswapProperties.ecs.stabilizationTimeoutSeconds
1 parent d023211 commit c96c4f0

File tree

12 files changed

+39
-53
lines changed

12 files changed

+39
-53
lines changed

packages/@aws-cdk/toolkit-lib/lib/actions/deploy/index.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ export interface ChangeSetDeploymentMethod {
2828
* If not provided, a name will be generated automatically.
2929
*/
3030
readonly changeSetName?: string;
31+
32+
/**
33+
* Indicates if the change set imports resources that already exist.
34+
*
35+
* @default false
36+
*/
37+
readonly importExistingResources?: boolean;
3138
}
3239

3340
/**
@@ -154,13 +161,18 @@ export interface EcsHotswapProperties {
154161
* The lower limit on the number of your service's tasks that must remain
155162
* in the RUNNING state during a deployment, as a percentage of the desiredCount.
156163
*/
157-
readonly minimumHealthyPercent: number;
164+
readonly minimumHealthyPercent?: number;
158165

159166
/**
160167
* The upper limit on the number of your service's tasks that are allowed
161168
* in the RUNNING or PENDING state during a deployment, as a percentage of the desiredCount.
162169
*/
163-
readonly maximumHealthyPercent: number;
170+
readonly maximumHealthyPercent?: number;
171+
172+
/**
173+
* The number of seconds to wait for a single service to reach stable state.
174+
*/
175+
readonly stabilizationTimeoutSeconds?: number;
164176
}
165177

166178
/**
@@ -170,5 +182,5 @@ export interface HotswapProperties {
170182
/**
171183
* ECS specific hotswap property overrides
172184
*/
173-
readonly ecs: EcsHotswapProperties;
185+
readonly ecs?: EcsHotswapProperties;
174186
}

packages/@aws-cdk/toolkit-lib/lib/actions/deploy/private/helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export async function removePublishedAssetsFromWorkGraph(graph: WorkGraph, deplo
4141
*/
4242
export function createHotswapPropertyOverrides(hotswapProperties: HotswapProperties): HotswapPropertyOverrides {
4343
return new HotswapPropertyOverrides(new EcsHotswapProperties(
44-
hotswapProperties.ecs.minimumHealthyPercent,
45-
hotswapProperties.ecs.maximumHealthyPercent,
44+
hotswapProperties.ecs?.minimumHealthyPercent,
45+
hotswapProperties.ecs?.maximumHealthyPercent,
4646
));
4747
}

packages/@aws-cdk/toolkit-lib/lib/api/deployments/deploy-stack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ import {
2525
waitForStackDelete,
2626
} from './cfn-api';
2727
import { determineAllowCrossAccountAssetPublishing } from './checks';
28-
import type { ChangeSetDeploymentMethod, DeploymentMethod } from './deployment-method';
2928
import type { DeployStackResult, SuccessfulDeployStackResult } from './deployment-result';
29+
import type { ChangeSetDeploymentMethod, DeploymentMethod } from '../../actions/deploy';
3030
import { ToolkitError } from '../../toolkit/toolkit-error';
3131
import { formatErrorMessage } from '../../util';
3232
import type { SDK, SdkProvider, ICloudFormationClient } from '../aws-auth/private';

packages/@aws-cdk/toolkit-lib/lib/api/deployments/deployment-method.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.

packages/@aws-cdk/toolkit-lib/lib/api/deployments/deployments.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import {
1414
import { determineAllowCrossAccountAssetPublishing } from './checks';
1515

1616
import { deployStack, destroyStack } from './deploy-stack';
17-
import type { DeploymentMethod } from './deployment-method';
1817
import type { DeployStackResult } from './deployment-result';
18+
import type { DeploymentMethod } from '../../actions/deploy';
1919
import { ToolkitError } from '../../toolkit/toolkit-error';
2020
import { formatErrorMessage } from '../../util';
2121
import type { SdkProvider } from '../aws-auth/private';

packages/@aws-cdk/toolkit-lib/lib/api/deployments/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export * from './deployments';
22
export * from './deployment-result';
3-
export * from './deployment-method';
43

54
// testing exports
65
export * from './checks';

packages/@aws-cdk/toolkit-lib/lib/api/hotswap/common.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { PropertyDifference } from '@aws-cdk/cloudformation-diff';
2+
import type { HotswapProperties, EcsHotswapProperties as IEcsHotswapProperties } from '../../actions';
23
import type { HotswappableChange, NonHotswappableChange, ResourceChange } from '../../payloads/hotswap';
34
import { NonHotswappableReason } from '../../payloads/hotswap';
45
import { ToolkitError } from '../../toolkit/toolkit-error';
@@ -69,25 +70,26 @@ export enum HotswapMode {
6970
/**
7071
* Represents configuration property overrides for hotswap deployments
7172
*/
72-
export class HotswapPropertyOverrides {
73+
export class HotswapPropertyOverrides implements HotswapProperties {
7374
// Each supported resource type will have its own properties. Currently this is ECS
74-
ecsHotswapProperties?: EcsHotswapProperties;
75+
readonly ecs?: IEcsHotswapProperties;
7576

76-
public constructor (ecsHotswapProperties?: EcsHotswapProperties) {
77-
this.ecsHotswapProperties = ecsHotswapProperties;
77+
public constructor (ecs?: IEcsHotswapProperties) {
78+
this.ecs = ecs;
7879
}
7980
}
8081

8182
/**
8283
* Represents configuration properties for ECS hotswap deployments
8384
*/
84-
export class EcsHotswapProperties {
85+
export class EcsHotswapProperties implements IEcsHotswapProperties {
8586
// The lower limit on the number of your service's tasks that must remain in the RUNNING state during a deployment, as a percentage of the desiredCount
8687
readonly minimumHealthyPercent?: number;
8788
// The upper limit on the number of your service's tasks that are allowed in the RUNNING or PENDING state during a deployment, as a percentage of the desiredCount
8889
readonly maximumHealthyPercent?: number;
8990
// The number of seconds to wait for a single service to reach stable state.
9091
readonly stabilizationTimeoutSeconds?: number;
92+
readonly foo?: number;
9193

9294
public constructor (minimumHealthyPercent?: number, maximumHealthyPercent?: number, stabilizationTimeoutSeconds?: number) {
9395
if (minimumHealthyPercent !== undefined && minimumHealthyPercent < 0 ) {

packages/@aws-cdk/toolkit-lib/lib/api/hotswap/ecs-services.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export async function isHotswappableEcsServiceChange(
128128
const registerTaskDefResponse = await sdk.ecs().registerTaskDefinition(lowercasedTaskDef);
129129
const taskDefRevArn = registerTaskDefResponse.taskDefinition?.taskDefinitionArn;
130130

131-
let ecsHotswapProperties = hotswapPropertyOverrides.ecsHotswapProperties;
131+
let ecsHotswapProperties = hotswapPropertyOverrides.ecs;
132132
let minimumHealthyPercent = ecsHotswapProperties?.minimumHealthyPercent;
133133
let maximumHealthyPercent = ecsHotswapProperties?.maximumHealthyPercent;
134134
let stabilizationTimeoutSeconds = ecsHotswapProperties?.stabilizationTimeoutSeconds;

packages/@aws-cdk/toolkit-lib/lib/api/resource-import/importer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ import type { ResourceIdentifierSummary, ResourceToImport } from '@aws-sdk/clien
66
import * as chalk from 'chalk';
77
import * as fs from 'fs-extra';
88
import * as promptly from 'promptly';
9+
import type { DeploymentMethod } from '../../actions/deploy';
910
import { ToolkitError } from '../../toolkit/toolkit-error';
10-
import type { DeploymentMethod, Deployments } from '../deployments';
11+
import type { Deployments } from '../deployments';
1112
import { assertIsSuccessfulDeployStackResult } from '../deployments';
1213
import { IO, type IoHelper } from '../io/private';
1314
import type { Tag } from '../tags';

packages/@aws-cdk/toolkit-lib/test/actions/deploy.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ IAM Statement Changes
166166
// passed through correctly to Deployments
167167
expect(mockDeployStack).toHaveBeenCalledWith(expect.objectContaining({
168168
hotswapPropertyOverrides: {
169-
ecsHotswapProperties: {
169+
ecs: {
170170
maximumHealthyPercent: 100,
171171
minimumHealthyPercent: 0,
172172
},

0 commit comments

Comments
 (0)