Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: remove check-plan for rollout command (#17800)

p0ny1abb4bddbe3e
diff --git a/action/README.md b/action/README.md
index ff0ccaa1e7..535d3753d7 100644
--- a/action/README.md
+++ b/action/README.md
@@ -105,13 +105,6 @@ These flags are specific to the `rollout` subcommand (`bytebase-action rollout`)
- **`--release-title`**: The title of the release created in Bytebase.
- Default: The current timestamp in RFC3339 format (e.g., `2025-04-25T17:32:07+08:00`).
-- **`--check-plan`**: Determines whether to run plan checks and how to handle failures.
- - Valid values:
- - `SKIP`: Do not run plan checks.
- - `FAIL_ON_WARNING`: Run plan checks and fail if there are warnings or errors.
- - `FAIL_ON_ERROR`: Run plan checks and fail only if there are errors.
- - Default: `SKIP`
-
- **`--target-stage`**: The target stage up to which the rollout should proceed. If not specified, the rollout will be created but will not wait for completion.
- Format: `environments/{environment}`
- Example: `environments/prod`
diff --git a/action/command/rollout.go b/action/command/rollout.go
index cd76350ffe..a0c31197f1 100644
--- a/action/command/rollout.go
+++ b/action/command/rollout.go
@@ -29,7 +29,6 @@ func NewRolloutCommand(w *world.World) *cobra.Command {
RunE: runRollout(w),
}
cmdRollout.Flags().StringVar(&w.ReleaseTitle, "release-title", "", "The title of the release. Generated from project and current timestamp if not provided.")
- cmdRollout.Flags().StringVar(&w.CheckPlan, "check-plan", "SKIP", "Whether to check the plan and fail on warning/error. Valid values: SKIP, FAIL_ON_WARNING, FAIL_ON_ERROR")
cmdRollout.Flags().StringVar(&w.TargetStage, "target-stage", "", "Rollout up to the target stage. Format: environments/{environment}.")
cmdRollout.Flags().StringVar(&w.Plan, "plan", "", "The plan to rollout. Format: projects/{project}/plans/{plan}. Shadows file-pattern and targets.")
return cmdRollout
@@ -44,11 +43,6 @@ func rolloutPreRun(w *world.World) func(*cobra.Command, []string) error {
}
}
}
- switch w.CheckPlan {
- case "SKIP", "FAIL_ON_WARNING", "FAIL_ON_ERROR":
- default:
- return errors.Errorf("invalid check-plan value: %s. Valid values: SKIP, FAIL_ON_WARNING, FAIL_ON_ERROR", w.CheckPlan)
- }
if w.ReleaseTitle == "" {
w.ReleaseTitle = fmt.Sprintf("[%s] %s", strings.TrimPrefix(w.Project, "projects/"), time.Now().UTC().Format(time.RFC3339))
}
@@ -130,10 +124,6 @@ func runRollout(w *world.World) func(command *cobra.Command, _ []string) error {
}
w.OutputMap.Plan = plan.Name
- if err := runAndWaitForPlanChecks(ctx, w, client, plan.Name); err != nil {
- return errors.Wrapf(err, "failed to run and wait for plan checks")
- }
-
if err := runAndWaitForRollout(ctx, w, client, plan.Name); err != nil {
return errors.Wrapf(err, "failed to run and wait for rollout")
}
@@ -141,75 +131,6 @@ func runRollout(w *world.World) func(command *cobra.Command, _ []string) error {
return nil
}
}
-func runAndWaitForPlanChecks(ctx context.Context, w *world.World, client *Client, planName string) error {
- if w.CheckPlan == "SKIP" {
- return nil
- }
- for {
- if ctx.Err() != nil {
- return errors.Wrapf(ctx.Err(), "context cancelled")
- }
-
- runs, err := client.ListAllPlanCheckRuns(ctx, planName)
- if err != nil {
- return errors.Wrapf(err, "failed to list plan checks")
- }
- if len(runs.PlanCheckRuns) == 0 {
- w.Logger.Info("running plan checks")
- _, err := client.RunPlanChecks(ctx, &v1pb.RunPlanChecksRequest{
- Name: planName,
- })
- if err != nil {
- return errors.Wrapf(err, "failed to run plan checks")
- }
- continue
- }
- var failedCount, canceledCount, runningCount int
- var errorCount, warningCount int
- for _, run := range runs.PlanCheckRuns {
- switch run.Status {
- case v1pb.PlanCheckRun_FAILED:
- failedCount++
- case v1pb.PlanCheckRun_CANCELED:
- canceledCount++
- case v1pb.PlanCheckRun_RUNNING:
- runningCount++
- case v1pb.PlanCheckRun_DONE:
- for _, result := range run.Results {
- switch result.Status {
- case v1pb.Advice_ERROR:
- errorCount++
- case v1pb.Advice_WARNING:
- warningCount++
- default:
- // Other result statuses don't affect counts
- }
- }
- default:
- // Other run statuses don't affect counts
- }
- }
- if failedCount > 0 {
- return errors.Errorf("found failed plan checks. view on Bytebase")
- }
- if canceledCount > 0 {
- return errors.Errorf("found canceled plan checks. view on Bytebase")
- }
- if errorCount > 0 {
- return errors.Errorf("found error plan checks. view on Bytebase")
- }
- if warningCount > 0 && w.CheckPlan == "FAIL_ON_WARNING" {
- return errors.Errorf("found warning plan checks. view on Bytebase")
- }
- if runningCount == 0 {
- break
- }
- w.Logger.Info("waiting for plan checks to complete", "runningCount", runningCount)
- time.Sleep(5 * time.Second)
- }
-
- return nil
-}
func runAndWaitForRollout(ctx context.Context, w *world.World, client *Client, planName string) error {
// preview rollout with all pending stages
diff --git a/action/world/world.go b/action/world/world.go
index 70552cdabb..8472a72c70 100644
--- a/action/world/world.go
+++ b/action/world/world.go
@@ -37,12 +37,6 @@ type World struct {
// bytebase-action rollout flags
ReleaseTitle string // The title of the release
- // An enum to determine should we run plan checks and fail on warning or error.
- // Valid values:
- // - SKIP
- // - FAIL_ON_WARNING
- // - FAIL_ON_ERROR
- CheckPlan string
// Rollout up to the target-stage.
// Format: environments/{environment}
TargetStage string