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
This commit is contained in:
Jose Diaz-Gonzalez
2016-11-25 01:15:44 -07:00
parent 0e0012cca1
commit 13ef76127d

View File

@@ -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"