Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): ecs hotswap fails on log configuration enabled #26876

Merged
merged 2 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/aws-cdk/lib/api/hotswap/ecs-services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@ export async function isHotswappableEcsServiceChange(
},
},
} as const;
const excludeFromTransformLowercased = transformObjectKeys(excludeFromTransform, lowerCaseFirstCharacter);
// We first uppercase the task definition to properly merge it with the one from CloudFormation template.
const upperCasedTaskDef = transformObjectKeys(target.taskDefinition, upperCaseFirstCharacter, excludeFromTransform);
const upperCasedTaskDef = transformObjectKeys(target.taskDefinition, upperCaseFirstCharacter, excludeFromTransformLowercased);
// merge evaluatable diff from CloudFormation template.
const updatedTaskDef = applyPropertyUpdates(changes.updates, upperCasedTaskDef);
// lowercase the merged task definition to use it in AWS SDK.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -812,13 +812,22 @@ describe.each([HotswapMode.FALL_BACK, HotswapMode.HOTSWAP_ONLY])('%p mode', (hot
});
});

test('should call registerTaskDefinition with certain properties not lowercased', async () => {
test('should call registerTaskDefinition with certain properties not lowercased nor uppercased', async () => {
// GIVEN
setupCurrentTaskDefinition({
taskDefinitionProperties: {
Family: 'my-task-def',
ContainerDefinitions: [
{ Image: 'image1' },
{
Image: 'image1',
DockerLabels: { Label1: 'label1' },
FirelensConfiguration: {
Options: { Name: 'cloudwatch' },
},
LogConfiguration: {
Options: { Option1: 'option1', option2: 'option2' },
},
},
],
Volumes: [
{
Expand Down Expand Up @@ -846,7 +855,7 @@ describe.each([HotswapMode.FALL_BACK, HotswapMode.HOTSWAP_ONLY])('%p mode', (hot
Options: { Name: 'cloudwatch' },
},
LogConfiguration: {
Options: { Option1: 'option1' },
Options: { Option1: 'option1', option2: 'option2' },
},
},
],
Expand Down Expand Up @@ -887,7 +896,7 @@ describe.each([HotswapMode.FALL_BACK, HotswapMode.HOTSWAP_ONLY])('%p mode', (hot
},
},
logConfiguration: {
options: { Option1: 'option1' },
options: { Option1: 'option1', option2: 'option2' },
},
},
],
Expand Down
Loading