grafana / grizzly

A utility for managing Jsonnet dashboards against the Grafana API
https://grafana.github.io/grizzly/
Apache License 2.0
514 stars 66 forks source link

[Bug]: Mandatory provider for offline commands #424

Closed sberlin closed 4 months ago

sberlin commented 5 months ago

Grizzly Version

0.4.1

Expected Behavior

podman run --rm -v $PWD/:/src:Z -w /src grafana/grizzly:0.4.1 show foo.jsonnet should show rendered results. It should not require a connection to Grafana because it's purely offline, which enables local development and CI usage without passing information for the later environment.

time="2024-04-25T14:03:00Z" level=info msg="Showing 28 resources"
DashboardFolder.foo:
apiVersion: grizzly.grafana.com/v1alpha1
...

Correct results are returned when downgrading: podman run --rm -v $PWD/:/src:Z -w /src grafana/grizzly:0.4.0 show foo.jsonnet.

Actual Behavior

Instead it prints:

Providers: Grafana - inactive (grafana URL is not set), Mimir - inactive (exec: "cortextool": executable file not found in $PATH), Synthetic Monitoring - inactive (stack id is not set) time="2024-04-25T14:16:45Z" level=fatal msg="parse error in 'foo.jsonnet': couldn't find a handler for DashboardFolder: handler not found"

Steps to Reproduce

The container provides the correct environment. The file contents:

{
  "apiVersion": "grizzly.grafana.com/v1alpha1",
  "kind": "DashboardFolder",
  "metadata": {
    "name": "foo"
  },
  "spec": {
    "title": "foo"
  }
}

The breaking change can be fixed by passing any contents to environment variable GRAFANA_URL, e.g. with -e GRAFANA_URL=foo. I assume #362 to be the origin.