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
2 changed files with 34 additions and 0 deletions

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