Sha256: a5c7ef32a20d8c1b239e7aa4a171c370ebf2f34cc198970edf328b359e3392c8

Contents?: true

Size: 539 Bytes

Versions: 3

Compression:

Stored size: 539 Bytes

Contents

auth_ecr() {
  account_id=$(aws sts get-caller-identity --query Account --output text)
  region="<%= ENV['AWS_REGION'] || 'us-east-1' %>"
  aws ecr get-login-password --region $region | \
    docker login --username AWS --password-stdin $account_id.dkr.ecr.$region.amazonaws.com
}

worked=1
for attempt in {1..10}; do
  [[ $worked != 0 ]] || break
  auth_ecr && worked=0 || (log "ecr auth: attempt $attempt failed, sleeping 30"; sleep 30)
done
[[ $worked != 0 ]] && fatal "failed to auth to ecr"
log "ecr auth: successfully authenticated"

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dockly-4.4.1 snippets/auth_ecr.erb
dockly-4.4.0 snippets/auth_ecr.erb
dockly-4.3.0 snippets/auth_ecr.erb