argoproj / argoproj/argo-workflows
Better Messaging for YAML errors in Linter
- Dominant language
- Go
- Stars
- 17k
- Forks
- 3.7k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 138
Description
# Summary
What change needs making?
Enhancing yaml parsing debug messages to give more descriptive linting / debug information.
# Use Cases
The Argo linter is heavily used for validating workflow configurations before actually running them (for correctness purposes). As yaml keys aren't order dependent, common yaml issues like duplicate keys should be caught with better error messages.
Ex.
```yaml
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: debug-template
spec:
entrypoint: failing-template
templates:
- name: failing-template
container:
image: alpine:latest
command: [sh, -c]
args: ["echo some random text"]
...
...
command: [bash, -c]
```
Taking a quick glance at a template, sometimes we add in a key again (in this case the `command` key). However, on doing so, the linter fails with this:
```
> argo template lint issue.yaml
✖ found nothing to lint in the specified paths, failing...
```
Verbose:
```
> argo template lint issue.yaml -v
DEBU[2022-09-08T15:13:24.085Z] CLI version version="{v3.2.8+8de5416.dirty 2022-02-05T05:11:22Z 8de5416ac6b8f5640a8603e374d99a18a04b5c8d v3.2.8 dirty go1.17.6 gc darwin/arm64}"
DEBU[2022-09-08T15:13:24.085Z] Client options opts="(argoServerOpts=(url=,path=,secure=true,insecureSkipVerify=false,http=false),instanceID=)"
I0908 15:13:24.086964 31877 loader.go:372] Config loaded from file: /Users/user1/.kube/config
I0908 15:13:24.093480 31877 loader.go:372] Config loaded from file: /Users/user1/.kube/config
✖ found nothing to lint in the specified paths, failing...
```
The above messaging is confusing and very hard to debug. Ideally these kinds of relatively common errors should be caught?
Contributor guide
Assessment
This issue has not been assessed yet.