fix: forward every environment-overridable dokku variable

`DOKKU_INIT_SYSTEM` reaches the `dokku` user only through the environment while the Docker image is being built, so narrowing the forwarded set left `nginx:reload` taking the systemd branch during `debian/postinst` and blocking on a sudo password prompt until the build timed out. The forwarded set now covers every variable `dokku` honours from the environment, and `DOKKU_PRESERVE_ENV` still carries anything beyond it.
This commit is contained in:
Jose Diaz-Gonzalez committed 2026-09-20 16:25:34 -04:00
1 parent 6b1b7bc6f6
commit 63e4b92a52
3 files changed
+38 -3

No files matched your search

+23
View File
@@ -164,6 +164,29 @@ teardown() {
assert_output "7"
}
@test "(common) [preserve-env] fn-cli-preserved-env-names covers the docker image build variables" {
# neither is read by the dokku script itself, so the derivation test below does not
# catch them. both exist only in the environment while the docker image is built
run /bin/bash -c "source '$PLUGIN_CORE_AVAILABLE_PATH/common/functions'; fn-cli-preserved-env-names | tr ' ' '\\n' | grep -cxE 'DOKKU_INIT_SYSTEM|DOKKU_LIB_HOST_ROOT'"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "2"
}
@test "(common) [preserve-env] every environment-overridable dokku variable is preserved" {
# test_helper leaves these unexported, so the single-quoted script below cannot see
# them without this
export PLUGIN_CORE_AVAILABLE_PATH
export DOKKU_SOURCE="${BATS_TEST_DIRNAME}/../../dokku"
run /bin/bash -c 'source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"; comm -23 <(grep -oE "[{][A-Z_]+:=" "$DOKKU_SOURCE" | tr -cd "A-Z_\n" | sort -u | grep -vx DOKKU_PID) <(fn-cli-preserved-env-names | tr " " "\n" | sort -u)'
echo "output: $output"
echo "status: $status"
assert_success
assert_output ""
unset DOKKU_SOURCE
}
@test "(common) [preserve-env] parse_args records global flags for replay" {
run /bin/bash -c "source '$PLUGIN_CORE_AVAILABLE_PATH/common/functions'; parse_args --label=a=b run foo env; echo \"\$DOKKU_GLOBAL_FLAGS\""
echo "output: $output"