From 8a7afdb035f30891a292c866320a7c444b45bb68 Mon Sep 17 00:00:00 2001 From: davidnewhall2 Date: Thu, 30 Jan 2020 18:18:13 -0800 Subject: [PATCH] Update script --- dashboards.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dashboards.sh b/dashboards.sh index 13baab6..ac2d056 100755 --- a/dashboards.sh +++ b/dashboards.sh @@ -1,6 +1,6 @@ #/bin/bash -if [ "$TRAVIS_BRANCH" = "" ]; then +if [ "$TRAVIS_COMMIT_RANGE" = "" ]; then echo "this only works in travis-ci" exit 1 fi @@ -33,9 +33,11 @@ IFS=$(echo -en "\n\b") function check { echo -n "Checking dashboards in: " pushd "${WHERE}" + local file="" for file in *; do local found=0 + local i="" [ "$file" != "README.md" ] || continue # Check for this file's existence in the DASHMAP variable. @@ -63,9 +65,11 @@ function check2 { pushd "${WHERE}" local files=$(ls) popd >> /dev/null + local i="" for i in ${!DASHMAP[@]}; do local found=0 + local file="" for file in $files; do if [ "${DASHMAP[$i]}" = "$file" ]; then @@ -82,6 +86,7 @@ function check2 { done } +# check if a dashboard (or file) has been modified function isChanged { local changed=false local filename=$1 @@ -103,6 +108,7 @@ function isChanged { # Upload all the (changed) dashboards to grafana.com. function deploy { + local i="" for i in ${!DASHMAP[@]}; do isChanged "${WHERE}${DASHMAP[$i]}" if [ "$?" = "1" ]; then