strip inline comments from CHECKS and Procfile. closes #2044
This commit is contained in:
@@ -20,13 +20,13 @@ dokku_deploy_cmd() {
|
||||
local DOKKU_DEFAULT_DOCKER_ARGS=$(: | plugn trigger docker-args-deploy "$APP" "$IMAGE_TAG")
|
||||
local DOKKU_IS_APP_PROXY_ENABLED="$(is_app_proxy_enabled "$APP")"
|
||||
|
||||
local line
|
||||
local line; local PROC_TYPE; local PROC_COUNT; local CONTAINER_INDEX
|
||||
while read -r line || [[ -n "$line" ]]; do
|
||||
[[ "$line" =~ ^#.* ]] && continue
|
||||
local TRIM=${line%#*}
|
||||
local PROC_TYPE=${TRIM%%=*}
|
||||
local PROC_COUNT=${TRIM#*=}
|
||||
local CONTAINER_INDEX=1
|
||||
line="$(strip_inline_comments "$line")"
|
||||
PROC_TYPE=${line%%=*}
|
||||
PROC_COUNT=${line#*=}
|
||||
CONTAINER_INDEX=1
|
||||
|
||||
while [[ $CONTAINER_INDEX -le $PROC_COUNT ]]; do
|
||||
local id=""; local port=""; local ipaddr=""
|
||||
|
||||
@@ -125,13 +125,13 @@ checks_check_deploy() {
|
||||
|
||||
# Reads name/value pairs, sets the WAIT and TIMEOUT variables
|
||||
exec < "$FILENAME"
|
||||
local LINE
|
||||
while read -r LINE; do
|
||||
local line; local NAME; local VALUE
|
||||
while read -r line; do
|
||||
line=$(strip_inline_comments "$line")
|
||||
# Name/value pair
|
||||
if [[ "$LINE" =~ ^.+= ]]; then
|
||||
local TRIM=${LINE%#*}
|
||||
local NAME=${TRIM%=*}
|
||||
local VALUE=${TRIM#*=}
|
||||
if [[ "$line" =~ ^.+= ]]; then
|
||||
NAME=${TRIM%=*}
|
||||
VALUE=${TRIM#*=}
|
||||
[[ "$NAME" = "WAIT" ]] && local WAIT=$VALUE
|
||||
[[ "$NAME" = "TIMEOUT" ]] && local TIMEOUT=$VALUE
|
||||
[[ "$NAME" = "ATTEMPTS" ]] && local ATTEMPTS=$VALUE
|
||||
|
||||
@@ -311,16 +311,17 @@ get_app_running_container_ids() {
|
||||
get_cmd_from_procfile() {
|
||||
declare desc="parse cmd from app Procfile"
|
||||
local APP=$1; local PROC_TYPE=$2; local DOKKU_PROCFILE="$DOKKU_ROOT/$APP/DOKKU_PROCFILE"
|
||||
local name; local command;
|
||||
verify_app_name "$APP"
|
||||
|
||||
if [[ -f $DOKKU_PROCFILE ]]; then
|
||||
local line; local name; local command
|
||||
while read line || [[ -n "$line" ]]; do
|
||||
if [[ -z "$line" ]] || [[ "$line" == "#"* ]]; then
|
||||
continue
|
||||
fi
|
||||
local name="${line%%:*}"
|
||||
local command="${line#*:[[:space:]]}"
|
||||
line=$(strip_inline_comments "$line")
|
||||
name="${line%%:*}"
|
||||
command="${line#*:[[:space:]]}"
|
||||
[[ "$name" == "$PROC_TYPE" ]] && echo "$command" && break
|
||||
done < "$DOKKU_PROCFILE"
|
||||
fi
|
||||
@@ -689,3 +690,11 @@ get_json_keys() {
|
||||
cat | python -c 'import json,sys;obj=json.load(sys.stdin);print " ".join(obj'"${JSON_NODE}"'.keys())';
|
||||
fi
|
||||
}
|
||||
|
||||
strip_inline_comments() {
|
||||
declare desc="removes bash-style comment from input line"
|
||||
local line="$1"
|
||||
local stripped_line="${line%[[:space:]]#*}"
|
||||
|
||||
echo "$stripped_line"
|
||||
}
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
WAIT=2 # wait 2 seconds
|
||||
TIMEOUT=5 # set timeout to 5 seconds
|
||||
ATTEMPTS=2 # try 2 times
|
||||
|
||||
/ nodejs/express
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
# Procfile for development using the new threaded worker (scheduler, twitter stream and delayed job)
|
||||
cron: node worker.js
|
||||
web: node web.js
|
||||
web: node web.js # testing inline comment
|
||||
worker: node worker.js
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user