Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile-alpine3.10
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-alpine3.11
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-alpine3.9
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions frameworks/shell/context.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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' \
Expand All @@ -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'
}
2 changes: 1 addition & 1 deletion frameworks/shell/hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}