Skip to content
This repository has been archived by the owner on Jun 2, 2022. It is now read-only.

Compatibility with skaffold #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions secrets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ encrypt_helper() {
[[ -e "$yml" ]] || { echo "File does not exist: $dir/$yml"; exit 1; }
local ymldec=$(sed -e "s/\\.yaml$/${DEC_SUFFIX}/" <<<"$yml")
[[ -e $ymldec ]] || ymldec="$yml"

if [[ $(grep -C10000 'sops:' "$ymldec" | grep -c 'version:') -gt 0 ]]
then
echo "Already encrypted: $ymldec"
Expand Down Expand Up @@ -380,7 +380,7 @@ options='$options'
longoptions='$longoptions'
EOF
fi

# parse command line
local parsed # separate line, otherwise the return value of getopt is ignored
# if parsing fails, getopt returns non-0, and the shell exits due to "set -e"
Expand All @@ -395,7 +395,7 @@ EOF
case "$1" in
--)
# skip --, and what remains are the cmd args
shift
shift
break
;;
-f|--values)
Expand All @@ -420,7 +420,12 @@ EOF

# run helm command with args and opts in correct order
set +e # ignore errors

# If cmdopts isn't set then default it to an empty string
: "${cmdopts:=''}"

${HELM_BIN} ${TILLER_HOST:+--host "$TILLER_HOST" }"$cmd" $subcmd "$@" "${cmdopts[@]}"
EXIT_STATUS=$?

# cleanup on-the-fly decrypted files
[[ ${#decfiles[@]} -gt 0 ]] && rm -v "${decfiles[@]}"
Expand Down Expand Up @@ -483,7 +488,7 @@ case "${1:-help}" in
fi
clean "$2"
;;
install|upgrade|lint|diff)
install|upgrade|lint|diff|dep|get|delete)
helm_command "$@"
;;
--help|-h|help)
Expand All @@ -495,4 +500,8 @@ case "${1:-help}" in
;;
esac

exit 0
if [ -z ${EXIT_STATUS+x} ]; then
exit 0
else
exit $EXIT_STATUS
fi