Skip to content
Merged
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
8 changes: 7 additions & 1 deletion persist/sqldb/workflow_archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ func phaseEqual(phase string) db.Cond {
}

func (r *workflowArchive) GetWorkflow(ctx context.Context, uid string, namespace string, name string) (*wfv1.Workflow, error) {
logger := logging.RequireLoggerFromContext(ctx)
var err error
archivedWf := &archivedWorkflowRecord{}
if uid != "" {
Expand All @@ -533,14 +534,19 @@ func (r *workflowArchive) GetWorkflow(ctx context.Context, uid string, namespace
}
num := int64(total.Total)
if num > 1 {
return nil, fmt.Errorf("found %d archived workflows with namespace/name: %s/%s", num, namespace, name)
logger.WithFields(logging.Fields{
"namespace": namespace,
"name": name,
"num": num,
}).Debug(ctx, "returning latest of archived workflows")
}
err = r.session.SQL().
Select("workflow").
From(archiveTableName).
Where(r.clusterManagedNamespaceAndInstanceID()).
And(namespaceEqual(namespace)).
And(nameEqual(name)).
OrderBy("-startedat").
One(archivedWf)
} else {
return nil, sutils.ToStatusError(fmt.Errorf("both name and namespace are required if uid is not specified"), codes.InvalidArgument)
Expand Down
Loading