Skip to content

Commit

Permalink
Add PipelineStage.Rollback and mark PipelineStage.Visible as deprecat…
Browse files Browse the repository at this point in the history
…ed (#5232)

* Add PipelineStage.Rollback and marke PipelineStage.Visible as deprecated

Signed-off-by: khanhtc1202 <[email protected]>

* Fix flaky tests and update TODO

Signed-off-by: khanhtc1202 <[email protected]>

---------

Signed-off-by: khanhtc1202 <[email protected]>
  • Loading branch information
khanhtc1202 authored Sep 27, 2024
1 parent 5f05a58 commit 4d53574
Show file tree
Hide file tree
Showing 8 changed files with 183 additions and 152 deletions.
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

0 comments on commit 4d53574

Please sign in to comment.