fix: preserve global flags when sudo is sudo-rs
`sudo-rs`, the default sudo on Ubuntu 25.10 and later, does not support preserving the entire environment, so `--quiet`, `--trace`, `--force` and `--app` stopped taking effect once `dokku` re-executed itself as the `dokku` user, and a warning was printed on every invocation. Variables outside the set dokku forwards no longer cross that boundary and can be named in `DOKKU_PRESERVE_ENV` instead.
This commit is contained in:
14 files changed
+403
-10
No files matched your search
@@ -1,13 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
cmd-plugin-trigger() {
|
||||
declare desc="trigger an arbitrary plugin hook"
|
||||
declare cmd="plugin:trigger"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
|
||||
sudo -u dokku -E -H plugn trigger "$@"
|
||||
local sudo_args=(-u dokku)
|
||||
local preserve_env_flag
|
||||
preserve_env_flag="$(fn-sudo-preserve-env-flag)"
|
||||
if [[ -n "$preserve_env_flag" ]]; then
|
||||
sudo_args+=("$preserve_env_flag")
|
||||
fi
|
||||
sudo_args+=(-H)
|
||||
|
||||
sudo "${sudo_args[@]}" plugn trigger "$@"
|
||||
}
|
||||
|
||||
cmd-plugin-trigger "$@"
|
||||
Reference in new issue
Block a user