Skip to content

Commit 781f911

Browse files
authored
fix: extra build arg expansion (#310)
* ci: add addtional flag to extra_build_args * fix: separate and rebuild string to prevent single quoting * fix: sha expansion
1 parent 467eec0 commit 781f911

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

.circleci/test-deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ workflows:
184184
context: [CPE-OIDC]
185185
dockerfile: sample/Dockerfile
186186
path: workspace
187-
extra_build_args: --cache-to type=local,dest=/tmp
187+
extra_build_args: --cache-to type=local,dest=/tmp --compress
188188
push_image: false
189189
executor: amd64
190190
filters: *filters
@@ -312,7 +312,7 @@ workflows:
312312
profile_name: "OIDC-User"
313313
context: [CPE-OIDC]
314314
workspace_root: workspace
315-
repo: aws-ecr-orb-${CIRCLE_SHA1:0:7}-skip_when_tags_exist-<<matrix.executor>>
315+
repo: aws-ecr-orb-${CIRCLE_SHA1}-skip_when_tags_exist-<<matrix.executor>>
316316
tag: integration,myECRRepoTag
317317
dockerfile: sample/Dockerfile
318318
path: workspace

src/scripts/docker_buildx.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ ORB_STR_PROFILE_NAME="$(circleci env subst "${ORB_STR_PROFILE_NAME}")"
1414
ORB_STR_PLATFORM="$(circleci env subst "${ORB_STR_PLATFORM}")"
1515
ORB_STR_LIFECYCLE_POLICY_PATH="$(circleci env subst "${ORB_STR_LIFECYCLE_POLICY_PATH}")"
1616

17+
18+
if [ -n "${ORB_STR_EXTRA_BUILD_ARGS}" ]; then
19+
IFS=" " read -a args -r <<< "${ORB_STR_EXTRA_BUILD_ARGS[@]}"
20+
for arg in "${args[@]}"; do
21+
set -- "$@" "$arg"
22+
done
23+
fi
1724
ECR_COMMAND="ecr"
1825
number_of_tags_in_ecr=0
1926

@@ -80,7 +87,6 @@ set -x
8087
${docker_tag_args:+$docker_tag_args} \
8188
--platform "${ORB_STR_PLATFORM}" \
8289
--progress plain \
83-
${ORB_STR_EXTRA_BUILD_ARGS:+$ORB_STR_EXTRA_BUILD_ARGS} \
8490
"$@" \
8591
"${ORB_EVAL_BUILD_PATH}"
8692
set +x

0 commit comments

Comments
 (0)