community.grafana
community.grafana copied to clipboard
Better idempotence report when creating a dashboard in a folder
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
Codecov Report
:exclamation: No coverage uploaded for pull request base (
main@e015c80). Click here to learn what that means. The diff coverage isn/a.
@@ 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 dataPowered by Codecov. Last update e015c80...61a4dbc. Read the comment docs.
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.
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 !