Fixed issue where dates were not being set on workflow executions

This commit is contained in:
Andrey Melnikov
2020-03-02 15:19:39 -08:00
parent 7e8c40f0b7
commit ea04a661b3
2 changed files with 18 additions and 10 deletions

View File

@@ -453,9 +453,12 @@ func (c *Client) WatchWorkflowExecution(namespace, name string) (<-chan *Workflo
continue continue
} }
workflowWatcher <- &WorkflowExecution{ workflowWatcher <- &WorkflowExecution{
UID: string(workflow.UID), CreatedAt: workflow.CreationTimestamp.UTC(),
Name: workflow.Name, StartedAt: workflow.Status.StartedAt.UTC(),
Manifest: string(manifest), FinishedAt: workflow.Status.FinishedAt.UTC(),
UID: string(workflow.UID),
Name: workflow.Name,
Manifest: string(manifest),
} }
if !workflow.Status.FinishedAt.IsZero() { if !workflow.Status.FinishedAt.IsZero() {

View File

@@ -22,13 +22,18 @@ func NewWorkflowServer() *WorkflowServer {
func apiWorkflowExecution(wf *v1.WorkflowExecution) (workflow *api.WorkflowExecution) { func apiWorkflowExecution(wf *v1.WorkflowExecution) (workflow *api.WorkflowExecution) {
workflow = &api.WorkflowExecution{ workflow = &api.WorkflowExecution{
CreatedAt: wf.CreatedAt.Format(time.RFC3339), CreatedAt: wf.CreatedAt.Format(time.RFC3339),
Name: wf.Name, Name: wf.Name,
Uid: wf.UID, Uid: wf.UID,
Phase: string(wf.Phase), Phase: string(wf.Phase),
StartedAt: wf.CreatedAt.Format(time.RFC3339), Manifest: wf.Manifest,
FinishedAt: wf.FinishedAt.Format(time.RFC3339), }
Manifest: wf.Manifest,
if !wf.StartedAt.IsZero() {
workflow.StartedAt = wf.StartedAt.Format(time.RFC3339)
}
if !wf.FinishedAt.IsZero() {
workflow.FinishedAt = wf.FinishedAt.Format(time.RFC3339)
} }
if wf.WorkflowTemplate != nil { if wf.WorkflowTemplate != nil {