Cache Ansible Galaxy on CI mirror servers

Ansible Galaxy indexes tarballs of Ansible roles and collections at
a central site, which in turn points to a dedicated Amazon S3
subdomain. The tools which consume it support overriding the default
Galaxy URL with any arbitrary one, so should be able to take
advantage of this in CI jobs.

Change-Id: Ib5664e5588f7237a19a2cdb6eec3109452e8a107
This commit is contained in:
Jeremy Stanley 2021-11-22 15:21:48 +00:00
parent ee9cec707b
commit 0613cfda31
2 changed files with 45 additions and 0 deletions

View File

@ -110,6 +110,14 @@ ErrorLogFormat "[%{cu}t] [%-m:%l] [pid %P:tid %T] %7F: %E: [client\ %a] %M% , \
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-d
RewriteRule (.*)-(.*) $1.$2 [N]
# Ansible Galaxy
CacheEnable disk "/galaxy"
ProxyPass "/galaxy/" "https://galaxy.ansible.com/" ttl=120 keepalive=On retry=0
ProxyPassReverse "/galaxy/" "https://galaxy.ansible.com/"
CacheEnable disk "/galaxy-s3"
ProxyPass "/galaxy-s3/" "https://ansible-galaxy.s3.amazonaws.com/" ttl=120 keepalive=On retry=0
ProxyPassReverse "/galaxy-s3/" "https://ansible-galaxy.s3.amazonaws.com/"
ErrorLog /var/log/apache2/mirror_$port_error.log
LogLevel warn
CustomLog /var/log/apache2/mirror_$port_access.log combined-cache

View File

@ -88,3 +88,40 @@ def test_quay_mirror(host):
assert 'quay' in cmd.stdout
# TODO test RHRegistryMirror
def test_galaxy_mirror(host):
for addr in host.addr(host.backend.host).ipv4_addresses:
cmd = host.run(
"wget --no-check-certificate -qO- https://%s/galaxy/" % addr)
assert 'Ansible Galaxy' in cmd.stdout
cmd = host.run("wget -qO- http://%s/galaxy/" % addr)
assert 'Ansible Galaxy' in cmd.stdout
cmd = host.run("wget --no-check-certificate -O- "
"https://%s/galaxy/download/community-general-4.0.2.tar.gz" %
addr)
assert '/galaxy-s3/artifact/' in cmd.stderr
cmd = host.run("wget -O- "
"http://%s/galaxy/download/community-general-4.0.2.tar.gz" %
addr)
assert '/galaxy-s3/artifact/' in cmd.stderr
for addr in host.addr(host.backend.host).ipv6_addresses:
cmd = host.run("wget --no-check-certificate -qO- "
"https://[%s]/galaxy/" % addr)
assert 'Ansible Galaxy' in cmd.stdout
cmd = host.run("wget -qO- http://[%s]/galaxy/" % addr)
assert 'Ansible Galaxy' in cmd.stdout
cmd = host.run("wget --no-check-certificate -O- "
"https://[%s]/galaxy/download/community-general-4.0.2.tar.gz" %
addr)
assert '/galaxy-s3/artifact/' in cmd.stderr
cmd = host.run("wget -O- "
"http://[%s]/galaxy/download/community-general-4.0.2.tar.gz" %
addr)
assert '/galaxy-s3/artifact/' in cmd.stderr