Skip to content

Commit

Permalink
Fix issue with spaces on extra_build_args (#362)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
marboledacci authored Oct 23, 2024
1 parent e76d2fe commit 07beee9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ workflows:
path: workspace
extra_build_args: >-
--build-arg NPM_TOKEN=${NPM_TOKEN}
--build-arg=${CIRCLE_SHA1:0:7}
--build-arg ${CIRCLE_SHA1:0:7}
--build-arg=TEST='This is a test'
set_repo_policy: true
repo_policy_path: ./sample/repo-policy.json
executor: amd64
Expand Down
1 change: 0 additions & 1 deletion src/executors/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ parameters:
machine:
image: <<parameters.image>>
docker_layer_caching: <<parameters.docker_layer_caching>>

resource_class: <<parameters.resource_class>>
6 changes: 5 additions & 1 deletion src/scripts/docker_buildx.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash

AWS_ECR_EVAL_REGION="$(eval echo "${AWS_ECR_STR_REGION}")"
AWS_ECR_EVAL_REPO="$(eval echo "${AWS_ECR_STR_REPO}")"
AWS_ECR_EVAL_TAG="$(eval echo "${AWS_ECR_STR_TAG}")"
Expand All @@ -17,11 +18,14 @@ AWS_ECR_EVAL_LIFECYCLE_POLICY_PATH="$(eval echo "${AWS_ECR_STR_LIFECYCLE_POLICY_
BUILDX_NO_DEFAULT_ATTESTATIONS=1

if [ -n "${AWS_ECR_STR_EXTRA_BUILD_ARGS}" ]; then
IFS=" " read -a args -r <<<"${AWS_ECR_STR_EXTRA_BUILD_ARGS[@]}"
args=()
# shellcheck disable=SC2086
eval 'for p in '$AWS_ECR_STR_EXTRA_BUILD_ARGS'; do args+=("$p"); done'
for arg in "${args[@]}"; do
set -- "$@" "$arg"
done
fi

ECR_COMMAND="ecr"
number_of_tags_in_ecr=0

Expand Down

0 comments on commit 07beee9

Please sign in to comment.