Skip to content

[FEAT] CodeDeploy: ECS blue/green test listener and AfterAllowTestTraffic hook #8781

Open

Description

@jonathanmorley

Service

CodeDeploy (ECS compute platform) and ELBv2

API Action / Feature

ECS blue/green deployments with a test listener: loadBalancerInfo.targetGroupPairInfoList[].testTrafficRoute.listenerArns, and the AfterAllowTestTraffic lifecycle hook.

AWS Documentation

Why is this needed?

On AWS, an ECS blue/green deployment runs these hooks:

BeforeInstall → AfterInstall → AfterAllowTestTraffic → BeforeAllowTraffic → AfterAllowTraffic

Before AfterAllowTestTraffic, CodeDeploy points the test listener at the green target group. Teams run their test suites from that hook, against the test listener, before any production traffic moves. AWS CDK blue/green setups (EcsDeploymentGroup with testListener) work this way.

Floci runs only BeforeInstall, AfterInstall, BeforeAllowTraffic and AfterAllowTraffic (per https://floci.io/floci/services/codedeploy/). It does not route the test listener to green and never invokes the AfterAllowTestTraffic Lambda. So those test suites never run, and the deployment succeeds without them.

Asks:

  1. When the deployment group has a testTrafficRoute, point its listeners' default forward action at the green target group after install.
  2. Invoke the AfterAllowTestTraffic hook Lambda at that point, in the AWS order, and fail or roll back the deployment on a Failed status, as for the other hooks.

Minimal reproduction:

# Deployment group with prod listener $PROD_L and test listener $TEST_L
aws deploy create-deployment-group ... \
  --load-balancer-info "targetGroupPairInfoList=[{targetGroups=[{name=blue},{name=green}],prodTrafficRoute={listenerArns=[$PROD_L]},testTrafficRoute={listenerArns=[$TEST_L]}}]"

# AppSpec with all five hooks, each a Lambda that logs its name
#   and calls PutLifecycleEventHookExecutionStatus Succeeded
aws deploy create-deployment --application-name app --deployment-group-name dg --revision ...

# Expected: AfterAllowTestTraffic runs after AfterInstall, while $TEST_L forwards to green
# Actual:   AfterAllowTestTraffic never runs; $TEST_L is not changed

Environment: Floci nightly of November 16, 2026, Docker.

Related: #677 added the ALB proxy and CodeDeploy ECS flow; #8464 fixed the initial task set.

Are you willing to contribute a PR?

  • Yes
  • No

Activity

  1. added
    ecsAmazon Elastic Container Service (ECS)
    enhancementNew feature or request
    on Nov 18, 2026
  2. AndreKurait commented on Nov 19, 2026

    @AndreKurait
    Contributor

    Fix staged in AndreKurait#1235 (main) and AndreKurait#1236 (dev). Configured test listeners now forward to green before AfterAllowTestTraffic; a failed route, failed hook or stop prevents production shifting.

    Three regression assertions fail on prior main. Validation passes: 99 main tests (including 17 schema checks), 86 dev tests, package, full Checkstyle and static gates. Each includes three Java SDK cases through the CodeDeploy HTTP API, with ECS/ELB/Lambda collaborators mocked. No live AWS, packet-level or native claim.

    Both PRs remain staged; the released dev image is unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    codedeployAWS CodeDeployecsAmazon Elastic Container Service (ECS)enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions