Skip to content

Commit 07beee9

Browse files
authored
Fix issue with spaces on extra_build_args (#362)
* Validate build arg with spaces * Update way to pass argss * Solve shellcheck * Solve shellcheck * Add debug * Add debug on script * Fix * Remove debug * Add more tests * Revert testsg * Revert testsg
1 parent e76d2fe commit 07beee9

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

.circleci/test-deploy.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,8 @@ workflows:
320320
path: workspace
321321
extra_build_args: >-
322322
--build-arg NPM_TOKEN=${NPM_TOKEN}
323-
--build-arg=${CIRCLE_SHA1:0:7}
323+
--build-arg ${CIRCLE_SHA1:0:7}
324+
--build-arg=TEST='This is a test'
324325
set_repo_policy: true
325326
repo_policy_path: ./sample/repo-policy.json
326327
executor: amd64

src/executors/default.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@ parameters:
1515
machine:
1616
image: <<parameters.image>>
1717
docker_layer_caching: <<parameters.docker_layer_caching>>
18-
1918
resource_class: <<parameters.resource_class>>

src/scripts/docker_buildx.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
2+
23
AWS_ECR_EVAL_REGION="$(eval echo "${AWS_ECR_STR_REGION}")"
34
AWS_ECR_EVAL_REPO="$(eval echo "${AWS_ECR_STR_REPO}")"
45
AWS_ECR_EVAL_TAG="$(eval echo "${AWS_ECR_STR_TAG}")"
@@ -17,11 +18,14 @@ AWS_ECR_EVAL_LIFECYCLE_POLICY_PATH="$(eval echo "${AWS_ECR_STR_LIFECYCLE_POLICY_
1718
BUILDX_NO_DEFAULT_ATTESTATIONS=1
1819

1920
if [ -n "${AWS_ECR_STR_EXTRA_BUILD_ARGS}" ]; then
20-
IFS=" " read -a args -r <<<"${AWS_ECR_STR_EXTRA_BUILD_ARGS[@]}"
21+
args=()
22+
# shellcheck disable=SC2086
23+
eval 'for p in '$AWS_ECR_STR_EXTRA_BUILD_ARGS'; do args+=("$p"); done'
2124
for arg in "${args[@]}"; do
2225
set -- "$@" "$arg"
2326
done
2427
fi
28+
2529
ECR_COMMAND="ecr"
2630
number_of_tags_in_ecr=0
2731

0 commit comments

Comments
 (0)