Skip to content

Commit 683c5b2

Browse files
brivuEricRibeiro
andauthored
fix: --cache-to flag not working (#293)
* fix: create builder instance if default is used * ci: add test for --cache-to flag * test: try multiline arguments * fix: set push_image to false * refactor: Update src/scripts/docker_buildx.sh Co-authored-by: Eric Ribeiro <[email protected]> --------- Co-authored-by: Eric Ribeiro <[email protected]>
1 parent fb91802 commit 683c5b2

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

.circleci/test-deploy.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,22 @@ workflows:
172172
platform: linux/amd64,linux/arm64
173173
filters: *filters
174174
requires: [pre-integration]
175+
- aws-ecr/build_and_push_image:
176+
name: integration-test-cache-to-flag
177+
auth:
178+
- aws-cli/setup:
179+
role_arn: arn:aws:iam::122211685980:role/CPE_ECR_OIDC_TEST
180+
attach_workspace: true
181+
workspace_root: workspace
182+
repo: aws-ecr-orb-${CIRCLE_SHA1:0:7}-cache-to-flag
183+
context: [CPE-OIDC]
184+
dockerfile: sample/Dockerfile
185+
path: workspace
186+
extra_build_args: --cache-to type=local,dest=/tmp
187+
push_image: false
188+
executor: amd64
189+
filters: *filters
190+
requires: [pre-integration]
175191
- aws-ecr/build_and_push_image:
176192
name: integration-test-pubic-registry
177193
auth:
@@ -218,7 +234,9 @@ workflows:
218234
tag: integration,myECRRepoTag
219235
dockerfile: sample/Dockerfile
220236
path: workspace
221-
extra_build_args: '--build-arg NPM_TOKEN=${NPM_TOKEN} --build-arg=${CIRCLE_SHA1:0:7}'
237+
extra_build_args: >-
238+
--build-arg NPM_TOKEN=${NPM_TOKEN}
239+
--build-arg=${CIRCLE_SHA1:0:7}
222240
set_repo_policy: true
223241
repo_policy_path: ./sample/repo-policy.json
224242
executor: amd64

src/scripts/docker_buildx.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ if [ "${ORB_BOOL_SKIP_WHEN_TAGS_EXIST}" -eq "0" ] || [[ "${ORB_BOOL_SKIP_WHEN_TA
6666
docker --context builder buildx create --name DLC_builder --use
6767
fi
6868
context_args="--context builder"
69+
# if no builder instance is currently used, create one
70+
elif ! docker buildx inspect | grep -q "default * docker"; then
71+
docker buildx create --use
6972
fi
7073

7174
set -x

0 commit comments

Comments
 (0)