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

chore(merge-back): 2.51.1 #22986

Merged
merged 6 commits into from
Nov 19, 2022
Merged
Show file tree
Hide file tree
Changes from 5 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
4 changes: 3 additions & 1 deletion CHANGELOG.v2.alpha.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [2.51.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.51.0-alpha.0...v2.51.1-alpha.0) (2022-11-18)

## [2.51.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.50.0-alpha.0...v2.51.0-alpha.0) (2022-11-18)


Expand All @@ -28,7 +30,7 @@ All notable changes to this project will be documented in this file. See [standa

* **synthetics:** aws synthetics runtime version syn-nodejs-puppeteer-3.8 ([#22707](https://github.com/aws/aws-cdk/issues/22707)) ([228c865](https://github.com/aws/aws-cdk/commit/228c86532118b143e365b2268d06ee3a36fcf3a7))

## [2.49.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.49.0-alpha.0...v2.49.1-alpha.0) (2022-10-31)
## [2.49.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.49.0-alpha.0...v2.49.1-alpha.0) (2022-10-31)

## [2.49.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.48.0-alpha.0...v2.49.0-alpha.0) (2022-10-27)

Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [2.51.1](https://github.com/aws/aws-cdk/compare/v2.51.0...v2.51.1) (2022-11-18)


### Bug Fixes

* ECS service replacement regression ([#22978](https://github.com/aws/aws-cdk/issues/22978)) ([680e048](https://github.com/aws/aws-cdk/commit/680e048abc0c1e778b64c4e29fefcff0704f4d30)), closes [#22467](https://github.com/aws/aws-cdk/issues/22467)

## [2.51.0](https://github.com/aws/aws-cdk/compare/v2.50.0...v2.51.0) (2022-11-18)


Expand Down
13 changes: 10 additions & 3 deletions packages/@aws-cdk/aws-ecs/lib/base/base-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,16 @@ export abstract class BaseService extends Resource
const disableCircuitBreakerEcsDeploymentControllerFeatureFlag =
FeatureFlags.of(this).isEnabled(cxapi.ECS_DISABLE_EXPLICIT_DEPLOYMENT_CONTROLLER_FOR_CIRCUIT_BREAKER);

return disableCircuitBreakerEcsDeploymentControllerFeatureFlag ? undefined : {
type: DeploymentControllerType.ECS,
};
if (!disableCircuitBreakerEcsDeploymentControllerFeatureFlag && props.circuitBreaker) {
// This is undesirable behavior (the controller is implicitly ECS anyway when left
// undefined, so specifying it is not necessary but DOES trigger a CFN replacement)
// but we leave it in for backwards compat.
return {
type: DeploymentControllerType.ECS,
};
}

return undefined;
}

private executeCommandLogConfiguration() {
Expand Down
50 changes: 45 additions & 5 deletions packages/@aws-cdk/aws-ecs/test/base-service.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { Template, Match } from '@aws-cdk/assertions';
import * as ec2 from '@aws-cdk/aws-ec2';
import * as cdk from '@aws-cdk/core';
import { App, Stack } from '@aws-cdk/core';
import * as ecs from '../lib';

let stack: cdk.Stack;
describe('When import an ECS Service', () => {
let stack: cdk.Stack;

beforeEach(() => {
stack = new cdk.Stack();
});
beforeEach(() => {
stack = new cdk.Stack();
});

describe('When import an ECS Service', () => {
test('with serviceArnWithCluster', () => {
// GIVEN
const clusterName = 'cluster-name';
Expand Down Expand Up @@ -42,3 +45,40 @@ describe('When import an ECS Service', () => {
}).toThrowError(/is not using the ARN cluster format/);
});
});

test.each([
/* breaker, flag => controller in template */
/* Flag off => value present if circuitbreaker */
[false, false, false],
[true, false, true],
/* Flag on => value never present */
[false, true, false],
[true, true, false],
])('circuitbreaker is %p /\\ flag is %p => DeploymentController in output: %p', (circuitBreaker, flagValue, controllerInTemplate) => {
// GIVEN
const app = new App({
context: {
'@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker': flagValue,
},
});
const stack = new Stack(app, 'Stack');
const vpc = new ec2.Vpc(stack, 'Vpc');
const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc });
const taskDefinition = new ecs.FargateTaskDefinition(stack, 'FargateTaskDef');
taskDefinition.addContainer('web', {
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
});

// WHEN
new ecs.FargateService(stack, 'FargateService', {
cluster,
taskDefinition,
circuitBreaker: circuitBreaker ? { } : undefined,
});

// THEN
const template = Template.fromStack(stack);
template.hasResourceProperties('AWS::ECS::Service', {
DeploymentController: controllerInTemplate ? { Type: 'ECS' } : Match.absent(),
});
});
4 changes: 2 additions & 2 deletions version.v2.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "2.51.0",
"alphaVersion": "2.51.0-alpha.0"
"version": "2.51.1",
"alphaVersion": "2.51.1-alpha.0"
}