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 test to render and lint dashboards #106

Merged
merged 4 commits into from
Apr 6, 2024

Conversation

consideRatio
Copy link
Member

@consideRatio consideRatio commented Apr 5, 2024

This projects use jsonnet to render grafana dashboard definitions (json). Our pre-commit hooks ensures we have formatted and valid jsonnet files, but until now we haven't done checks on the rendered grafana dashboards.

The only input variable for rendering dashboard definitions is a list of datasource names for the global dashboard. This makes the rendered dashboards very very similar between admins rendering them for their respective deployments, and therefore linting one is to lint them all pretty much.

I've not used grafana/dashboard-linter myself before, and I just searched for a linter as a way to have some kind of test on the validity of the rendered dashboards. I don't know if and what rules make sense etc, but figured this could help us maintain this project.

https://github.com/grafana/dashboard-linter/blob/main/docs/index.md#rules

Future improvement ideas

  • Extract logic so this is easy and quick to run locally also assuming relevant binaries are on PATH

@consideRatio consideRatio changed the title Add test to verify dashboard renders Add test to render dashboards and then lint them with grafana/dashboard-linter Apr 5, 2024
@consideRatio consideRatio marked this pull request as ready for review April 5, 2024 16:25
@consideRatio consideRatio changed the title Add test to render dashboards and then lint them with grafana/dashboard-linter ci: render and lint dashboards Apr 5, 2024
@consideRatio consideRatio changed the title ci: render and lint dashboards Add test to render and lint dashboards Apr 5, 2024
@consideRatio consideRatio force-pushed the pr/test-dashboard-render branch 5 times, most recently from ef54d03 to e7e6b2d Compare April 5, 2024 19:47
@consideRatio
Copy link
Member Author

Since this isn't changing anything that could impact the dashboards, I'll go for a merge to retain momentum and use this to inspect things in #90.

@consideRatio consideRatio merged commit b8e2868 into jupyterhub:main Apr 6, 2024
1 of 3 checks passed
yuvipanda added a commit to yuvipanda/grafana-dashboards that referenced this pull request Jul 19, 2024
This was self-merged in jupyterhub#106,
and has never passed. I don't think we should have a test that is always
expected to fail.
yuvipanda added a commit to yuvipanda/grafana-dashboards that referenced this pull request Jul 19, 2024
This was introduced in jupyterhub#106,
and has never passed. I don't think we should have a test that is always
expected to fail.

If it should be re-introduced, it should be done in such a way that
whatever changes are needed to make it pass should be part of the PR.

This only reverts the linter, but keeps the rendering test - as that would
help us catch possible jsonnet syntax issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant