community.grafana icon indicating copy to clipboard operation
community.grafana copied to clipboard

Better idempotence report when creating a dashboard in a folder

Open BenjaminSchubert opened this issue 4 years ago • 3 comments

SUMMARY

Previously, whenever you would upload a dashboard to a custom folder, the status would always be reported as changed, as the folderId is never included in the return value, but was in our payload.

The current solution is not perfect, but would at least not report changed when nothing changed, and should not break any other workflows.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

grafana_dashboard

ADDITIONAL INFORMATION

In order to understand and reproduce the issue, running the added integration test without the patch would fail, as the second upload would fail.

For context, https://github.com/grafana/grafana/issues/12491 is also relevant

BenjaminSchubert avatar Apr 25 '21 19:04 BenjaminSchubert

Codecov Report

:exclamation: No coverage uploaded for pull request base (main@e015c80). Click here to learn what that means. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #168   +/-   ##
=======================================
  Coverage        ?   72.50%           
=======================================
  Files           ?        7           
  Lines           ?      702           
  Branches        ?       75           
=======================================
  Hits            ?      509           
  Misses          ?      176           
  Partials        ?       17           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e015c80...61a4dbc. Read the comment docs.

codecov[bot] avatar Apr 25 '21 19:04 codecov[bot]

Another solution would be first ot get the dashboard by uid then search for it by title, which would give a more accurate result, for example, if the person is renaming the dashboard. I am happy to change my solution to such a system if you prefer.

BenjaminSchubert avatar Apr 25 '21 20:04 BenjaminSchubert

Hi @BenjaminSchubert ! Thanks for your PR !

I think that first looking for the dashboard by uuid and then by title would indeed avoid having a match by title while we have an uuid match later on.

I gladly accept the improvement !

rrey avatar Sep 08 '21 14:09 rrey