mirror of
https://github.com/dokku/dokku.git
synced 2025-12-16 12:07:45 +01:00
feat: implement builds:output
This still needs tightening to ensure we don't trigger this for normal git plugin commands - as well as anything that triggers a deploy - but works in a pinch.
This commit is contained in:
4
dokku
4
dokku
@@ -188,6 +188,10 @@ execute_dokku_cmd() {
|
|||||||
set -- "$PLUGIN_CMD" "$@"
|
set -- "$PLUGIN_CMD" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ $PLUGIN_NAME =~ git-* ]] || [[ $PLUGIN_NAME =~ git:* ]]; then
|
||||||
|
exec &> >(tee >(tee | logger -i -t "dokku-${DOKKU_PID}"))
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -x $PLUGIN_ENABLED_PATH/$PLUGIN_NAME/subcommands/default ]]; then
|
if [[ -x $PLUGIN_ENABLED_PATH/$PLUGIN_NAME/subcommands/default ]]; then
|
||||||
"$PLUGIN_ENABLED_PATH/$PLUGIN_NAME/subcommands/default" "$@"
|
"$PLUGIN_ENABLED_PATH/$PLUGIN_NAME/subcommands/default" "$@"
|
||||||
implemented=1
|
implemented=1
|
||||||
|
|||||||
@@ -34,4 +34,4 @@ cmd-builds-cancel() {
|
|||||||
kill -quit -- "-${PROCESS_GROUP_ID}" && rm -f "$APP_DEPLOY_LOCK_FILE"
|
kill -quit -- "-${PROCESS_GROUP_ID}" && rm -f "$APP_DEPLOY_LOCK_FILE"
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd-builds-cancel "$@"
|
cmd-builds-cancel "$@"
|
||||||
|
|||||||
@@ -7,20 +7,33 @@ cmd-builds-output() {
|
|||||||
declare desc="shows build output"
|
declare desc="shows build output"
|
||||||
declare cmd="builds:output"
|
declare cmd="builds:output"
|
||||||
[[ "$1" == "$cmd" ]] && shift 1
|
[[ "$1" == "$cmd" ]] && shift 1
|
||||||
declare APP="$1"
|
declare APP="$1" DEPLOY_ID="$2"
|
||||||
verify_app_name "$APP"
|
verify_app_name "$APP"
|
||||||
|
|
||||||
local APP_DEPLOY_LOCK_FILE PROCESS_ID
|
if [[ -z "$DEPLOY_ID" ]] || [[ "$DEPLOY_ID" == "current" ]]; then
|
||||||
APP_DEPLOY_LOCK_FILE="$DOKKU_ROOT/$APP/.deploy.lock"
|
local APP_DEPLOY_LOCK_FILE PROCESS_ID
|
||||||
if [[ ! -f "$APP_DEPLOY_LOCK_FILE" ]]; then
|
APP_DEPLOY_LOCK_FILE="$DOKKU_ROOT/$APP/.deploy.lock"
|
||||||
dokku_log_info1 "No matching app deploy found"
|
if [[ ! -f "$APP_DEPLOY_LOCK_FILE" ]]; then
|
||||||
return
|
dokku_log_info1 "App not currently deploying"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
DEPLOY_ID="$(cat "$APP_DEPLOY_LOCK_FILE")"
|
||||||
|
if [[ -z "$DEPLOY_ID" ]]; then
|
||||||
|
dokku_log_info1 "No matching app deploy found"
|
||||||
|
return
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PROCESS_ID="$(cat "$APP_DEPLOY_LOCK_FILE")"
|
if [[ -z "$DEPLOY_ID" ]]; then
|
||||||
if [[ -z "$PROCESS_ID" ]]; then
|
dokku_log_fail "No deploy id specified"
|
||||||
dokku_log_info1 "No matching app deploy found"
|
return 1
|
||||||
return
|
fi
|
||||||
|
|
||||||
|
if [[ -x /usr/bin/systemctl ]] || [[ -x /usr/local/bin/systemctl ]]; then
|
||||||
|
journalctl -n1000 -f -b -a -o cat "SYSLOG_IDENTIFIER=dokku-${DEPLOY_ID}"
|
||||||
|
else
|
||||||
|
grep "dokku-${DEPLOY_ID}" /var/log/syslog
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user