qa/distros: configure podman to pull from docker-mirror

This also requires a change to cephadm.py to search for
registry entries for docker.io by 'prefix' or 'location',
and to only add the mirror if a mirror isn't already present

Signed-off-by: Dan Mick <dmick@redhat.com>
This commit is contained in:
Dan Mick 2020-12-17 02:06:31 +00:00
parent fb03fa3766
commit f30c55a242
2 changed files with 10 additions and 6 deletions

View File

@ -9,4 +9,4 @@ tasks:
- echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_18.04/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
- sudo apt update
- sudo apt -y install podman
- echo -e "[registries.search]\nregistries = ['docker.io']" | sudo tee /etc/containers/registries.conf
- echo -e "[[registry]]\nlocation = 'docker.io'\n\n[[registry.mirror]]\nlocation='docker-mirror.front.sepia.ceph.com:5000'\n" | sudo tee /etc/containers/registries.conf

View File

@ -1264,13 +1264,17 @@ def registries_add_mirror_to_docker_io(conf, mirror):
}
else:
v2 = config # type: ignore
dockers = [r for r in v2['registry'] if r['prefix'] == 'docker.io']
dockers = [
r for r in v2['registry'] if
r.get('prefix') == 'docker.io' or r.get('location') == 'docker.io'
]
if dockers:
docker = dockers[0]
docker['mirror'] = [{
"location": mirror,
"insecure": True,
}]
if 'mirror' not in docker:
docker['mirror'] = [{
"location": mirror,
"insecure": True,
}]
return v2