tektoncd / cli

A CLI for interacting with Tekton!
Apache License 2.0
429 stars 249 forks source link

tkn bundle build validation #1666

Open williamlfish opened 2 years ago

williamlfish commented 2 years ago

Feature request

Bundle validation, with clearer errors. when creating a bundle its not an option to create without pushing, so there is no way to validate a bundle before attempting to push. This would be great addition to support ci when creating/updating tekton pipelines/tasks.

Use case

When using bundles as the source of truth, creating a pr that updates pipelines and or tasks there is no way to validate that there are any minor mistakes in the manifest. If one where to attempt to check if the bundle builds successfully, they would also be forced to push up to an image registry ( or give a bad registry source and attempt to differentiate between the error of a bad registry name or a parsing error )

Currently the cli either returns a string of the original data passed in, or a json string, depending on where it errors. With neither of these being "pretty" formatted they are hard to read in the terminal, and don't convey any helpful information as to where the error might be. There are 2 different errors that would already be a more helpful if used.

When parsing the yaml ( or potentially json ) the parser gives you an area to look around found here

error converting YAML to JSON: yaml: line 9: mapping values are not allowed in this context

and the second is a print that is a little more opaque, but still more readable and helpful than just a printout of the json and can be found here

v1beta1.Task.Spec: readObjectStart: expect { or n, but found [, error found in #10 byte of ...|},"spec":[{"default"|..., bigger context ...|","metadata":{"name":"example-task-name"},"spec":[{"default":"/workspace/workspace/Dockerfile","desc|...

There is certainly room for a better ux here, so up to have that conversation, but personally feel even just bubbling up the current already supplied errors would be a help.

UI Example

tkn bundle push <registry> --filenames=<pathtofile> --dry-run would follow common patterns when interacting with kube resources, but its quite verbose and with the verb push and registry argument, it might be more appropriate and clear to end users if we use a new cmd tkn bundle validate --filenames=<pathtofile> could be nice. 🤷‍♀️

Also worth noting that the filenames flag is plural, however not super clear how to use more then one path ( i have never gotten it to work 😅 ) but that can be its own issue ( or just my user error 😆 )

tekton-robot commented 1 year ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale with a justification. Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with /close with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle stale

Send feedback to tektoncd/plumbing.

vdemeester commented 1 year ago

/remove-lifecycle stale