From 12d63fcc8cba9fc2f6781e4d2210814da7090999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Mattrat?= Date: Thu, 4 Dec 2025 10:13:13 +0100 Subject: [PATCH 1/5] fix: correct data types for hotswap ECS CLI flags Change hotswap-ecs-minimum-healthy-percent, hotswap-ecs-maximum-healthy-percent, and hotswap-ecs-stabilization-timeout-seconds from string to expected type number type. --- packages/aws-cdk/lib/cli/cli-config.ts | 6 +++--- packages/aws-cdk/lib/cli/cli-type-registry.json | 6 +++--- .../aws-cdk/lib/cli/parse-command-line-arguments.ts | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/aws-cdk/lib/cli/cli-config.ts b/packages/aws-cdk/lib/cli/cli-config.ts index 162b6eca5..6a0b33d27 100644 --- a/packages/aws-cdk/lib/cli/cli-config.ts +++ b/packages/aws-cdk/lib/cli/cli-config.ts @@ -311,15 +311,15 @@ export async function makeConfig(): Promise { 'and falls back to a full deployment if that is not possible.', }, 'hotswap-ecs-minimum-healthy-percent': { - type: 'string', + type: 'number', desc: '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', }, 'hotswap-ecs-maximum-healthy-percent': { - type: 'string', + type: 'number', desc: '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', }, 'hotswap-ecs-stabilization-timeout-seconds': { - type: 'string', + type: 'number', desc: 'Number of seconds to wait for a single service to reach stable state, where the desiredCount is equal to the runningCount', }, 'logs': { diff --git a/packages/aws-cdk/lib/cli/cli-type-registry.json b/packages/aws-cdk/lib/cli/cli-type-registry.json index db494fc7e..d6d787308 100644 --- a/packages/aws-cdk/lib/cli/cli-type-registry.json +++ b/packages/aws-cdk/lib/cli/cli-type-registry.json @@ -518,15 +518,15 @@ "desc": "Attempts to perform a 'hotswap' deployment, which skips CloudFormation and updates the resources directly, and falls back to a full deployment if that is not possible. Do not use this in production environments" }, "hotswap-ecs-minimum-healthy-percent": { - "type": "string", + "type": "number", "desc": "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" }, "hotswap-ecs-maximum-healthy-percent": { - "type": "string", + "type": "number", "desc": "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" }, "hotswap-ecs-stabilization-timeout-seconds": { - "type": "string", + "type": "number", "desc": "Number of seconds to wait for a single service to reach stable state, where the desiredCount is equal to the runningCount" }, "watch": { diff --git a/packages/aws-cdk/lib/cli/parse-command-line-arguments.ts b/packages/aws-cdk/lib/cli/parse-command-line-arguments.ts index 91c73b50f..c0d01a33e 100644 --- a/packages/aws-cdk/lib/cli/parse-command-line-arguments.ts +++ b/packages/aws-cdk/lib/cli/parse-command-line-arguments.ts @@ -550,17 +550,17 @@ export function parseCommandLineArguments(args: Array): any { }) .option('hotswap-ecs-minimum-healthy-percent', { default: undefined, - type: 'string', + type: 'number', desc: "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", }) .option('hotswap-ecs-maximum-healthy-percent', { default: undefined, - type: 'string', + type: 'number', desc: "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", }) .option('hotswap-ecs-stabilization-timeout-seconds', { default: undefined, - type: 'string', + type: 'number', desc: 'Number of seconds to wait for a single service to reach stable state, where the desiredCount is equal to the runningCount', }) .option('watch', { @@ -729,17 +729,17 @@ export function parseCommandLineArguments(args: Array): any { }) .option('hotswap-ecs-minimum-healthy-percent', { default: undefined, - type: 'string', + type: 'number', desc: "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", }) .option('hotswap-ecs-maximum-healthy-percent', { default: undefined, - type: 'string', + type: 'number', desc: "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", }) .option('hotswap-ecs-stabilization-timeout-seconds', { default: undefined, - type: 'string', + type: 'number', desc: 'Number of seconds to wait for a single service to reach stable state, where the desiredCount is equal to the runningCount', }) .option('logs', { From 13218adb6ea628122c1ac6fe033f10ed77b3dc18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Mattrat?= Date: Tue, 6 Jan 2026 15:34:39 +0100 Subject: [PATCH 2/5] fix: correct data types for hotswap ECS CLI flags --- packages/aws-cdk/lib/cli/cli-config.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/aws-cdk/lib/cli/cli-config.ts b/packages/aws-cdk/lib/cli/cli-config.ts index ba4b3ba1b..6d02257fc 100644 --- a/packages/aws-cdk/lib/cli/cli-config.ts +++ b/packages/aws-cdk/lib/cli/cli-config.ts @@ -183,15 +183,15 @@ export async function makeConfig(): Promise { 'Do not use this in production environments', }, 'hotswap-ecs-minimum-healthy-percent': { - type: 'string', + type: 'number', desc: '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', }, 'hotswap-ecs-maximum-healthy-percent': { - type: 'string', + type: 'number', desc: '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', }, 'hotswap-ecs-stabilization-timeout-seconds': { - type: 'string', + type: 'number', desc: 'Number of seconds to wait for a single service to reach stable state, where the desiredCount is equal to the runningCount', }, 'watch': { From c32ffa9063929a31845a87570bd83b3a20c80c51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Mattrat?= Date: Tue, 6 Jan 2026 18:41:50 +0100 Subject: [PATCH 3/5] fix: correct data types for hotswap ECS CLI flags --- .../cloud-assembly-schema/schema/version.json | 2 +- packages/aws-cdk/lib/cli/cli-type-registry.json | 6 +++--- .../aws-cdk/lib/cli/parse-command-line-arguments.ts | 2 +- packages/aws-cdk/lib/cli/user-input.ts | 12 ++++++------ 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/@aws-cdk/cloud-assembly-schema/schema/version.json b/packages/@aws-cdk/cloud-assembly-schema/schema/version.json index 989abb637..dd285a6ec 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/schema/version.json +++ b/packages/@aws-cdk/cloud-assembly-schema/schema/version.json @@ -1,5 +1,5 @@ { "schemaHash": "e20bc1d07ab1a891372f40a6d2d8a8eb8e12f828b2b5b90d86b270dcb881ad74", "$comment": "Do not hold back the version on additions: jsonschema validation of the manifest by the consumer will trigger errors on unexpected fields.", - "revision": 49 + "revision": 51 } \ No newline at end of file diff --git a/packages/aws-cdk/lib/cli/cli-type-registry.json b/packages/aws-cdk/lib/cli/cli-type-registry.json index 43a8af3e4..c69ea647d 100644 --- a/packages/aws-cdk/lib/cli/cli-type-registry.json +++ b/packages/aws-cdk/lib/cli/cli-type-registry.json @@ -696,15 +696,15 @@ "desc": "Attempts to perform a 'hotswap' deployment, which skips CloudFormation and updates the resources directly, and falls back to a full deployment if that is not possible." }, "hotswap-ecs-minimum-healthy-percent": { - "type": "string", + "type": "number", "desc": "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" }, "hotswap-ecs-maximum-healthy-percent": { - "type": "string", + "type": "number", "desc": "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" }, "hotswap-ecs-stabilization-timeout-seconds": { - "type": "string", + "type": "number", "desc": "Number of seconds to wait for a single service to reach stable state, where the desiredCount is equal to the runningCount" }, "logs": { diff --git a/packages/aws-cdk/lib/cli/parse-command-line-arguments.ts b/packages/aws-cdk/lib/cli/parse-command-line-arguments.ts index 51715d958..3103b3299 100644 --- a/packages/aws-cdk/lib/cli/parse-command-line-arguments.ts +++ b/packages/aws-cdk/lib/cli/parse-command-line-arguments.ts @@ -3,8 +3,8 @@ // Do not edit by hand; all changes will be overwritten at build time from the config file. // ------------------------------------------------------------------------------------------- /* eslint-disable @stylistic/max-len, @typescript-eslint/consistent-type-imports */ -import { Argv } from 'yargs'; import * as helpers from './util/yargs-helpers'; +import { Argv } from 'yargs'; // @ts-ignore TS6133 export function parseCommandLineArguments(args: Array): any { diff --git a/packages/aws-cdk/lib/cli/user-input.ts b/packages/aws-cdk/lib/cli/user-input.ts index 9d3f9cc11..aecdfcaf4 100644 --- a/packages/aws-cdk/lib/cli/user-input.ts +++ b/packages/aws-cdk/lib/cli/user-input.ts @@ -867,21 +867,21 @@ export interface DeployOptions { * * @default - undefined */ - readonly hotswapEcsMinimumHealthyPercent?: string; + readonly hotswapEcsMinimumHealthyPercent?: number; /** * 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 * * @default - undefined */ - readonly hotswapEcsMaximumHealthyPercent?: string; + readonly hotswapEcsMaximumHealthyPercent?: number; /** * Number of seconds to wait for a single service to reach stable state, where the desiredCount is equal to the runningCount * * @default - undefined */ - readonly hotswapEcsStabilizationTimeoutSeconds?: string; + readonly hotswapEcsStabilizationTimeoutSeconds?: number; /** * Continuously observe the project files, and deploy the given stack(s) automatically when changes are detected. Implies --hotswap by default @@ -1127,21 +1127,21 @@ export interface WatchOptions { * * @default - undefined */ - readonly hotswapEcsMinimumHealthyPercent?: string; + readonly hotswapEcsMinimumHealthyPercent?: number; /** * 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 * * @default - undefined */ - readonly hotswapEcsMaximumHealthyPercent?: string; + readonly hotswapEcsMaximumHealthyPercent?: number; /** * Number of seconds to wait for a single service to reach stable state, where the desiredCount is equal to the runningCount * * @default - undefined */ - readonly hotswapEcsStabilizationTimeoutSeconds?: string; + readonly hotswapEcsStabilizationTimeoutSeconds?: number; /** * Show CloudWatch log events from all resources in the selected Stacks in the terminal. 'true' by default, use --no-logs to turn off From adc01a31decfc12d15349174016fa31959c675d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Mattrat?= Date: Tue, 6 Jan 2026 18:44:59 +0100 Subject: [PATCH 4/5] fix: correct data types for hotswap ECS CLI flags --- packages/@aws-cdk/cloud-assembly-schema/schema/version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@aws-cdk/cloud-assembly-schema/schema/version.json b/packages/@aws-cdk/cloud-assembly-schema/schema/version.json index dd285a6ec..989abb637 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/schema/version.json +++ b/packages/@aws-cdk/cloud-assembly-schema/schema/version.json @@ -1,5 +1,5 @@ { "schemaHash": "e20bc1d07ab1a891372f40a6d2d8a8eb8e12f828b2b5b90d86b270dcb881ad74", "$comment": "Do not hold back the version on additions: jsonschema validation of the manifest by the consumer will trigger errors on unexpected fields.", - "revision": 51 + "revision": 49 } \ No newline at end of file From 931f913ddc2c9d12da7ca3053053357e88a01bdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Mattrat?= Date: Tue, 6 Jan 2026 18:51:57 +0100 Subject: [PATCH 5/5] chore: test hotswap flag parsing --- .../aws-cdk/test/cli/cli-arguments.test.ts | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/aws-cdk/test/cli/cli-arguments.test.ts b/packages/aws-cdk/test/cli/cli-arguments.test.ts index 3c3269361..839f2719a 100644 --- a/packages/aws-cdk/test/cli/cli-arguments.test.ts +++ b/packages/aws-cdk/test/cli/cli-arguments.test.ts @@ -95,6 +95,29 @@ describe('yargs', () => { globalOptions: expect.anything(), }); }); + + test('hotswap ECS arguments are correctly parsed', async () => { + const input = await parseCommandLineArguments([ + 'deploy', + '--hotswap', + '--hotswap-ecs-minimum-healthy-percent', '100', + '--hotswap-ecs-maximum-healthy-percent', '250', + '--hotswap-ecs-stabilization-timeout-seconds', '300', + ]); + + const result = convertYargsToUserInput(input); + + expect(result).toEqual({ + command: 'deploy', + deploy: expect.objectContaining({ + hotswap: true, + hotswapEcsMinimumHealthyPercent: 100, + hotswapEcsMaximumHealthyPercent: 250, + hotswapEcsStabilizationTimeoutSeconds: 300, + }), + globalOptions: expect.anything(), + }); + }); }); describe('config', () => {