mirror of
https://github.com/dokku/dokku.git
synced 2026-08-29 10:08:53 +02:00
fix: separate docker-args outputs to avoid arg collisions
Emitting the restart policy as a `--restart` argument from a `docker-args-process-deploy` trigger exposed a latent gluing bug: proxy and builder triggers concatenated `$STDIN$output` with no separator, and the scheduler and builders appended `docker-args-process-*` output directly onto the older `docker-args-*` output, so adjacent arguments could merge into values like `--restart=on-failure:10--label`. A space is now inserted at both the trigger echo and the concatenation so arguments always stay separated.
This commit is contained in:
@@ -33,7 +33,7 @@ trigger-builder-dockerfile-builder-build() {
|
||||
plugn trigger pre-build "$BUILDER_TYPE" "$APP" "$SOURCECODE_WORK_DIR"
|
||||
|
||||
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$BUILDER_TYPE")
|
||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-build "$APP" "$BUILDER_TYPE")
|
||||
DOCKER_ARGS+=" $(: | plugn trigger docker-args-process-build "$APP" "$BUILDER_TYPE")"
|
||||
DOCKER_ARGS+=" $DOKKU_GLOBAL_BUILD_ARGS"
|
||||
|
||||
DOCKER_ARGS=" $DOCKER_ARGS "
|
||||
|
||||
@@ -69,7 +69,7 @@ trigger-builder-herokuish-builder-build() {
|
||||
DOCKER_ARGS+=" --env=TRACE=true "
|
||||
DOCKER_ARGS+=" --env=BUILDPACK_XTRACE=1 "
|
||||
fi
|
||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-build "$APP" "$BUILDER_TYPE")
|
||||
DOCKER_ARGS+=" $(: | plugn trigger docker-args-process-build "$APP" "$BUILDER_TYPE")"
|
||||
|
||||
declare -a ARG_ARRAY
|
||||
eval "ARG_ARRAY=($DOCKER_ARGS)"
|
||||
|
||||
@@ -34,7 +34,7 @@ trigger-builder-nixpacks-builder-build() {
|
||||
fi
|
||||
|
||||
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$BUILDER_TYPE")
|
||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-build "$APP" "$BUILDER_TYPE")
|
||||
DOCKER_ARGS+=" $(: | plugn trigger docker-args-process-build "$APP" "$BUILDER_TYPE")"
|
||||
DOCKER_ARGS+=" $DOKKU_GLOBAL_BUILD_ARGS"
|
||||
|
||||
DOCKER_ARGS=" $DOCKER_ARGS "
|
||||
|
||||
@@ -38,7 +38,7 @@ trigger-builder-pack-builder-build() {
|
||||
plugn trigger pre-build "$BUILDER_TYPE" "$APP" "$SOURCECODE_WORK_DIR"
|
||||
|
||||
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$BUILDER_TYPE")
|
||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-build "$APP" "$BUILDER_TYPE")
|
||||
DOCKER_ARGS+=" $(: | plugn trigger docker-args-process-build "$APP" "$BUILDER_TYPE")"
|
||||
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" --env=TRACE=true "
|
||||
|
||||
DOCKER_ARGS=" $DOCKER_ARGS "
|
||||
|
||||
@@ -23,7 +23,7 @@ trigger-builder-pack-docker-args-process-deploy() {
|
||||
output=" --entrypoint launcher"
|
||||
fi
|
||||
|
||||
echo -n "$STDIN$output"
|
||||
echo -n "$STDIN $output"
|
||||
}
|
||||
|
||||
trigger-builder-pack-docker-args-process-deploy "$@"
|
||||
|
||||
@@ -34,7 +34,7 @@ trigger-builder-railpack-builder-build() {
|
||||
fi
|
||||
|
||||
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$BUILDER_TYPE")
|
||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-build "$APP" "$BUILDER_TYPE")
|
||||
DOCKER_ARGS+=" $(: | plugn trigger docker-args-process-build "$APP" "$BUILDER_TYPE")"
|
||||
|
||||
DOCKER_ARGS=" $DOCKER_ARGS "
|
||||
eval set -- "$DOCKER_ARGS"
|
||||
|
||||
@@ -137,7 +137,7 @@ trigger-caddy-vhosts-docker-args-process-deploy() {
|
||||
done <"$proxy_labels_file_path"
|
||||
fi
|
||||
|
||||
echo -n "$STDIN$output"
|
||||
echo -n "$STDIN $output"
|
||||
}
|
||||
|
||||
trigger-caddy-vhosts-docker-args-process-deploy "$@"
|
||||
|
||||
@@ -132,7 +132,7 @@ trigger-haproxy-vhosts-docker-args-process-deploy() {
|
||||
done <"$proxy_labels_file_path"
|
||||
fi
|
||||
|
||||
echo -n "$STDIN$output"
|
||||
echo -n "$STDIN $output"
|
||||
}
|
||||
|
||||
trigger-haproxy-vhosts-docker-args-process-deploy "$@"
|
||||
|
||||
@@ -214,7 +214,7 @@ trigger-openresty-vhosts-docker-args-process-deploy() {
|
||||
done <"$proxy_labels_file_path"
|
||||
fi
|
||||
|
||||
echo -n "$STDIN$output"
|
||||
echo -n "$STDIN $output"
|
||||
}
|
||||
|
||||
trigger-openresty-vhosts-docker-args-process-deploy "$@"
|
||||
|
||||
@@ -53,7 +53,7 @@ fn-scheduler-deploy-process() {
|
||||
|
||||
local DOCKER_ARGS
|
||||
DOCKER_ARGS=$(: | plugn trigger docker-args-deploy "$APP" "$IMAGE_TAG" "$PROC_TYPE")
|
||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-deploy "$APP" "$IMAGE_SOURCE_TYPE" "$IMAGE_TAG" "$PROC_TYPE")
|
||||
DOCKER_ARGS+=" $(: | plugn trigger docker-args-process-deploy "$APP" "$IMAGE_SOURCE_TYPE" "$IMAGE_TAG" "$PROC_TYPE")"
|
||||
DOCKER_ARGS=" $DOCKER_ARGS "
|
||||
declare -a ARG_ARRAY
|
||||
eval "ARG_ARRAY=($DOCKER_ARGS)"
|
||||
|
||||
@@ -24,7 +24,7 @@ main() {
|
||||
DOCKER_ARGS+=" --init"
|
||||
fi
|
||||
DOCKER_ARGS+=" $DOCKER_RUN_LABEL_ARGS $DOKKU_GLOBAL_RUN_ARGS "
|
||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-deploy "$APP" "$IMAGE_SOURCE_TYPE" "$IMAGE_TAG" "$PROC_TYPE" "$CONTAINER_INDEX")
|
||||
DOCKER_ARGS+=" $(: | plugn trigger docker-args-process-deploy "$APP" "$IMAGE_SOURCE_TYPE" "$IMAGE_TAG" "$PROC_TYPE" "$CONTAINER_INDEX")"
|
||||
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" --env=TRACE=true"
|
||||
|
||||
local START_CMD
|
||||
|
||||
@@ -74,7 +74,7 @@ trigger-scheduler-docker-local-scheduler-run() {
|
||||
local IMAGE_SOURCE_TYPE="dockerfile"
|
||||
is_image_herokuish_based "$IMAGE" "$APP" && IMAGE_SOURCE_TYPE="herokuish"
|
||||
is_image_cnb_based "$IMAGE" && IMAGE_SOURCE_TYPE="pack"
|
||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-run "$APP" "$IMAGE_SOURCE_TYPE" "$IMAGE_TAG")
|
||||
DOCKER_ARGS+=" $(: | plugn trigger docker-args-process-run "$APP" "$IMAGE_SOURCE_TYPE" "$IMAGE_TAG")"
|
||||
DOCKER_ARGS+=" -e DYNO=$PROCESS_TYPE.$DYNO_NUMBER --name $APP.$PROCESS_TYPE.$DYNO_NUMBER"
|
||||
|
||||
if [[ "$DOKKU_RM_CONTAINER" ]]; then
|
||||
|
||||
@@ -166,7 +166,7 @@ trigger-traefik-vhosts-docker-args-process-deploy() {
|
||||
done <"$proxy_labels_file_path"
|
||||
fi
|
||||
|
||||
echo -n "$STDIN$output"
|
||||
echo -n "$STDIN $output"
|
||||
}
|
||||
|
||||
trigger-traefik-vhosts-docker-args-process-deploy "$@"
|
||||
|
||||
@@ -803,7 +803,7 @@ teardown() {
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "--log-opt=max-size=20m"
|
||||
assert_output "--log-opt=max-size=20m --restart=on-failure:10"
|
||||
|
||||
DRIVER="journald" jq '."log-driver" = env.DRIVER' <"/etc/docker/daemon.json" >"$TMP_FILE"
|
||||
mv "$TMP_FILE" /etc/docker/daemon.json
|
||||
@@ -820,7 +820,7 @@ teardown() {
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_not_exists
|
||||
assert_output "--restart=on-failure:10"
|
||||
|
||||
if [[ "$driver" = "null" ]]; then
|
||||
DRIVER="$driver" jq 'del(."log-driver")' <"/etc/docker/daemon.json" >"$TMP_FILE"
|
||||
@@ -841,7 +841,7 @@ teardown() {
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "--log-opt=max-size=20m"
|
||||
assert_output "--log-opt=max-size=20m --restart=on-failure:10"
|
||||
}
|
||||
|
||||
@test "(logs) logs:set max-size with alternate log-driver" {
|
||||
@@ -860,7 +860,7 @@ teardown() {
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "--log-opt=max-size=20m"
|
||||
assert_output "--log-opt=max-size=20m --restart=on-failure:10"
|
||||
|
||||
run /bin/bash -c "dokku docker-options:add $TEST_APP deploy --log-driver=local" 2>&1
|
||||
echo "output: $output"
|
||||
@@ -871,7 +871,7 @@ teardown() {
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "--log-opt=max-size=20m"
|
||||
assert_output "--log-opt=max-size=20m --restart=on-failure:10"
|
||||
|
||||
run /bin/bash -c "dokku docker-options:add $TEST_APP deploy --log-driver=json-file" 2>&1
|
||||
echo "output: $output"
|
||||
@@ -882,18 +882,18 @@ teardown() {
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "--log-opt=max-size=20m"
|
||||
assert_output "--log-opt=max-size=20m --restart=on-failure:10"
|
||||
|
||||
run /bin/bash -c "dokku docker-options:add $TEST_APP deploy --log-driver=journald" 2>&1
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "echo "" | dokku plugin:trigger docker-args-process-deploy $TEST_APP 2>&1"
|
||||
run /bin/bash -c "echo "" | dokku plugin:trigger docker-args-process-deploy $TEST_APP 2>&1 | xargs"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_not_exists
|
||||
assert_output "--restart=on-failure:10"
|
||||
}
|
||||
|
||||
@test "(logs) logs:vector" {
|
||||
|
||||
Reference in New Issue
Block a user