From 13ef76127de8950487dbc26bb93f5cd09de9ac57 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 25 Nov 2016 01:15:44 -0700 Subject: [PATCH 1/3] Suppress output unless the `git submodule update` call fails This will give a bit more warning to developers as to what might be going on, allowing them to respond appropriately. Closes #2479 --- plugins/git/functions | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/plugins/git/functions b/plugins/git/functions index 33158d646..dd6ac32a2 100755 --- a/plugins/git/functions +++ b/plugins/git/functions @@ -28,7 +28,7 @@ git_build_app_repo() { git remote add origin "$DOKKU_ROOT/$APP" &> /dev/null git fetch --depth=1 origin "refs/tags/$TMP_TAG" &> /dev/null git reset --hard FETCH_HEAD &> /dev/null - git submodule update --init --recursive &> /dev/null + suppress_output git submodule update --init --recursive GIT_DIR="$DOKKU_ROOT/$APP" git tag -d "$TMP_TAG" &> /dev/null || true find -name .git -prune -exec rm -rf {} \; > /dev/null @@ -41,6 +41,21 @@ git_build_app_repo() { fi } +suppress_output() { + declare desc="suppress all output from a given command unless there is an error" + local TMP_COMMAND_OUTPUT + TMP_COMMAND_OUTPUT=$(mktemp "/tmp/${FUNCNAME[0]}.XXXX") + trap 'rm -rf "$TMP_COMMAND_OUTPUT" > /dev/null' RETURN INT TERM EXIT + + $* 2>&1 > "$TMP_COMMAND_OUTPUT" || { + local exit_code="$?" + cat "$TMP_COMMAND_OUTPUT" + return "$exit_code" + } + return 0 +} + + git_hook_cmd() { declare desc="kick off receive-app trigger from git prereceive hook" local cmd="git-hook" From 0de746da4e62dd08e437bce5f5c7eb2bd8af6251 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 13 Jan 2017 16:20:13 -0700 Subject: [PATCH 2/3] fix shellcheck issues --- plugins/git/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/functions b/plugins/git/functions index dd6ac32a2..620da1729 100755 --- a/plugins/git/functions +++ b/plugins/git/functions @@ -47,7 +47,7 @@ suppress_output() { TMP_COMMAND_OUTPUT=$(mktemp "/tmp/${FUNCNAME[0]}.XXXX") trap 'rm -rf "$TMP_COMMAND_OUTPUT" > /dev/null' RETURN INT TERM EXIT - $* 2>&1 > "$TMP_COMMAND_OUTPUT" || { + "$@" > "$TMP_COMMAND_OUTPUT" 2>&1 || { local exit_code="$?" cat "$TMP_COMMAND_OUTPUT" return "$exit_code" From 8497bd6d707f276e59dede423c7d0d062efd548a Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 14 Jan 2017 14:08:22 -0700 Subject: [PATCH 3/3] chore: remove extra newline [ci skip] --- plugins/git/functions | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/git/functions b/plugins/git/functions index 620da1729..96ce9b9aa 100755 --- a/plugins/git/functions +++ b/plugins/git/functions @@ -55,7 +55,6 @@ suppress_output() { return 0 } - git_hook_cmd() { declare desc="kick off receive-app trigger from git prereceive hook" local cmd="git-hook"