add sys-uid as a param to all workflows

This commit is contained in:
rushtehrani
2020-05-05 22:16:00 -07:00
parent 5ebb1db051
commit 7d19a8543b
2 changed files with 34 additions and 10 deletions

View File

@@ -103,6 +103,20 @@ func (c *Client) injectAutomatedFields(namespace string, wf *wfv1.Workflow, opts
}
}
uid := wf.Labels[label.WorkflowUid]
if uid == "" {
uid = "00000000-0000-0000-0000-000000000000"
}
if &wf.Spec.Arguments == nil {
wf.Spec.Arguments = wfv1.Arguments{
Parameters: []wfv1.Parameter{},
}
}
wf.Spec.Arguments.Parameters = append(wf.Spec.Arguments.Parameters, wfv1.Parameter{
Name: "sys-uid",
Value: ptr.String(uid),
})
addSecretValsToTemplate := true
secret, err := c.GetSecret(namespace, "onepanel-default-env")
if err != nil {
@@ -384,7 +398,7 @@ func (c *Client) CreateWorkflowExecution(namespace string, workflow *WorkflowExe
workflow.ID = id
workflow.Name = createdWorkflow.Name
workflow.CreatedAt = createdWorkflow.CreationTimestamp.UTC()
workflow.UID = string(createdWorkflow.ObjectMeta.UID)
workflow.UID = workflowUid
workflow.WorkflowTemplate = workflowTemplate
// Manifests could get big, don't return them in this case.
workflow.WorkflowTemplate.Manifest = ""