Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JSON output to CLI pipeline validation #313

Closed
colindean opened this issue Jun 28, 2021 · 5 comments
Closed

Add JSON output to CLI pipeline validation #313

colindean opened this issue Jun 28, 2021 · 5 comments
Labels
enhancement Indicates an improvement to a feature

Comments

@colindean
Copy link

Description

The Vela CLI tool can validate .vela.yml but it just outputs an "it's ok" message when evaluating locally. It'd be great if it could output the config as JSON as seemingly the remote validation can.

Value

I'd like to extract information from .vela.yml via the commonly-installed jq program without having to install other tooling, e.g. yq or writing a script that converts YAML to JSON but does so without validation and with a different YAML parser that may produce a different JSON result than Go's YAML library that Vela uses.

My particular use case is extracting the Docker tag specified in the Vela config for use in a dev env build script.

Definition of Done

The vela validate pipeline program takes an option --output json when in local mode and produces a JSON version of the .vela.yml.

Impacted Personas (Optional)

Folks building tools around Vela would benefit from being able to deal with materialized JSON instead of YAML.

@colindean colindean added the enhancement Indicates an improvement to a feature label Jun 28, 2021
@benzvan
Copy link

benzvan commented Jul 9, 2021

I have also found that this it's ok message is returned even if the .vela.yml is not a yaml file.

@susangreve
Copy link

Thanks for opening this! We have added it to the backlog and will assess priority

@susangreve susangreve added this to Inbox in Waiting Room via automation Jul 19, 2021
@colindean
Copy link
Author

Perhaps also an option to resolve templates, but with an acknowledgement that since templates can contain logic, they may not be expandable by the tool. I guess this could be worked around by allowing the user to specify environment variable values and telling the user what they need to supply when it's missing.

Bonus points if there's a way for Go templates to list what variables they expect…

@colindean
Copy link
Author

colindean commented Feb 28, 2023

The current behavior as of v0.17.0 now outputs the rendered template in YAML, but it also still outputs the "is valid" message, so piping the output to a yaml2json converter isn't possible without first removing the first line.

https://github.com/go-vela/cli/blob/641fb4c22d9e4ef1409ca564da665e322aa74931/action/pipeline/validate.go#L117-L126

@plyr4
Copy link
Contributor

plyr4 commented Jan 17, 2024

closed as complete via #791 and #313

@plyr4 plyr4 closed this as completed Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Indicates an improvement to a feature
Projects
Development

No branches or pull requests

4 participants