fix: respect quoting in procfile commands
Procfile commands for the `docker-local` scheduler were split differently on deploy and on `dokku run`. Deploys failed on escaped quotes, and `dokku run` ignored quotes entirely. Both now split commands using shell quoting rules, and commands containing bare shell operators fail with a clear error, matching the `k3s` scheduler.
This commit is contained in:
@@ -65,12 +65,15 @@ main() {
|
||||
|
||||
START_CMD=$(fn-scheduler-docker-local-extract-start-cmd "$APP" "$PROC_TYPE" "$START_CMD" "$DOKKU_HEROKUISH" "$DOKKU_PORT")
|
||||
DOCKER_ARGS+=" $IMAGE"
|
||||
DOCKER_ARGS+=" $START_CMD"
|
||||
fn-split-command "$START_CMD" >/dev/null
|
||||
|
||||
declare -a ARG_ARRAY=()
|
||||
while IFS= read -r -d '' arg; do
|
||||
ARG_ARRAY+=("$arg")
|
||||
done < <(fn-docker-args-split "$DOCKER_ARGS")
|
||||
while IFS= read -r -d '' arg; do
|
||||
ARG_ARRAY+=("$arg")
|
||||
done < <(fn-split-command "$START_CMD")
|
||||
cid=$(fn-scheduler-docker-local-start-app-container "$APP" "${ARG_ARRAY[@]}")
|
||||
|
||||
plugn trigger post-container-create "app" "$cid" "$APP" "deploy" "$PROC_TYPE"
|
||||
|
||||
@@ -111,7 +111,11 @@ trigger-scheduler-docker-local-scheduler-run() {
|
||||
if [[ -n "$PROC_CMD" ]]; then
|
||||
dokku_log_info1_quiet "Found '$POTENTIAL_PROCFILE_KEY' in Procfile, running that command"
|
||||
DOCKER_ARGS+=" --label=com.dokku.process-type=$POTENTIAL_PROCFILE_KEY"
|
||||
read -ra proc_array <<<"$PROC_CMD"
|
||||
fn-split-command "$PROC_CMD" >/dev/null
|
||||
local -a proc_array=()
|
||||
while IFS= read -r -d '' arg; do
|
||||
proc_array+=("$arg")
|
||||
done < <(fn-split-command "$PROC_CMD")
|
||||
set -- "${proc_array[@]}" "${@:2}"
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user