pipe-cd / pipecd

The One CD for All {applications, platforms, operations}
https://pipecd.dev
Apache License 2.0
1.08k stars 151 forks source link

Introduce script run stage #4643

Open ffjlabo opened 11 months ago

ffjlabo commented 11 months ago

What would you like to be added: follow: https://github.com/pipe-cd/pipecd/issues/1089

implement stage to execute any command.

Why is this needed:

ffjlabo commented 10 months ago

TODO

ffjlabo commented 10 months ago

📝

ffjlabo commented 10 months ago

refer the implementation https://github.com/pipe-cd/pipecd/blob/master/pkg/app/piped/executor/customsync/customsync.go#L55

ffjlabo commented 9 months ago

📝 Share my current opinion when to rollback :)

Behavior during rollback of SCRIPT_RUN

For example, consider when deployment proceeds in the following order from 1 to 7.

1. K8S_CANARY_ROLLOUT
2. WAIT
3. SCRIPT_RUN
4. K8S_PRIMARY_ROLLOUT
5. SCRIPT_RUN
6. K8S_CANARY_CLEAN
7. SCRIPT_RUN

Then


How to realize it

We can choose 2 ways to realize the rollback.

  1. execute command on ROLLBACK stage
  2. execute command on another stage e.g. ROLLBACK_SCRIPTRUN
khanhtc1202 commented 9 months ago

@ffjlabo I want to vote for (2) We're going to have a plugin for each platform, in such case, each platform ROLLBACK stage implementation would be run/implemented by the plugin author. At the time the plugin is implemented, there would be no way for them to notice that the ROLLBACK stage has to be called the ROLLBACK_SCRIPTRUN. For simplicity, ROLLBACK stage for the platform should only focus on ROLLBACK for platform, ROLLBACK_SCRIPTRUN should be implemented by SCRIPTRUN executor.

khanhtc1202 commented 9 months ago

Another way to think is, if we treat this SCRIPT_RUN as a plugin for piped, then it should provide its ROLLBACK, not rely on other stages/platform ROLLBACK.

ffjlabo commented 9 months ago

Thank you for your opinion :) I got it! I will try it 👍 At first I will consider how to execute the rollback for each stage because currently, the rollback is for each application kind.

ffjlabo commented 8 months ago

Currently, k8s only. I will apply it to other kind of apps.

ffjlabo commented 8 months ago

📝 It might be nice to have the option to ignore the failure on the stage.

ffjlabo commented 6 months ago

for ECS app request: https://github.com/pipe-cd/pipecd/issues/4813

khanhtc1202 commented 6 months ago

Related issue: https://github.com/pipe-cd/pipecd/issues/4814 Context: Users want to use deployment information in script which be run in SCRIPT_RUN stage execution