tests: Authenticate to AWS Elastic Container Registry for `docker pull`

This should increase the rate limit from 1/s to 10/s. AWS
credentials are obtained from environment variables in Azure
pipelines, or the default AWS CLI profile.

https://docs.aws.amazon.com/AmazonECR/latest/public/public-service-quotas.html
https://docs.aws.amazon.com/AmazonECR/latest/public/public-registries.html#public-registry-auth
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html
(cherry picked from commit 0db7467e4a)
pull/863/head
Alex Willmer 3 years ago
parent 086a325359
commit 95da0df705

@ -12,12 +12,15 @@ batches = [
'-r tests/requirements.txt ' '-r tests/requirements.txt '
'-r tests/ansible/requirements.txt', '-r tests/ansible/requirements.txt',
'pip install -q ansible=={0}'.format(ci_lib.ANSIBLE_VERSION) 'pip install -q ansible=={0}'.format(ci_lib.ANSIBLE_VERSION)
],
[
'aws ecr-public get-login-password | docker login --username AWS --password-stdin public.ecr.aws',
] ]
] ]
batches.append(ci_lib.throttle( batches[-1].extend([
'docker pull %s' % (ci_lib.image_for_distro(distro),) 'docker pull %s' % (ci_lib.image_for_distro(distro),)
for distro in ci_lib.DISTROS for distro in ci_lib.DISTROS
)) ])
ci_lib.run_batches(batches) ci_lib.run_batches(batches)

@ -39,6 +39,10 @@ steps:
- script: .ci/$(MODE)_install.py - script: .ci/$(MODE)_install.py
displayName: "Run $(MODE)_install.py" displayName: "Run $(MODE)_install.py"
env:
AWS_ACCESS_KEY_ID: $(AWS_ACCESS_KEY_ID)
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
AWS_DEFAULT_REGION: $(AWS_DEFAULT_REGION)
- script: .ci/$(MODE)_tests.py - script: .ci/$(MODE)_tests.py
displayName: "Run $(MODE)_tests.py" displayName: "Run $(MODE)_tests.py"

@ -13,6 +13,7 @@ ci_lib.run_batches([
'pip install -qqqU debops==0.7.2 ansible==%s' % ci_lib.ANSIBLE_VERSION, 'pip install -qqqU debops==0.7.2 ansible==%s' % ci_lib.ANSIBLE_VERSION,
], ],
[ [
'aws ecr-public get-login-password | docker login --username AWS --password-stdin public.ecr.aws',
'docker pull %s' % (ci_lib.image_for_distro('debian'),), 'docker pull %s' % (ci_lib.image_for_distro('debian'),),
], ],
]) ])

@ -11,6 +11,7 @@ batches = [
if ci_lib.have_docker(): if ci_lib.have_docker():
batches.append([ batches.append([
'aws ecr-public get-login-password | docker login --username AWS --password-stdin public.ecr.aws',
'docker pull %s' % (ci_lib.image_for_distro(ci_lib.DISTRO),), 'docker pull %s' % (ci_lib.image_for_distro(ci_lib.DISTRO),),
]) ])

@ -4,6 +4,7 @@ import ci_lib
batches = [ batches = [
[ [
'aws ecr-public get-login-password | docker login --username AWS --password-stdin public.ecr.aws',
'docker pull %s' % (ci_lib.image_for_distro(ci_lib.DISTRO),), 'docker pull %s' % (ci_lib.image_for_distro(ci_lib.DISTRO),),
], ],
[ [

Loading…
Cancel
Save