diff --git a/Dockerfile-alpine3.10 b/Dockerfile-alpine3.10 index 1b7aec02..f6b64dec 100644 --- a/Dockerfile-alpine3.10 +++ b/Dockerfile-alpine3.10 @@ -32,7 +32,7 @@ RUN CGO_ENABLED=1 \ # build final image FROM alpine:3.10 -RUN apk --no-cache add ca-certificates jq bash && \ +RUN apk --no-cache add ca-certificates jq bash sed && \ wget https://storage.googleapis.com/kubernetes-release/release/v1.17.4/bin/linux/amd64/kubectl -O /bin/kubectl && \ chmod +x /bin/kubectl && \ mkdir /hooks diff --git a/Dockerfile-alpine3.11 b/Dockerfile-alpine3.11 index b69b78d6..464b06a5 100644 --- a/Dockerfile-alpine3.11 +++ b/Dockerfile-alpine3.11 @@ -32,7 +32,7 @@ RUN CGO_ENABLED=1 \ # build final image FROM alpine:3.11 -RUN apk --no-cache add ca-certificates jq bash && \ +RUN apk --no-cache add ca-certificates jq bash sed && \ wget https://storage.googleapis.com/kubernetes-release/release/v1.17.4/bin/linux/amd64/kubectl -O /bin/kubectl && \ chmod +x /bin/kubectl && \ mkdir /hooks diff --git a/Dockerfile-alpine3.9 b/Dockerfile-alpine3.9 index b776d528..920d1df3 100644 --- a/Dockerfile-alpine3.9 +++ b/Dockerfile-alpine3.9 @@ -32,7 +32,7 @@ RUN CGO_ENABLED=1 \ # build final image FROM alpine:3.9 -RUN apk --no-cache add ca-certificates jq bash && \ +RUN apk --no-cache add ca-certificates jq bash sed && \ wget https://storage.googleapis.com/kubernetes-release/release/v1.17.4/bin/linux/amd64/kubectl -O /bin/kubectl && \ chmod +x /bin/kubectl && \ mkdir /hooks diff --git a/frameworks/shell/context.sh b/frameworks/shell/context.sh index a80d0f9c..e40b3b0f 100644 --- a/frameworks/shell/context.sh +++ b/frameworks/shell/context.sh @@ -68,7 +68,7 @@ function context::_convert_user_path_to_jq_path() { # loop3 — convert array addresation from myArray.0 to myArray[0] # loop4 — return original dots from ##DOT##, i.e. aaa."bb##DOT##bb".cc -> aa."bb.bb".cc - jqPath=".$(sed -r \ + jqPath=".$(sed -E \ -e s/\'/\"/g \ -e ':loop1' -e 's/"([^".]+)\.([^"]+)"/"\1##DOT##\2"/g' -e 't loop1' \ -e ':loop2' -e 's/(^|\.)([^."]*-[^."]*)(\.|$)/\1"\2"\3/g' -e 't loop2' \ @@ -81,16 +81,16 @@ function context::_convert_user_path_to_jq_path() { function context::_dirname() { # loop1 — hide dots in keys, i.e. aaa."bb.bb".ccc -> aaa."bb##DOT##bb".cc - splittable_path="$(sed -r -e s/\'/\"/g -e ':loop1' -e 's/"([^".]+)\.([^"]+)"/"\1##DOT##\2"/g' -e 't loop1' <<< ${1:-})" + splittable_path="$(sed -E -e s/\'/\"/g -e ':loop1' -e 's/"([^".]+)\.([^"]+)"/"\1##DOT##\2"/g' -e 't loop1' <<< ${1:-})" # loop2 — return original dots from ##DOT##, i.e. aaa."bb##DOT##bb".cc -> aa."bb.bb".cc - rev <<< "${splittable_path}" | cut -d. -f2- | rev | sed -r -e ':loop2' -e 's/(^|\.)"([^"]+)##DOT##([^"]+)"(\.|$)/\1"\2.\3"\4/g' -e 't loop2' + rev <<< "${splittable_path}" | cut -d. -f2- | rev | sed -E -e ':loop2' -e 's/(^|\.)"([^"]+)##DOT##([^"]+)"(\.|$)/\1"\2.\3"\4/g' -e 't loop2' } function context::_basename() { # loop1 — hide dots in keys, i.e. aaa."bb.bb".ccc -> aaa."bb##DOT##bb".cc - splittable_path="$(sed -r -e s/\'/\"/g -e ':loop1' -e 's/"([^".]+)\.([^"]+)"/"\1##DOT##\2"/g' -e 't loop1' <<< ${1:-})" + splittable_path="$(sed -E -e s/\'/\"/g -e ':loop1' -e 's/"([^".]+)\.([^"]+)"/"\1##DOT##\2"/g' -e 't loop1' <<< ${1:-})" # loop2 — return original dots from ##DOT##, i.e. "bb##DOT##bb" -> bb.bb - rev <<< "${splittable_path}" | cut -d. -f1 | rev | sed -r -e ':loop2' -e 's/^"([^"]+)##DOT##([^"]+)"$/\1.\2/g' -e 't loop2' + rev <<< "${splittable_path}" | cut -d. -f1 | rev | sed -E -e ':loop2' -e 's/^"([^"]+)##DOT##([^"]+)"$/\1.\2/g' -e 't loop2' } diff --git a/frameworks/shell/hook.sh b/frameworks/shell/hook.sh index 9a1927d7..d8902b5b 100644 --- a/frameworks/shell/hook.sh +++ b/frameworks/shell/hook.sh @@ -58,6 +58,6 @@ function hook::_run_first_available_handler() { fi done - >&2 printf "ERROR: Can't find any handler from the list: %s\n." "$(echo ${HANDLERS} | sed -re 's/\s+/, /g')" + >&2 printf "ERROR: Can't find any handler from the list: %s\n." "$(echo ${HANDLERS} | sed -E 's/[[:space:]]+/, /g')" return 1 }