Skip to content

Commit

Permalink
fix: disable cleanup on debug/trace
Browse files Browse the repository at this point in the history
  • Loading branch information
aslafy-z authored Jul 9, 2024
1 parent 78b56fa commit b674b31
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions helm-git-plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,25 @@ error_invalid_protocol="Protocol not allowed, it should match one of theses: $al
readonly error_invalid_protocol

# Debug & trace output configuration
cleanup=1
debug=0
if [ "${HELM_GIT_DEBUG:-}" = "1" ]; then
debug=1
fi
trace=0
git_output="/dev/null"
git_quiet="--quiet"
if [ "${HELM_GIT_DEBUG:-}" = "1" ]; then
debug=1
cleanup=0
fi
if [ "${HELM_GIT_TRACE:-}" = "1" ]; then
trace=1
debug=1
cleanup=0
git_output="/dev/stderr"
git_quiet=""
fi
readonly trace
readonly cleanup
readonly debug
readonly trace
readonly git_output
readonly git_quiet

Expand Down Expand Up @@ -388,13 +392,14 @@ main() {
fi
fi

# Setup cleanup trap
# Setup exit trap
# shellcheck disable=SC2317
cleanup() {
exit_trap() {
[ $cleanup = 1 ] || return 0
rm -rf "$git_root_path" "${helm_home_target_path:-}"
${CACHE_CHARTS} || rm -rf "${helm_target_path:-}"
}
trap cleanup EXIT
trap exit_trap EXIT

git_root_path="$(mktemp -d "$TMPDIR/helm-git.XXXXXX")"
readonly git_root_path="$git_root_path"
Expand Down

0 comments on commit b674b31

Please sign in to comment.