Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PipelineStage.Rollback and mark PipelineStage.Visible as deprecated #5232

Merged
merged 2 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions pkg/app/pipedv1/controller/planner.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,15 +408,20 @@ func (p *planner) buildQuickSyncStages(ctx context.Context, cfg *config.GenericA
if err != nil {
return nil, fmt.Errorf("failed to build quick sync stage deployment (%w)", err)
}
// TODO: Ensure responsed stages indexies is valid.
for i := range res.Stages {
// TODO: Consider add Stage.Rollback to specify a stage is a rollback stage or forward stage instead.
if res.Stages[i].Visible {
stages = append(stages, res.Stages[i])
} else {
if res.Stages[i].Rollback {
rollbackStages = append(rollbackStages, res.Stages[i])
} else {
stages = append(stages, res.Stages[i])
}
}
}

// Sort stages by index.
sort.Sort(model.PipelineStages(stages))
sort.Sort(model.PipelineStages(rollbackStages))

stages = append(stages, rollbackStages...)
if len(stages) == 0 {
return nil, fmt.Errorf("unable to build quick sync stages for deployment")
Expand Down Expand Up @@ -468,11 +473,12 @@ func (p *planner) buildPipelineSyncStages(ctx context.Context, cfg *config.Gener
if err != nil {
return nil, fmt.Errorf("failed to build pipeline sync stages for deployment (%w)", err)
}
// TODO: Ensure responsed stages indexies is valid.
for i := range res.Stages {
if res.Stages[i].Visible {
stages = append(stages, res.Stages[i])
} else {
if res.Stages[i].Rollback {
rollbackStages = append(rollbackStages, res.Stages[i])
} else {
stages = append(stages, res.Stages[i])
}
}
}
Expand Down
Loading
Loading