diff --git a/pkg/app/pipedv1/controller/planner.go b/pkg/app/pipedv1/controller/planner.go index 6ed3dcef47..13efadba7a 100644 --- a/pkg/app/pipedv1/controller/planner.go +++ b/pkg/app/pipedv1/controller/planner.go @@ -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") @@ -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]) } } } diff --git a/pkg/app/pipedv1/controller/planner_test.go b/pkg/app/pipedv1/controller/planner_test.go index 1b87af3b6d..9f57817686 100644 --- a/pkg/app/pipedv1/controller/planner_test.go +++ b/pkg/app/pipedv1/controller/planner_test.go @@ -112,14 +112,13 @@ func TestBuildQuickSyncStages(t *testing.T) { &fakePlugin{ quickStages: []*model.PipelineStage{ { - Id: "plugin-1-stage-1", - Visible: true, + Id: "plugin-1-stage-1", }, }, rollbackStages: []*model.PipelineStage{ { - Id: "plugin-1-rollback", - Visible: false, + Id: "plugin-1-rollback", + Rollback: true, }, }, }, @@ -132,12 +131,11 @@ func TestBuildQuickSyncStages(t *testing.T) { wantErr: false, expectedStages: []*model.PipelineStage{ { - Id: "plugin-1-stage-1", - Visible: true, + Id: "plugin-1-stage-1", }, { - Id: "plugin-1-rollback", - Visible: false, + Id: "plugin-1-rollback", + Rollback: true, }, }, }, @@ -147,32 +145,30 @@ func TestBuildQuickSyncStages(t *testing.T) { &fakePlugin{ quickStages: []*model.PipelineStage{ { - Id: "plugin-1-stage-1", - Index: 1, - Visible: true, + Id: "plugin-1-stage-1", + Index: 0, }, }, rollbackStages: []*model.PipelineStage{ { - Id: "plugin-1-rollback", - Index: 1, - Visible: false, + Id: "plugin-1-rollback", + Index: 0, + Rollback: true, }, }, }, &fakePlugin{ quickStages: []*model.PipelineStage{ { - Id: "plugin-2-stage-1", - Index: 2, - Visible: true, + Id: "plugin-2-stage-1", + Index: 1, }, }, rollbackStages: []*model.PipelineStage{ { - Id: "plugin-2-rollback", - Index: 2, - Visible: false, + Id: "plugin-2-rollback", + Index: 1, + Rollback: true, }, }, }, @@ -185,24 +181,22 @@ func TestBuildQuickSyncStages(t *testing.T) { wantErr: false, expectedStages: []*model.PipelineStage{ { - Id: "plugin-1-stage-1", - Index: 1, - Visible: true, + Id: "plugin-1-stage-1", + Index: 0, }, { - Id: "plugin-2-stage-1", - Index: 2, - Visible: true, + Id: "plugin-2-stage-1", + Index: 1, }, { - Id: "plugin-1-rollback", - Index: 1, - Visible: false, + Id: "plugin-1-rollback", + Index: 0, + Rollback: true, }, { - Id: "plugin-2-rollback", - Index: 2, - Visible: false, + Id: "plugin-2-rollback", + Index: 1, + Rollback: true, }, }, }, @@ -212,28 +206,28 @@ func TestBuildQuickSyncStages(t *testing.T) { &fakePlugin{ quickStages: []*model.PipelineStage{ { - Id: "plugin-1-stage-1", - Visible: true, + Id: "plugin-1-stage-1", + Index: 0, }, }, rollbackStages: []*model.PipelineStage{ { - Id: "plugin-1-rollback", - Visible: false, + Id: "plugin-1-rollback", + Rollback: true, }, }, }, &fakePlugin{ quickStages: []*model.PipelineStage{ { - Id: "plugin-2-stage-1", - Visible: true, + Id: "plugin-2-stage-1", + Index: 1, }, }, rollbackStages: []*model.PipelineStage{ { - Id: "plugin-2-rollback", - Visible: false, + Id: "plugin-2-rollback", + Rollback: true, }, }, }, @@ -246,12 +240,12 @@ func TestBuildQuickSyncStages(t *testing.T) { wantErr: false, expectedStages: []*model.PipelineStage{ { - Id: "plugin-1-stage-1", - Visible: true, + Id: "plugin-1-stage-1", + Index: 0, }, { - Id: "plugin-2-stage-1", - Visible: true, + Id: "plugin-2-stage-1", + Index: 1, }, }, }, @@ -285,21 +279,22 @@ func TestBuildPipelineSyncStages(t *testing.T) { &fakePlugin{ pipelineStages: []*model.PipelineStage{ { - Id: "plugin-1-stage-1", - Name: "plugin-1-stage-1", - Visible: true, + Id: "plugin-1-stage-1", + Index: 0, + Name: "plugin-1-stage-1", }, { - Id: "plugin-1-stage-2", - Name: "plugin-1-stage-2", - Visible: true, + Id: "plugin-1-stage-2", + Index: 1, + Name: "plugin-1-stage-2", }, }, rollbackStages: []*model.PipelineStage{ { - Id: "plugin-1-rollback", - Name: "plugin-1-rollback", - Visible: false, + Id: "plugin-1-rollback", + Index: 0, + Name: "plugin-1-rollback", + Rollback: true, }, }, }, @@ -324,22 +319,21 @@ func TestBuildPipelineSyncStages(t *testing.T) { wantErr: false, expectedStages: []*model.PipelineStage{ { - Id: "plugin-1-stage-1", - Name: "plugin-1-stage-1", - Index: 0, - Visible: true, + Id: "plugin-1-stage-1", + Name: "plugin-1-stage-1", + Index: 0, }, { Id: "plugin-1-stage-2", Name: "plugin-1-stage-2", Index: 1, Requires: []string{"plugin-1-stage-1"}, - Visible: true, }, { - Id: "plugin-1-rollback", - Name: "plugin-1-rollback", - Visible: false, + Id: "plugin-1-rollback", + Name: "plugin-1-rollback", + Index: 0, + Rollback: true, }, }, }, @@ -349,40 +343,36 @@ func TestBuildPipelineSyncStages(t *testing.T) { &fakePlugin{ pipelineStages: []*model.PipelineStage{ { - Id: "plugin-1-stage-1", - Name: "plugin-1-stage-1", - Visible: true, + Id: "plugin-1-stage-1", + Name: "plugin-1-stage-1", }, { - Id: "plugin-1-stage-2", - Name: "plugin-1-stage-2", - Visible: true, + Id: "plugin-1-stage-2", + Name: "plugin-1-stage-2", }, { - Id: "plugin-1-stage-3", - Name: "plugin-1-stage-3", - Visible: true, + Id: "plugin-1-stage-3", + Name: "plugin-1-stage-3", }, }, rollbackStages: []*model.PipelineStage{ { - Id: "plugin-1-rollback", - Name: "plugin-1-rollback", - Visible: false, + Id: "plugin-1-rollback", + Index: 0, + Name: "plugin-1-rollback", + Rollback: true, }, }, }, &fakePlugin{ pipelineStages: []*model.PipelineStage{ { - Id: "plugin-2-stage-1", - Name: "plugin-2-stage-1", - Visible: true, + Id: "plugin-2-stage-1", + Name: "plugin-2-stage-1", }, { - Id: "plugin-2-stage-2", - Name: "plugin-2-stage-2", - Visible: true, + Id: "plugin-2-stage-2", + Name: "plugin-2-stage-2", }, }, }, @@ -419,43 +409,39 @@ func TestBuildPipelineSyncStages(t *testing.T) { wantErr: false, expectedStages: []*model.PipelineStage{ { - Id: "plugin-1-stage-1", - Name: "plugin-1-stage-1", - Index: 0, - Visible: true, + Id: "plugin-1-stage-1", + Name: "plugin-1-stage-1", + Index: 0, }, { Id: "plugin-1-stage-2", Name: "plugin-1-stage-2", Index: 1, Requires: []string{"plugin-1-stage-1"}, - Visible: true, }, { Id: "plugin-2-stage-1", Name: "plugin-2-stage-1", Index: 2, Requires: []string{"plugin-1-stage-2"}, - Visible: true, }, { Id: "plugin-1-stage-3", Name: "plugin-1-stage-3", Index: 3, Requires: []string{"plugin-2-stage-1"}, - Visible: true, }, { Id: "plugin-2-stage-2", Name: "plugin-2-stage-2", Index: 4, Requires: []string{"plugin-1-stage-3"}, - Visible: true, }, { - Id: "plugin-1-rollback", - Name: "plugin-1-rollback", - Visible: false, + Id: "plugin-1-rollback", + Name: "plugin-1-rollback", + Index: 0, + Rollback: true, }, }, }, @@ -465,48 +451,40 @@ func TestBuildPipelineSyncStages(t *testing.T) { &fakePlugin{ pipelineStages: []*model.PipelineStage{ { - Id: "plugin-1-stage-1", - Index: 0, - Name: "plugin-1-stage-1", - Visible: true, + Id: "plugin-1-stage-1", + Name: "plugin-1-stage-1", }, { - Id: "plugin-1-stage-2", - Index: 1, - Name: "plugin-1-stage-2", - Visible: true, + Id: "plugin-1-stage-2", + Name: "plugin-1-stage-2", }, { - Id: "plugin-1-stage-3", - Index: 2, - Name: "plugin-1-stage-3", - Visible: true, + Id: "plugin-1-stage-3", + Name: "plugin-1-stage-3", }, }, rollbackStages: []*model.PipelineStage{ { - Id: "plugin-1-rollback", - Index: 0, - Name: "plugin-1-rollback", - Visible: false, + Id: "plugin-1-rollback", + Index: 0, + Name: "plugin-1-rollback", + Rollback: true, }, }, }, &fakePlugin{ pipelineStages: []*model.PipelineStage{ { - Id: "plugin-2-stage-1", - Index: 3, - Name: "plugin-2-stage-1", - Visible: true, + Id: "plugin-2-stage-1", + Name: "plugin-2-stage-1", }, }, rollbackStages: []*model.PipelineStage{ { - Id: "plugin-2-rollback", - Index: 3, - Name: "plugin-2-rollback", - Visible: false, + Id: "plugin-2-rollback", + Index: 2, + Name: "plugin-2-rollback", + Rollback: true, }, }, }, @@ -539,43 +517,39 @@ func TestBuildPipelineSyncStages(t *testing.T) { wantErr: false, expectedStages: []*model.PipelineStage{ { - Id: "plugin-1-stage-1", - Name: "plugin-1-stage-1", - Index: 0, - Visible: true, + Id: "plugin-1-stage-1", + Name: "plugin-1-stage-1", + Index: 0, }, { Id: "plugin-1-stage-2", Name: "plugin-1-stage-2", Index: 1, Requires: []string{"plugin-1-stage-1"}, - Visible: true, }, { Id: "plugin-2-stage-1", Name: "plugin-2-stage-1", Index: 2, Requires: []string{"plugin-1-stage-2"}, - Visible: true, }, { Id: "plugin-1-stage-3", Name: "plugin-1-stage-3", Index: 3, Requires: []string{"plugin-2-stage-1"}, - Visible: true, }, { - Id: "plugin-1-rollback", - Index: 0, - Name: "plugin-1-rollback", - Visible: false, + Id: "plugin-1-rollback", + Index: 0, + Name: "plugin-1-rollback", + Rollback: true, }, { - Id: "plugin-2-rollback", - Index: 3, - Name: "plugin-2-rollback", - Visible: false, + Id: "plugin-2-rollback", + Index: 2, + Name: "plugin-2-rollback", + Rollback: true, }, }, }, diff --git a/pkg/model/deployment.pb.go b/pkg/model/deployment.pb.go index b58edb4356..57c0fc8860 100644 --- a/pkg/model/deployment.pb.go +++ b/pkg/model/deployment.pb.go @@ -578,12 +578,15 @@ type PipelineStage struct { Predefined bool `protobuf:"varint,5,opt,name=predefined,proto3" json:"predefined,omitempty"` Requires []string `protobuf:"bytes,6,rep,name=requires,proto3" json:"requires,omitempty"` // Whether this stage should be rendered or not. + // + // Deprecated: Do not use. Visible bool `protobuf:"varint,7,opt,name=visible,proto3" json:"visible,omitempty"` Status StageStatus `protobuf:"varint,8,opt,name=status,proto3,enum=model.StageStatus" json:"status,omitempty"` // The human-readable description why the stage is at current status. StatusReason string `protobuf:"bytes,9,opt,name=status_reason,json=statusReason,proto3" json:"status_reason,omitempty"` Metadata map[string]string `protobuf:"bytes,10,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` RetriedCount int32 `protobuf:"varint,11,opt,name=retried_count,json=retriedCount,proto3" json:"retried_count,omitempty"` + Rollback bool `protobuf:"varint,12,opt,name=rollback,proto3" json:"rollback,omitempty"` CompletedAt int64 `protobuf:"varint,13,opt,name=completed_at,json=completedAt,proto3" json:"completed_at,omitempty"` CreatedAt int64 `protobuf:"varint,14,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` UpdatedAt int64 `protobuf:"varint,15,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` @@ -663,6 +666,7 @@ func (x *PipelineStage) GetRequires() []string { return nil } +// Deprecated: Do not use. func (x *PipelineStage) GetVisible() bool { if x != nil { return x.Visible @@ -698,6 +702,13 @@ func (x *PipelineStage) GetRetriedCount() int32 { return 0 } +func (x *PipelineStage) GetRollback() bool { + if x != nil { + return x.Rollback + } + return false +} + func (x *PipelineStage) GetCompletedAt() int64 { if x != nil { return x.CompletedAt @@ -919,7 +930,7 @@ var file_pkg_model_deployment_proto_rawDesc = []byte{ 0x79, 0x6e, 0x63, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x29, 0x0a, 0x10, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x5f, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x53, - 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x22, 0xbe, 0x04, 0x0a, 0x0d, 0x50, 0x69, 0x70, 0x65, 0x6c, + 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x22, 0xde, 0x04, 0x0a, 0x0d, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x61, 0x67, 0x65, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, @@ -930,20 +941,22 @@ var file_pkg_model_deployment_proto_rawDesc = []byte{ 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x70, 0x72, 0x65, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, - 0x69, 0x72, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x69, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x76, 0x69, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x12, 0x34, - 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, - 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x53, 0x74, 0x61, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x06, 0x73, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x72, - 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x08, 0x6d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6d, 0x6f, - 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x61, 0x67, - 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, - 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x74, - 0x72, 0x69, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x0c, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2a, + 0x69, 0x72, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x07, 0x76, 0x69, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x07, 0x76, 0x69, 0x73, 0x69, 0x62, + 0x6c, 0x65, 0x12, 0x34, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x53, 0x74, 0x61, 0x67, 0x65, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, + 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x5f, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0c, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x22, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, + 0x53, 0x74, 0x61, 0x67, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x23, 0x0a, + 0x0d, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0b, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x64, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x6f, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x18, 0x0c, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x6f, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x12, 0x2a, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, 0x28, 0x00, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x26, 0x0a, 0x0a, 0x63, 0x72, diff --git a/pkg/model/deployment.pb.validate.go b/pkg/model/deployment.pb.validate.go index ec30dd0b76..cfde3bbe3d 100644 --- a/pkg/model/deployment.pb.validate.go +++ b/pkg/model/deployment.pb.validate.go @@ -642,6 +642,8 @@ func (m *PipelineStage) validate(all bool) error { // no validation rules for RetriedCount + // no validation rules for Rollback + if m.GetCompletedAt() < 0 { err := PipelineStageValidationError{ field: "CompletedAt", diff --git a/pkg/model/deployment.proto b/pkg/model/deployment.proto index 69eaf467b1..5e82a62934 100644 --- a/pkg/model/deployment.proto +++ b/pkg/model/deployment.proto @@ -135,12 +135,13 @@ message PipelineStage { bool predefined = 5; repeated string requires = 6; // Whether this stage should be rendered or not. - bool visible = 7; + bool visible = 7 [deprecated=true]; StageStatus status = 8 [(validate.rules).enum.defined_only = true]; // The human-readable description why the stage is at current status. string status_reason = 9; map metadata = 10; int32 retried_count = 11; + bool rollback = 12; int64 completed_at = 13 [(validate.rules).int64.gte = 0]; int64 created_at = 14 [(validate.rules).int64.gt = 0]; int64 updated_at = 15 [(validate.rules).int64.gt = 0]; diff --git a/web/model/deployment_pb.d.ts b/web/model/deployment_pb.d.ts index d22f831a30..b026a275c5 100644 --- a/web/model/deployment_pb.d.ts +++ b/web/model/deployment_pb.d.ts @@ -198,6 +198,9 @@ export class PipelineStage extends jspb.Message { getRetriedCount(): number; setRetriedCount(value: number): PipelineStage; + getRollback(): boolean; + setRollback(value: boolean): PipelineStage; + getCompletedAt(): number; setCompletedAt(value: number): PipelineStage; @@ -228,6 +231,7 @@ export namespace PipelineStage { statusReason: string, metadataMap: Array<[string, string]>, retriedCount: number, + rollback: boolean, completedAt: number, createdAt: number, updatedAt: number, diff --git a/web/model/deployment_pb.js b/web/model/deployment_pb.js index 3ac416b413..ef80e51d03 100644 --- a/web/model/deployment_pb.js +++ b/web/model/deployment_pb.js @@ -1390,6 +1390,7 @@ proto.model.PipelineStage.toObject = function(includeInstance, msg) { statusReason: jspb.Message.getFieldWithDefault(msg, 9, ""), metadataMap: (f = msg.getMetadataMap()) ? f.toObject(includeInstance, undefined) : [], retriedCount: jspb.Message.getFieldWithDefault(msg, 11, 0), + rollback: jspb.Message.getBooleanFieldWithDefault(msg, 12, false), completedAt: jspb.Message.getFieldWithDefault(msg, 13, 0), createdAt: jspb.Message.getFieldWithDefault(msg, 14, 0), updatedAt: jspb.Message.getFieldWithDefault(msg, 15, 0) @@ -1475,6 +1476,10 @@ proto.model.PipelineStage.deserializeBinaryFromReader = function(msg, reader) { var value = /** @type {number} */ (reader.readInt32()); msg.setRetriedCount(value); break; + case 12: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setRollback(value); + break; case 13: var value = /** @type {number} */ (reader.readInt64()); msg.setCompletedAt(value); @@ -1590,6 +1595,13 @@ proto.model.PipelineStage.serializeBinaryToWriter = function(message, writer) { f ); } + f = message.getRollback(); + if (f) { + writer.writeBool( + 12, + f + ); + } f = message.getCompletedAt(); if (f !== 0) { writer.writeInt64( @@ -1836,6 +1848,24 @@ proto.model.PipelineStage.prototype.setRetriedCount = function(value) { }; +/** + * optional bool rollback = 12; + * @return {boolean} + */ +proto.model.PipelineStage.prototype.getRollback = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 12, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.model.PipelineStage} returns this + */ +proto.model.PipelineStage.prototype.setRollback = function(value) { + return jspb.Message.setProto3BooleanField(this, 12, value); +}; + + /** * optional int64 completed_at = 13; * @return {number} diff --git a/web/src/__fixtures__/dummy-pipeline.ts b/web/src/__fixtures__/dummy-pipeline.ts index 05289b5c4a..ce0a2e3395 100644 --- a/web/src/__fixtures__/dummy-pipeline.ts +++ b/web/src/__fixtures__/dummy-pipeline.ts @@ -16,6 +16,7 @@ export const dummyPipelineStage: PipelineStage.AsObject = { statusReason: "", metadataMap: [], retriedCount: 0, + rollback: false, completedAt: completedAt.unix(), createdAt: createdAt.unix(), updatedAt: updatedAt.unix(),