Devenv: Add undev command to the ./setup scrip of devenv (#76684)

* Add undev command to the ./setup scrip of devenv

* Update devenv/setup.sh

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>

* include undev as usage

---------

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
This commit is contained in:
Eric Leijonmarck 2023-10-18 14:05:59 +01:00 committed by GitHub
parent 1de65bb384
commit a6d8cd87a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 0 deletions

View File

@ -13,10 +13,16 @@ Grafana uses [Docker](https://docker.com) to make the task of setting up databas
## Developer dashboards and data sources
To setup developer dashboards and data sources
```bash
./setup.sh
```
To remove the setup developer dashboards and data sources
```bash
./setup.sh undev
```
After restarting the Grafana server, there should be a number of data sources named `gdev-<type>` provisioned as well as
a dashboard folder named `gdev dashboards`. This folder contains dashboard and panel features tests dashboards.

View File

@ -59,6 +59,31 @@ devDatasources() {
ln -s -f ../../../devenv/datasources.yaml ../conf/provisioning/datasources/dev.yaml
}
undev() {
echo -e "\xE2\x9C\x94 Reverting all dev provisioning"
# Removing generated dashboard files from bulk-dashboards
rm -f bulk-dashboards/dashboard*.json
echo -e " \xE2\x9C\x94 Reverting bulk-dashboards provisioning"
# Removing generated folders from bulk-folders
rm -rf bulk-folders/Bulk\ Folder*
echo -e " \xE2\x9C\x94 Reverting bulk-folders provisioning"
# Removing generated dashboard and datasource files from bulk-alerting-dashboards
rm -f bulk_alerting_dashboards/alerting_dashboard*.json
rm -f "bulk_alerting_dashboards/bulk_alerting_datasources.yaml"
echo -e " \xE2\x9C\x94 Reverting bulk-alerting-dashboards provisioning"
# Removing the symlinks
rm -f ../conf/provisioning/dashboards/custom.yaml
rm -f ../conf/provisioning/dashboards/bulk-folders.yaml
rm -f ../conf/provisioning/dashboards/dev.yaml
rm -f ../conf/provisioning/datasources/custom.yaml
rm -f ../conf/provisioning/datasources/dev.yaml
}
usage() {
echo -e "\n"
echo "Usage:"
@ -67,6 +92,7 @@ usage() {
echo " bulk-folders [folders] [dashboards] - provision many folders with dashboards"
echo " bulk-folders - provision 200 folders with 3 dashboards in each"
echo " no args - provision core datasources and dev dashboards"
echo " undev - removes any provisioning done by the setup.sh"
}
main() {
@ -84,6 +110,8 @@ main() {
bulkDashboard
elif [[ $cmd == "bulk-folders" ]]; then
bulkFolders "$arg1"
elif [[ $cmd == "undev" ]]; then
undev
else
devDashboards
devDatasources