diff --git a/dokku b/dokku index b6912a8e5..067cc550e 100755 --- a/dokku +++ b/dokku @@ -188,7 +188,8 @@ execute_dokku_cmd() { set -- "$PLUGIN_CMD" "$@" fi - if [[ $PLUGIN_NAME =~ git-* ]] || [[ $PLUGIN_NAME =~ git:* ]]; then + if [[ $PLUGIN_NAME =~ git-* ]] || [[ "$PLUGIN_NAME" == "ps:rebuild" ]] || [[ "$PLUGIN_NAME" == "ps:restart" ]] || [[ "$PLUGIN_NAME" == "deploy" ]]; then + export DOKKU_REDIRECT_OUTPUT=true exec &> >(tee >(tee | logger -i -t "dokku-${DOKKU_PID}")) fi diff --git a/plugins/common/functions b/plugins/common/functions index 5bcec750a..27102fc27 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -626,6 +626,11 @@ release_and_deploy() { declare desc="main function for releasing and deploying an app" source "$PLUGIN_AVAILABLE_PATH/config/functions" + if [[ "$DOKKU_REDIRECT_OUTPUT" != "true" ]]; then + export DOKKU_REDIRECT_OUTPUT=true + exec &> >(tee >(tee | logger -i -t "dokku-${DOKKU_PID}")) + fi + local APP="$1" local IMAGE_TAG="${2:-latest}" local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG") diff --git a/plugins/git/internal-functions b/plugins/git/internal-functions index 4ef9e1272..30634839b 100755 --- a/plugins/git/internal-functions +++ b/plugins/git/internal-functions @@ -52,6 +52,10 @@ cmd-git-from-archive() { dokku_log_fail "Invalid archive type specified, valid archive types include: tar, tar.gz, zip" fi + if [[ "$DOKKU_REDIRECT_OUTPUT" != "true" ]]; then + export DOKKU_REDIRECT_OUTPUT=true + exec &> >(tee >(tee | logger -i -t "dokku-${DOKKU_PID}")) + fi plugn trigger git-from-archive "$APP" "$ARCHIVE_URL" "$ARCHIVE_TYPE" "$USER_NAME" "$USER_EMAIL" plugn trigger deploy-source-set "$APP" "$ARCHIVE_TYPE" "$ARCHIVE_URL" } @@ -162,6 +166,10 @@ cmd-git-load-image() { [[ -z "$DOCKER_IMAGE" ]] && dokku_log_fail "Please specify a docker image" [[ ! -t 0 ]] || dokku_log_fail "Expecting tar archive containing docker image on STDIN" + if [[ "$DOKKU_REDIRECT_OUTPUT" != "true" ]]; then + export DOKKU_REDIRECT_OUTPUT=true + exec &> >(tee >(tee | logger -i -t "dokku-${DOKKU_PID}")) + fi cat | docker load if ! verify_image "$DOCKER_IMAGE"; then @@ -215,6 +223,11 @@ cmd-git-from-image() { export DOKKU_APPS_FORCE_DELETE=1 fi + if [[ "$DOKKU_REDIRECT_OUTPUT" != "true" ]]; then + export DOKKU_REDIRECT_OUTPUT=true + exec &> >(tee >(tee | logger -i -t "dokku-${DOKKU_PID}")) + fi + if ! plugn trigger git-from-image "$APP" "$DOCKER_IMAGE" "$BUILD_DIR" "$USER_NAME" "$USER_EMAIL"; then return 1 fi @@ -263,6 +276,11 @@ cmd-git-sync() { DOKKU_DEPLOY_BRANCH="$(fn-git-deploy-branch "$APP")" CURRENT_REF="$(fn-git-cmd "$APP_ROOT" rev-parse "$DOKKU_DEPLOY_BRANCH" 2>/dev/null || true)" + if [[ "$DOKKU_REDIRECT_OUTPUT" != "true" ]]; then + export DOKKU_REDIRECT_OUTPUT=true + exec &> >(tee >(tee | logger -i -t "dokku-${DOKKU_PID}")) + fi + if ! fn-git-cmd "$APP_ROOT" rev-parse "$DOKKU_DEPLOY_BRANCH" &>/dev/null; then dokku_log_info1_quiet "Cloning $APP from $GIT_REMOTE#$GIT_REF" fn-git-clone "$APP" "$GIT_REMOTE" "$GIT_REF" "$SKIP_DEPLOY_BRANCH" diff --git a/plugins/git/receive-app b/plugins/git/receive-app index ef7f59af1..78821f835 100755 --- a/plugins/git/receive-app +++ b/plugins/git/receive-app @@ -7,6 +7,11 @@ trigger-git-receive-app() { declare desc="builds the app from the local git repository" declare trigger="receive-app" + if [[ "$DOKKU_REDIRECT_OUTPUT" != "true" ]]; then + export DOKKU_REDIRECT_OUTPUT=true + exec &> >(tee >(tee | logger -i -t "dokku-${DOKKU_PID}")) + fi + git_receive_app "$@" return $? }