fix: use min requested index for ecs rollback stage - #7222
Conversation
Signed-off-by: armistcxy <adlehoang118@gmail.com>
✅ Deploy Preview for pipecd-site canceled.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7222 +/- ##
==========================================
+ Coverage 29.68% 29.74% +0.05%
==========================================
Files 601 601
Lines 64396 64408 +12
==========================================
+ Hits 19116 19158 +42
+ Misses 43789 43758 -31
- Partials 1491 1492 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Warashi
left a comment
There was a problem hiding this comment.
We need this logic in all of the deployment plugins, so it's good to port it to the SDK?
There was a problem hiding this comment.
Pull request overview
This PR fixes the ECS pipedv1 plugin’s buildPipelineStages to ensure the appended ECS_ROLLBACK stage uses a request-provided stage index (specifically the minimum requested index), satisfying piped’s validateStageIndexes contract and preventing plugin responses from being rejected.
Changes:
- Update ECS pipeline stage builder to assign the rollback stage the minimum requested stage index (instead of an invented index).
- Add unit tests for ECS pipeline stage building, rollback index contract, and quick-sync stage building.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/app/pipedv1/plugin/ecs/deployment/pipeline.go | Reuses the minimum requested index for ECS_ROLLBACK to satisfy piped’s stage-index validation. |
| pkg/app/pipedv1/plugin/ecs/deployment/pipeline_test.go | Adds unit tests for pipeline/quick-sync builders and a contract check ensuring returned indexes exist in the request. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| } | ||
| } | ||
|
|
||
| // replica of piped's controller.validateStageIndexes (unexported there), kept in sync manually. |
Signed-off-by: armistcxy <adlehoang118@gmail.com>
Signed-off-by: armistcxy <adlehoang118@gmail.com>
14f021d to
74705e8
Compare
Signed-off-by: armistcxy <adlehoang118@gmail.com>
ab89331 to
3f56b54
Compare
At this point I don't have my answer yet, but I think this part is actually repetitive among plugins. So let me investigate first |
Warashi
left a comment
There was a problem hiding this comment.
We can open another PR to make this part of the SDK, so I approve this as-is.
What this PR does:
buildPipelineStagesin ECS plugin to reuse the smallest requested index for the appended rollback stageWhy we need it:
sdk.PipelineStage.Indexrequires each returned index to be one of the indexes from the request. The previous implementation returned an invented index forECS_ROLLBACK, so piped'svalidateStageIndexesrejected the plugin response