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

Dashboard versions can not match version recorded in scm #53484

Open
dnck opened this issue Aug 9, 2022 · 2 comments
Open

Dashboard versions can not match version recorded in scm #53484

dnck opened this issue Aug 9, 2022 · 2 comments

Comments

@dnck
Copy link

dnck commented Aug 9, 2022

What happened:

When allowUiUpdates is set to false, dashboards are not saved to the configured database.

Instead, users are instructed to save the json model of a dashboard.

However, when the ⚙️ <> Json Model is saved, the id field of the dashboard is removed as Grafana will use the dashboard's uid to insert/update the dashboard for future deployments using the same database. And when Grafana provisions again, it will automatically increment the provisioned dashboard's version number in the database. This prevents admins from maintaining the version number of the dashboard in a repository.

What you expected to happen:

If a provisioned dashboard which does not allow ui updates specifies a version number, then Grafana should use this version number rather than just incrementing the current version number in the database table select version from public.dashboard where uid = 'foo'.

How to reproduce it (as minimally and precisely as possible):

  1. Start a postgres server
  2. Start Grafana server with a provisioned dashboard at version = 10
  3. Look in Grafana UI at dashboard's verison: it is not at 1 because it was a fresh database,

Anything else we need to know?:
No

Environment:

  • Grafana version: 8.5.9
  • Data source type & version: n/a
  • OS Grafana is installed on: running in podman from the stock ubuntu image
  • User OS & Browser: n/a
  • Grafana plugins: n/a
  • Others: n/a
@mellieA
Copy link
Contributor

mellieA commented Aug 15, 2022

@dnck I'll route this to the squad to take a look and comment on what's expected, we might want improve the docs about this topic. Can you share more about how you're using the version in your provisioning workflow and why the version in the database is causing trouble for you? According to this note, the source will always overwrite a saved copy in the database regardless of version.

https://grafana.com/docs/grafana/latest/administration/provisioning/#dashboards

Note: If a provisioned dashboard is saved from the UI and then later updated from the source, the dashboard stored in the database will always be overwritten. The version property in the JSON file will not affect this, even if it is lower than the existing dashboard.

If I've misunderstood your question, it will help us to understand without setting up the full test you've outlined if you can share some snippets/screenshots to give us more context.

@gasmick
Copy link

gasmick commented Aug 17, 2022

IMHO, there is a connection to #30936
Every time after a Grafana-restart the same dashboards (with the same 'uid') provisioned from the same files from a source folder get a new 'id' in the 'dashboard' table. In the mentioned issue it leads to cleared ACL settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants