diff --git a/src/hrval-all.sh b/src/hrval-all.sh index 167a7ce..d756c03 100755 --- a/src/hrval-all.sh +++ b/src/hrval-all.sh @@ -1,12 +1,13 @@ #!/usr/bin/env bash set -o errexit +shopt -s extglob DIR=${1} IGNORE_VALUES=${2-false} KUBE_VER=${3-master} HELM_VER=${4-v2} -IGNORE_EXPRESSION=${5-.*} +IGNORE_EXPRESSION=${5} HRVAL="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/hrval.sh" if [[ ${HELM_VER} == "v2" ]]; then @@ -38,17 +39,17 @@ function isHelmRelease { DIR_PATH=$(echo ${DIR} | sed "s/^\///;s/\/$//") FILES_TESTED=0 for f in `find ${DIR} -type f -name '*.yaml' -or -name '*.yml'`; do - if [[ ${f} =~ ${IGNORE_EXPRESSION} ]]; then - echo "Skipping file by ignore expression" + if [[ -n ${IGNORE_EXPRESSION} && ${f} = ${IGNORE_EXPRESSION} ]]; then + >&2 echo "Skipping file ${f} by ignore expression" continue fi if [[ $(isHelmRelease ${f}) == "true" ]]; then - ${HRVAL} ${f} ${IGNORE_VALUES} ${KUBE_VER} ${HELM_VER} + echo ${f} FILES_TESTED=$(( FILES_TESTED+1 )) else - echo "Ignoring ${f} not a HelmRelease" + >&2 echo "Ignoring ${f} not a HelmRelease" fi -done +done | parallel "${HRVAL} {} \"${IGNORE_VALUES}\" ${KUBE_VER} ${HELM_VER}" # This will set the GitHub actions output 'numFilesTested' echo "::set-output name=numFilesTested::${FILES_TESTED}"