Skip to content

Commit

Permalink
feat: record workflow topology to workflow run (#1312)
Browse files Browse the repository at this point in the history
If the topology of a workflow changed, the old workflowRun's
running status can not display, So we need to record workflow's
topology at workflowRun running time to workflowRun status.
  • Loading branch information
zhujian7 authored and caicloud-bot committed Oct 15, 2019
1 parent aff0b0f commit faf86f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions pkg/apis/cyclone/v1alpha1/workflow_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ type StageStatus struct {
Status Status `json:"status"`
// Key-value outputs of this stage
Outputs []KeyValue `json:"outputs"`
// Stages that this stage depends on.
Depends []string `json:"depends"`
// Trivial indicates whether this stage is critical in the workflow. If set to true, it means the workflow
// can tolerate failure of this stage. In this case, all other stages can continue to execute and the overall
// status of the workflow execution can still be succeed.
Trivial bool `json:"trivial"`
}

// StatusPhase represents the phase of stage status or workflowrun status.
Expand Down
4 changes: 3 additions & 1 deletion pkg/workflow/workflowrun/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (o *operator) GetRecorder() record.EventRecorder {
return o.recorder
}

// InitStagesStatus initializes all missing stages' status to pending.
// InitStagesStatus initializes all missing stages' status to pending, and record workflow topology at this time to workflowRun status.
func (o *operator) InitStagesStatus() {
if o.wfr.Status.Stages == nil {
o.wfr.Status.Stages = make(map[string]*v1alpha1.StageStatus)
Expand All @@ -131,6 +131,8 @@ func (o *operator) InitStagesStatus() {
Status: v1alpha1.Status{
Phase: v1alpha1.StatusPending,
},
Depends: stg.Depends,
Trivial: stg.Trivial,
}
}
}
Expand Down

0 comments on commit faf86f1

Please sign in to comment.