Open ffjlabo opened 2 months ago
[root cause]
The error occurs when piped tries to store the stage log to the completed SCRIPT_RUN_ROLLBACK
stage.
piped identifies the target stage with stage ID to store the stage log.
The ID of the PredefinedStage is the const value.
So if there are multiple predefined stages, piped refers the completed one.
I tried to add suffix to the stageID for SCRIPTRUN_ROLLBACK stage like this. https://github.com/pipe-cd/pipecd/commit/7a475a687e9eed85cd105a542db4b663f8415f66
But it failed when rollback.
The error comes from finding the stage config with stageID on the executing stage. https://github.com/pipe-cd/pipecd/blob/7a475a687e9eed85cd105a542db4b663f8415f66/pkg/app/piped/controller/scheduler.go#L532-L547
Currently, the SCRIPT_RUN_ROLLBACK stage is a predefined stage, and it is assumed that there are multiple in the pipeline. But we should modify the spec to execute only one SCRIPT_RUN_ROLLBACK because of the reason below.
What happened:
If you perform a rollback with multiple Script Runs specified, the execution of the SCRIPT_RUN_ROLLBACK stage will fail.
What you expected to happen:
Successfully finish executing the SCRIPT_RUN_ROLLBACK stage.
How to reproduce it:
Execute the deployment with multiple SCRIPT_RUN stage, and cancel after some of them are in the executing.
Environment:
piped
version:control-plane
version: