Currently the submit button for workflowtemplates is broken both in main and the new 3.6.0 release. The reason is that the UI thinks the content of the workflowtemplate has been updated in the editor, even when it has not.
The process looks like this:
We fetch the workflow from the backend and keep it as a javascript object, convert it to a yaml string, update the editor content with this string, and then when the editor content is updated we convert it back to a javascript object. We then compare to original object with the parsed object to determine if it has been updated or not. This requires parse and stringify to be inverses, but when we downgraded yaml version from 1.2 to 1.1 in https://github.com/argoproj/argo-workflows/pull/13750 we accidently broke this assumption, because we are now parsing as 1.1 but stringifying as 1.2. This fails when we are dealing with some fields like creationTimestamp, where these versions seem to differ.
Modifications
This PR sets the yaml version as 1.1 for both parse and stringify.
Verification
I ran the UI locally in the devcontainer with the fix and submitted workflowtemplates and clusterworkflowtemplates. I also added a test which fails before the fix but passes after the fix.
Fixes #13892
Motivation
Currently the submit button for workflowtemplates is broken both in main and the new 3.6.0 release. The reason is that the UI thinks the content of the workflowtemplate has been updated in the editor, even when it has not.
The process looks like this: We fetch the workflow from the backend and keep it as a javascript object, convert it to a yaml string, update the editor content with this string, and then when the editor content is updated we convert it back to a javascript object. We then compare to original object with the parsed object to determine if it has been updated or not. This requires parse and stringify to be inverses, but when we downgraded yaml version from 1.2 to 1.1 in https://github.com/argoproj/argo-workflows/pull/13750 we accidently broke this assumption, because we are now parsing as 1.1 but stringifying as 1.2. This fails when we are dealing with some fields like creationTimestamp, where these versions seem to differ.
Modifications
This PR sets the yaml version as 1.1 for both parse and stringify.
Verification
I ran the UI locally in the devcontainer with the fix and submitted workflowtemplates and clusterworkflowtemplates. I also added a test which fails before the fix but passes after the fix.