feat: redirect output in every case as appropriate

This commit is contained in:
Jose Diaz-Gonzalez
2024-03-14 10:34:08 -04:00
parent 7d00e2c422
commit aa72794711
4 changed files with 30 additions and 1 deletions

3
dokku
View File

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

View File

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

View File

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

View File

@@ -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 $?
}