Skip to content

Commit

Permalink
Merge pull request #93 from whoan/fix-json-extra-args
Browse files Browse the repository at this point in the history
Fix BUILD_EXTRA_ARGS json input
  • Loading branch information
whoan authored Mar 5, 2021
2 parents d05bc83 + 3334a1b commit 86b305a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,15 @@ _parse_extra_args() {
fi

# json
declare -gA extra_args
declare -ga extra_args
local key
local value
while read -r key; do
value=$(_remove_quotes "$(jq ".$key" <<<"${INPUT_BUILD_EXTRA_ARGS}")")
key=$(_remove_quotes "$key")
extra_args[$key]="${value//\\n/
}"
extra_args+=("$key")
extra_args+=("${value//\\n/
}")
done < <(jq "keys[]" <<<"${INPUT_BUILD_EXTRA_ARGS}")
INPUT_BUILD_EXTRA_ARGS=""
}
Expand Down Expand Up @@ -309,7 +310,7 @@ build_image() {
--tag "$DUMMY_IMAGE_NAME" \
--file "${INPUT_CONTEXT}"/"${INPUT_DOCKERFILE}" \
${INPUT_BUILD_EXTRA_ARGS} \
${extra_args[@]@K} \
"${extra_args[@]}" \
"${INPUT_CONTEXT}" | tee "$BUILD_LOG"
set +x
}
Expand Down

0 comments on commit 86b305a

Please sign in to comment.