From 8505b7acc8f413fdf6e6d38b4f3b98282eea7833 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 6 Apr 2020 18:34:49 +0200 Subject: [PATCH] Ignore directories with missing Chart.yaml (#18) Prevents action fails when there are directories detected that do not contain charts. (e.g. .github) Signed-off-by: Chris Fixed: #12 --- cr.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cr.sh b/cr.sh index 75c70e9..6b76410 100755 --- a/cr.sh +++ b/cr.sh @@ -181,6 +181,18 @@ lookup_latest_tag() { fi } +filter_charts() { + while read chart; do + [[ ! -d "$chart" ]] && continue + local file="$chart/Chart.yaml" + if [[ -f "$file" ]]; then + echo $chart + else + echo "WARNING: $file is missing, assuming that '$chart' is not a Helm chart. Skipping." 1>&2 + fi + done +} + lookup_changed_charts() { local commit="$1" @@ -194,7 +206,7 @@ lookup_changed_charts() { fields='1,2' fi - cut -d '/' -f "$fields" <<< "$changed_files" | uniq + cut -d '/' -f "$fields" <<< "$changed_files" | uniq | filter_charts } package_chart() {