argoproj / argo-workflows

Workflow Engine for Kubernetes
https://argo-workflows.readthedocs.io/
Apache License 2.0
15.13k stars 3.21k forks source link

Local CLI templating for faster dev/test iteration cycles #10017

Open agilgur5 opened 2 years ago

agilgur5 commented 2 years ago

Summary

Allow for local templating similar to helm template, so that users can iterate on a Workflow or WorkflowTemplate definition locally and with a faster iteration than having to submit to an Argo Server.

Such a feature would definitely help me and my teams iterate and test faster. I'd be willing to contribute this as well!

Use Cases

For quickly testing and debugging Workflow definitions locally and in CI, e.g.:

  1. If I have a bug or typo in my Workflow parameters, currently I won't know until I submit it to a server
    1. For example, when dealing with expressions, particularly more complicated ones (or chained ones), it's relatively easy for the output to be different from expected. As a really quick example, I tried using sprig.toYaml (which doesn't exist?), but wasn't able to tell I couldn't use that or that it didn't format my parameter properly until I submit to a server. This makes for a slow feedback loop, on top of requiring a server and making it harder to test locally or in CI.
    2. If I had a typo, for instance input instead of inputs or parameter instead of parameters or a parameter that I forgot to define and so it doesn't exist, etc. Those are all actual mistakes I've made. This feature would make it easier to detect such a simple mistake
    3. Other kinds of templating issues that can commonly occur when working with multiple different templating systems, both internal to Argo Workflows, as well as external (e.g. users more familiar with Helm/Go templates may not be as familiar with all the nuances of Argo's templating systems)
  2. argo lint does not (and likely cannot) catch all types of issues, particularly not the formatting of a string manifest, for instance, but if I saw some wonky formatting in output similar to helm template, I could quickly figure out the issue.
  3. Snapshot testing of templates with --parameter-file, for instance
    • helm template <template> --values values-test.yml --> ex. argo submit --template <workflow> --parameter-file parameters-test.yml
  4. Quicker way for users to understand the limitations of Argo's templating
  5. Possibility of a simple online, fully client-side (no server needed) test playground for the templating

Message from the maintainers:

Love this enhancement proposal? Give it a 👍. We prioritise the proposals with the most 👍.

gitsan13 commented 2 years ago

Hi Are you accepting a PR request for this? I would very much like to work on this enhancement:)

agilgur5 commented 2 years ago

Jotting another note here: I did try argo submit's --dry-run flag, but that doesn't template out the parameters, it just outputs the Workflow that will be passed to the Argo Server. Adding --parameter-file just inserts top-level defaults to the template, but doesn't fully template it out.

caelan-io commented 1 year ago

Discussed yesterday with @agilgur5 - I think this feature makes a lot of sense and is gaining a lot of support just in the last 6 months.

@agilgur5 - would you be open to adapting this issue into a short enhancement proposal PR? We can then ensure other maintainers give feedback on this.

agilgur5 commented 1 year ago

@agilgur5 - would you be open to adapting this issue into a short enhancement proposal PR? We can then ensure other maintainers give feedback on this.

I think you meant a more formal, in-repo documented proposal like #10191? Those haven't seem to have gotten a lot of attention unfortunately 😕 (as you likely know well too) EDIT: It looks like there was an attempt to make a Proposal Template in #9857, but ironically that itself got closed as stale 😕

I was planning to just go straight to PR if I can find an optimal solution that does not really have any trade-offs. i.e. no real decision to be made, just an approval. Haven't had time to dive into this yet though (so haven't assigned myself)