tektoncd / tektoncd/cli

tkn bundle build validation

Open
#1,666 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/feature
Dominant language
Go
Stars
461
Forks
277
Avg merge
16h 48m
Merged PRs (30d)
95

Description

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 😆 )

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pkg/bundle/parser.go at the referenced YAML and object parsing errors, then trace the current bundle push flow and its filename handling. Define how validation should work without pushing and how parsing errors should be presented. Done means a bundle can be checked before registry upload with clearer, useful errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.