=====================================================================

--- Changes ------------------------------

- kubectl driver updates; getting better, but still need to fix
  autocomplete in certain circumstances

- added -y|--yes flags to scwrypts to auto-accept user-prompts (use with
  caution)

- figured out the whole mikefarah/yq vs kislyuk/yq thing; use YQ for
  compatiblity

--- Bug fixes ----------------------------

- helm template generation now loads values in a more appropriate order
  which prevents overwrite by the wrong values file
This commit is contained in:
2023-11-22 15:54:16 -07:00
parent a03885e8db
commit 72e831da33
14 changed files with 354 additions and 37 deletions

View File

@ -65,6 +65,7 @@ HELM__TEMPLATE__GET() {
[ ! $TEMPLATE_OUTPUT ] && EXIT_CODE=1
[[ $RAW -eq 1 ]] && {
[ $USE_CHART_ROOT ] && [[ $USE_CHART_ROOT -eq 1 ]] || HELM_ARGS+=(--show-only $(echo $TEMPLATE_FILENAME | sed "s|^$CHART_ROOT/||"))
[[ $COLORIZE -eq 1 ]] \

View File

@ -27,9 +27,14 @@ HELM__VALIDATE() {
return 1
}
CHART_NAME=$(yq -r .name "$CHART_ROOT/Chart.yaml")
CHART_NAME=$(YQ -r .name "$CHART_ROOT/Chart.yaml")
[[ $TEMPLATE_FILENAME =~ values*.yaml$ ]] && {
[[ $TEMPLATE_FILENAME =~ values.*.yaml$ ]] && {
HELM_ARGS+=(--values $TEMPLATE_FILENAME)
USE_CHART_ROOT=1
}
[[ $TEMPLATE_FILENAME =~ tests/.*.yaml$ ]] && {
HELM_ARGS+=(--values $TEMPLATE_FILENAME)
USE_CHART_ROOT=1
}
@ -54,9 +59,18 @@ _HELM__GET_CHART_ROOT() {
}
_HELM__GET_DEFAULT_VALUES_ARGS() {
for F in \
"$CHART_ROOT/tests/default.yaml" \
"$CHART_ROOT/values.test.yaml" \
"$CHART_ROOT/values.yaml" \
;
do
[ -f "$F" ] && HELM_ARGS=(--values "$F" $HELM_ARGS)
done
for LOCAL_REPOSITORY in $(\
cat "$CHART_ROOT/Chart.yaml" \
| yq -r '.dependencies[] | .repository' \
| YQ -r '.dependencies[] | .repository' \
| grep '^file://' \
| sed 's|file://||' \
)
@ -67,22 +81,13 @@ _HELM__GET_DEFAULT_VALUES_ARGS() {
;
for F in \
"$LOCAL_REPOSITORY_ROOT/values.yaml" \
"$LOCAL_REPOSITORY_ROOT/values.test.yaml" \
"$LOCAL_REPOSITORY_ROOT/tests/default.yaml" \
"$LOCAL_REPOSITORY_ROOT/values.test.yaml" \
"$LOCAL_REPOSITORY_ROOT/values.yaml" \
;
do
[ -f "$F" ] && HELM_ARGS+=(--values "$F")
[ -f "$F" ] && HELM_ARGS=(--values "$F" $HELM_ARGS)
done
done
for F in \
"$CHART_ROOT/values.yaml" \
"$CHART_ROOT/values.test.yaml" \
"$CHART_ROOT/tests/default.yaml" \
;
do
[ -f "$F" ] && HELM_ARGS+=(--values "$F")
done
}