Skip to content

Commit

Permalink
Only install ecr-credential-helper when not already installed (#349)
Browse files Browse the repository at this point in the history
* apt update less often in ecr_login.sh

---------

Co-authored-by: Ryan Good <[email protected]>
  • Loading branch information
zaki-arain and ryandgood authored Aug 6, 2024
1 parent 4d02c82 commit 1d120cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -386,4 +386,4 @@ executors:
machine:
image: ubuntu-2204:current
docker_layer_caching: true
resource_class: arm.medium
resource_class: arm.medium
12 changes: 9 additions & 3 deletions src/scripts/ecr_login.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,17 @@ configure_config_json(){
install_aws_ecr_credential_helper(){
echo "Installing AWS ECR Credential Helper..."
if [[ "$SYS_ENV_PLATFORM" = "linux" ]]; then
$SUDO apt update
$SUDO apt install amazon-ecr-credential-helper
HELPER_INSTALLED=$(dpkg --get-selections | (grep amazon-ecr-credential-helper || test $?) | awk '{print $2}')
if [[ "$HELPER_INSTALLED" != "install" ]]; then
$SUDO apt update
$SUDO apt install amazon-ecr-credential-helper
fi
configure_config_json
elif [[ "$SYS_ENV_PLATFORM" = "macos" ]]; then
brew install docker-credential-helper-ecr
HELPER_INSTALLED=$(brew list -q | grep -q docker-credential-helper-ecr || test $?)
if [[ "$HELPER_INSTALLED" -ne 0 ]]; then
brew install docker-credential-helper-ecr
fi
configure_config_json
else
docker logout "${AWS_ECR_VAL_ACCOUNT_URL}"
Expand Down

0 comments on commit 1d120cb

Please sign in to comment.