Skip to content

Commit 30b07cf

Browse files
committed
Recorrect
1 parent e2ac105 commit 30b07cf

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

release.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,21 @@ readarray -t PUBLISH_CHARTS <<< "$(echo ${CHANGED_CHARTS} | xargs )"
112112
##
113113
if ! [[ -z $(echo "${CHANGED_CHARTS}" | xargs) ]] && [[ ${#PUBLISH_CHARTS[@]} -gt 0 ]]; then
114114

115+
## Check if charts exist as directory, this
116+
## serves as simple handler when a chart is removed
117+
## (if that's ever gonna happen).
118+
##
119+
EXISTING_CHARTS=()
120+
for PRE_CHART in "${PUBLISH_CHARTS[@]}"; do
121+
TRIM_CHART="$(echo $PRE_CHART | xargs)"
122+
[ -d "$TRIM_CHART" ] && EXISTING_CHARTS+=("$TRIM_CHART")
123+
done
124+
125+
## Just to be sure, checking that the array
126+
## is not empty
127+
##
128+
if [[ ${#EXISTING_CHARTS[@]} -gt 0 ]]; then
129+
115130
## Create required directories
116131
##
117132
createDirs
@@ -126,7 +141,7 @@ if ! [[ -z $(echo "${CHANGED_CHARTS}" | xargs) ]] && [[ ${#PUBLISH_CHARTS[@]} -g
126141
## with the helm built-in function.
127142
##
128143
echo -e "\n\e[33m- Crafting Packages\e[0m"
129-
for CHART in "${PUBLISH_CHARTS[@]}"; do
144+
for CHART in "${EXISTING_CHARTS[@]}"; do
130145
echo -e "\n\e[32m-- Package: $CHART\e[0m"
131146
helm package $CHART --dependency-update --destination ${CR_RELEASE_LOCATION}
132147
done
@@ -156,7 +171,10 @@ if ! [[ -z $(echo "${CHANGED_CHARTS}" | xargs) ]] && [[ ${#PUBLISH_CHARTS[@]} -g
156171
git status
157172
git commit -sm "Update index.yaml"
158173
git push origin gh-pages
159-
174+
else
175+
## Some Feedback
176+
echo -e "\n\e[33mChanges to non existent chart detected.\e[0m\n"; exit 0;
177+
fi
160178
else
161179
## Some Feedback
162180
echo -e "\n\e[33mNo Changes on any chart detected.\e[0m\n"; exit 0;

0 commit comments

Comments
 (0)