From 1a347befc6ec970a7f4c535b08eebef113678f9f Mon Sep 17 00:00:00 2001 From: Edmondo Porcu Date: Tue, 8 Aug 2023 09:48:15 -0700 Subject: [PATCH] Fixing pipeline Signed-off-by: Edmondo Porcu --- cr.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/cr.sh b/cr.sh index 8126548..a8cb24b 100755 --- a/cr.sh +++ b/cr.sh @@ -285,15 +285,21 @@ filter_charts() { lookup_changed_charts() { local commit="$1" - local changed_files - changed_files=$(git diff --find-renames --name-only "$commit" -- "$charts_dir") + if [ -z "$commit" ]; then + # If no commit is given (i.e., no previous tag), consider all charts. + find "$charts_dir" -maxdepth 1 -type d | filter_charts + else + local changed_files + changed_files=$(git diff --find-renames --name-only "$commit" -- "$charts_dir") - local depth=$(($(tr "/" "\n" <<<"$charts_dir" | sed '/^\(\.\)*$/d' | wc -l) + 1)) - local fields="1-${depth}" + local depth=$(($(tr "/" "\n" <<<"$charts_dir" | sed '/^\(\.\)*$/d' | wc -l) + 1)) + local fields="1-${depth}" - cut -d '/' -f "$fields" <<<"$changed_files" | uniq | filter_charts + cut -d '/' -f "$fields" <<<"$changed_files" | uniq | filter_charts + fi } + package_chart() { local chart="$1"