Skip to content

[ECS-Plugin] Implement ECS_ROLLBACK stage#6573

Open
armistcxy wants to merge 2 commits intopipe-cd:masterfrom
armistcxy:ecs-plugin/rollback
Open

[ECS-Plugin] Implement ECS_ROLLBACK stage#6573
armistcxy wants to merge 2 commits intopipe-cd:masterfrom
armistcxy:ecs-plugin/rollback

Conversation

@armistcxy
Copy link
Contributor

@armistcxy armistcxy commented Mar 9, 2026

What this PR does: Implementing Rollback stage

sequenceDiagram
    participant Plugin as ECSRollbackStage
    participant Provider as ECS Client
    participant ECS as AWS ECS

    Plugin->>Plugin: Read runningDeploymentSource

    alt First deployment (no commit hash)
        Plugin->>Plugin: Log error
        Plugin-->>Plugin: StageStatusFailure
    else Commit hash exists
        Plugin->>Plugin: Load AppConfig
        Plugin->>Provider: Create ECS client
    end

    Plugin->>Plugin: Load TaskDefinition

    alt Standalone task mode
        Plugin->>Plugin: Skip rollback (no ECS service)
        Plugin-->>Plugin: StageStatusSuccess
    else Service mode
        Plugin->>Plugin: Load ServiceDefinition
    end

    Plugin->>Provider: RegisterTaskDefinition
    Provider->>ECS: RegisterTaskDefinition
    ECS-->>Provider: TaskDefinition

    Plugin->>Provider: ApplyServiceDefinition
    Provider->>ECS: Create/Update Service
    ECS-->>Provider: Service

    Plugin->>Provider: GetServiceTaskSets
    Provider->>ECS: DescribeTaskSets
    ECS-->>Provider: Existing TaskSets

    Plugin->>Provider: CreateTaskSet (100% scale)
    Provider->>ECS: CreateTaskSet
    ECS-->>Provider: New TaskSet

    Plugin->>Provider: Promote TaskSet to PRIMARY
    Provider->>ECS: UpdateServicePrimaryTaskSet

    loop previous tasksets
        Plugin->>Provider: DeleteTaskSet
        Provider->>ECS: DeleteTaskSet
    end

    Plugin-->>Plugin: StageStatusSuccess
Loading

Wait until #6559 merged to rebase since this branch is inherited from ecs_sync branch

Why we need it: Rollback ECS to previous commit in case of failing to sync with newest commit

Which issue(s) this PR fixes: Part of #6443

This PR has not dealt with ELB Traffic Routing Rollback yet, this work will be performed later when additional PR when Implementing traffic shifting stage

Fixes #

Does this PR introduce a user-facing change?:

  • How are users affected by this change:
  • Is this breaking change:
  • How to migrate (if breaking change):

@codecov
Copy link

codecov bot commented Mar 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.37%. Comparing base (99fede9) to head (ab2f886).

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #6573       +/-   ##
===========================================
+ Coverage   28.86%   46.37%   +17.51%     
===========================================
  Files         560       67      -493     
  Lines       59971     6866    -53105     
===========================================
- Hits        17309     3184    -14125     
+ Misses      41339     3433    -37906     
+ Partials     1323      249     -1074     
Flag Coverage Δ
. ?
.-pkg-app-pipedv1-plugin-analysis 32.43% <ø> (ø)
.-pkg-app-pipedv1-plugin-kubernetes 58.67% <ø> (ø)
.-pkg-app-pipedv1-plugin-kubernetes_multicluster ?
.-pkg-app-pipedv1-plugin-scriptrun ?
.-pkg-app-pipedv1-plugin-terraform ?
.-pkg-app-pipedv1-plugin-wait ?
.-pkg-app-pipedv1-plugin-waitapproval ?
.-pkg-plugin-sdk ?
.-tool-actions-gh-release 19.23% <ø> (ø)
.-tool-actions-plan-preview ?
.-tool-codegen-protoc-gen-auth ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: Hoang Ngo <adlehoang118@gmail.com>
Signed-off-by: Hoang Ngo <adlehoang118@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant