Skip to content

Commit 1d120cb

Browse files
Only install ecr-credential-helper when not already installed (#349)
* apt update less often in ecr_login.sh --------- Co-authored-by: Ryan Good <[email protected]>
1 parent 4d02c82 commit 1d120cb

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

.circleci/test-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,4 +386,4 @@ executors:
386386
machine:
387387
image: ubuntu-2204:current
388388
docker_layer_caching: true
389-
resource_class: arm.medium
389+
resource_class: arm.medium

src/scripts/ecr_login.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,17 @@ configure_config_json(){
4747
install_aws_ecr_credential_helper(){
4848
echo "Installing AWS ECR Credential Helper..."
4949
if [[ "$SYS_ENV_PLATFORM" = "linux" ]]; then
50-
$SUDO apt update
51-
$SUDO apt install amazon-ecr-credential-helper
50+
HELPER_INSTALLED=$(dpkg --get-selections | (grep amazon-ecr-credential-helper || test $?) | awk '{print $2}')
51+
if [[ "$HELPER_INSTALLED" != "install" ]]; then
52+
$SUDO apt update
53+
$SUDO apt install amazon-ecr-credential-helper
54+
fi
5255
configure_config_json
5356
elif [[ "$SYS_ENV_PLATFORM" = "macos" ]]; then
54-
brew install docker-credential-helper-ecr
57+
HELPER_INSTALLED=$(brew list -q | grep -q docker-credential-helper-ecr || test $?)
58+
if [[ "$HELPER_INSTALLED" -ne 0 ]]; then
59+
brew install docker-credential-helper-ecr
60+
fi
5561
configure_config_json
5662
else
5763
docker logout "${AWS_ECR_VAL_ACCOUNT_URL}"

0 commit comments

Comments
 (0)