argo-workflows icon indicating copy to clipboard operation
argo-workflows copied to clipboard

metadata.generateName or metadata.name should allow variables in their definition

Open tooptoop4 opened this issue 4 years ago • 7 comments

if I try some variable within these values they complain about { is not a valid alphanumeric

tooptoop4 avatar Feb 17 '22 08:02 tooptoop4

I don’t think you can substitute these.

terrytangyuan avatar Feb 17 '22 11:02 terrytangyuan

This is not possible when submiting a Workflow directly, because the name must be know at submission time.

But what about WorkflowTemplate? We could do something like this:

kind: WorkflowTemplate
spec:
  workflowMetadata:
    name: 
     valueFrom: 
       expression: "my-expression"

alexec avatar Feb 17 '22 15:02 alexec

@alexec does your example work in released version or is it a proposal?

tooptoop4 avatar Feb 17 '22 21:02 tooptoop4

It is proposal.

alexec avatar Feb 18 '22 00:02 alexec

any workarounds? as workflow that runs often is getting name collisions so it can't be archived

tooptoop4 avatar Jan 12 '23 23:01 tooptoop4

there is workaround:

            - src:
                dependencyName: test-dep
                dataTemplate: "{{ .Input.body.pull_request.number }}-{{ .Input.body.pull_request.head.sha | substr 0 7 }}"
              dest: metadata.name

from here

raven-wing avatar Mar 15 '23 13:03 raven-wing

@raven-wing that is only for argo-events objects?

tooptoop4 avatar Mar 18 '23 10:03 tooptoop4

there is workaround:

You can also use the Workflow of Workflows pattern with a wrapper Workflow to do something similar. That's potentially the easiest way to do it with Argo Workflows alone (i.e. without Events etc).

Otherwise this isn't possible to do directly, as mentioned above

agilgur5 avatar Oct 18 '24 05:10 agilgur5

i think longer randomized string + timestamp (for wftemplate and cronwf) is most important when submitted via ui since it has no option to append

tooptoop4 avatar Nov 04 '24 20:11 tooptoop4