Skip to content

Conversation

pahud
Copy link
Contributor

@pahud pahud commented Aug 6, 2025

Issue # (if applicable)

Reason for this change

This PR reverts the revert commit 86caea16c4 ("Revert "revert(ecs): add support for native blue/green deployments in ECS L2 (#35061) (#35170)") without changing the git history and mitigate the JSII compatibility issues with minimal changes.

The original PR #35061 added support for native blue/green deployments in ECS L2 but was reverted due to JSII compatibility issues reported in #35167. The issue was that adding an optional alternateTarget parameter to the attachToELBv2 method caused JSII breaking changes, as JSII treats any method signature change as breaking because it affects generated bindings in other languages (Python, Java, C#, Go).

Description of changes

This PR restores the blue/green deployment functionality from PR #35061 with minimal changes to address the reviewer feedback:

  1. Simplified approach - Since attachToELBv2 is a private method, JSII doesn't process it for cross-language bindings, so adding an optional parameter is safe
  2. Restored original implementation - Added the optional alternateTarget parameter back to the private attachToELBv2 method
  3. Removed unnecessary complexity - Eliminated the separate attachToELBv2WithAlternateTarget method that was created due to overcautiousness about JSII compatibility
  4. Fixed unused variable - Removed the unused resources variable in alternate-target-configuration.ts (leftover from previous PR)
  5. Added regression tests - Ensured services without alternate targets continue to work correctly

Key changes:

  • attachToELBv2(targetGroup, containerName, containerPort, alternateTarget?) - restored to original approach with optional parameter (safe for private methods)
  • Simplified loadBalancerTarget method - directly calls attachToELBv2 with the optional parameter
  • Cleaned up unused code from previous implementation

Describe any new or updated permissions being added

No new permissions are being added. This change restores the original functionality with a simplified implementation based on reviewer feedback.

Description of how you validated changes

  1. Unit tests: All existing tests continue to pass (355/355 ECS service tests passed)
  2. Regression tests: Added specific tests to ensure services without alternate targets work correctly for both ALB and NLB scenarios
  3. Alternate target tests: All 6 alternate target configuration tests pass
  4. JSII compatibility: Private method signature changes are safe since JSII doesn't process private methods for cross-language bindings

Test results:

  • alternate-target-configuration.test.ts: 6/6 tests passed
  • base-service.test.ts: 25/25 tests passed
  • ✅ ECS service tests: 355/355 tests passed

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 labels Aug 6, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team August 6, 2025 20:26
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Aug 6, 2025
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 751aa22
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@pahud pahud force-pushed the fix-35010-pr35061-alignment branch from 7393b3c to 4ea208b Compare August 7, 2025 22:34
@pahud pahud marked this pull request as ready for review August 7, 2025 22:59
@pahud
Copy link
Contributor Author

pahud commented Aug 7, 2025

Hi @aemada-aws

Thank you for the review. I just restored everything from #35061 and made minimal necessary changes to avoid potential regression. Let me know if there's any concerns.

pahud added 2 commits August 8, 2025 07:45
…ments

- Restore optional alternateTarget parameter to private attachToELBv2 method
- Remove unnecessary attachToELBv2WithAlternateTarget method (overcautious JSII workaround)
- Clean up unused resources variable in alternate-target-configuration.ts
- Simplify loadBalancerTarget method to directly call attachToELBv2

Since attachToELBv2 is private, JSII doesn't process it for cross-language bindings,
making the optional parameter addition safe without breaking changes.

Addresses reviewer feedback from PR aws#35179.
Copy link
Contributor

mergify bot commented Aug 8, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aemada-aws aemada-aws added the pr/do-not-merge This PR should not be merged at this time. label Aug 8, 2025
@aemada-aws aemada-aws changed the title feat(ecs): add blue/green deployment support with AWS compliance fixes feat(ecs): add L2 support for blue/green deployments Aug 8, 2025
@aemada-aws aemada-aws removed the pr/do-not-merge This PR should not be merged at this time. label Aug 8, 2025
@aemada-aws aemada-aws changed the title feat(ecs): add L2 support for blue/green deployments feat(ecs): add L2 support for native ECS blue/green deployments Aug 8, 2025
Copy link
Contributor

mergify bot commented Aug 8, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aemada-aws
Copy link
Contributor

@Mergifyio refresh

Copy link
Contributor

mergify bot commented Aug 8, 2025

refresh

✅ Pull request refreshed

@aemada-aws
Copy link
Contributor

https://github.com/Mergifyio update

Copy link
Contributor

mergify bot commented Aug 8, 2025

update

✅ Branch has been successfully updated

Copy link
Contributor

mergify bot commented Aug 8, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aemada-aws aemada-aws merged commit 4d2f463 into aws:main Aug 8, 2025
19 checks passed
Copy link
Contributor

github-actions bot commented Aug 8, 2025

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
contribution/core This is a PR that came from AWS. effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants