Make validate-schema CLI command work vs. disk (#36863)

* Make validate-schema CLI command work vs. disk

Previously, `grafana-cli cue validate-schema` would only validate the
CUE files that had been included at compile time. Now, the command
requires passing a grafana checkout root path, and will actually check
against live files on disk.

* Exempt validateScuemata from sec linter

* Nit: validateScuemata is a simpler, better name

* Try to fix validate-scuemata build step
This commit is contained in:
sam boyer
2021-07-16 19:53:19 -04:00
committed by GitHub
parent dd11e232d0
commit cae47b3c1c
4 changed files with 74 additions and 15 deletions

View File

@ -137,8 +137,18 @@ var adminCommands = []*cli.Command{
var cueCommands = []*cli.Command{
{
Name: "validate-schema",
Usage: "validate *.cue files in the project",
Action: runPluginCommand(cmd.validateScuemataBasics),
Usage: "validate known *.cue files in the Grafana project",
Action: runPluginCommand(cmd.validateScuemata),
Description: `validate-schema checks that all CUE schema files are valid with respect
to basic standards - valid CUE, valid scuemata, etc. Note that this
command checks only paths that existed when grafana-cli was compiled,
so must be recompiled to validate newly-added CUE files.`,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "grafana-root",
Usage: "path to the root of a Grafana repository to validate",
},
},
},
{
Name: "validate-resource",