Add more flexible mirrors settings for CI repro

Fix undefined value substituted for mirror_fqdn, when there is no
mirror_path defined in inventory variables used for the zuul-based CI
reproducer. Avoid using mirror_path if mirror_fqdn is defined. For
compatibility sakes, if mirror_path is in inventory, its value will be
used for mirror_fqdn and pypi_fqdn in zuul playbooks although.

Also pass for zuul playbooks pypi_fqdn and package_mirror, if defined.
When pypi_fqdn is omitted, custom mirror_fqdn always overwrites
the used (and trusted) pypi mirror. That might be undesired behavior
when configuring different mirrors for packages versus pip eggs.

Additionally, unhardcode zuul_site_mirror_fqdn and mirror_path. It used
to end up hardcoded in zuul-config/zuul.d/jobs.yaml.
In order to properly interpolate overrided mirrors, parametrize those.

With https://review.rdoproject.org/r/27758 in place, users can define
more flexible mirrors configurations by using: mirror_fqdn, pypi_fqdn,
package_mirror, or zuul_site_mirror_fqdn and mirror_path.

Change-Id: I66ef983460f7bf8be6e18b379ef1952f577044fe
Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
This commit is contained in:
Bogdan Dobrelya 2020-05-25 16:19:22 +02:00
parent 84780c715c
commit f8b23931a6
3 changed files with 21 additions and 3 deletions

View File

@ -25,7 +25,7 @@ The role is run within the collect-logs role.
Example Playbook
----------------
This role generates a launcher-playbook:
This role generates a launcher-playbook and overrides RPM and PyPi mirrors for Centos 8:
- hosts: localhost
tasks:
@ -62,6 +62,8 @@ This role generates a launcher-playbook:
parent: tripleo-ci-centos-7-multinode-1ctlr-featureset010
vars:
mirror_fqdn: mirror.regionone.rdo-cloud.rdoproject.org
package_mirror: http://mirror.centos.org/centos
pypi_fqdn: mirror01.ord.rax.opendev.org
featureset_override:
dlrn_hash_tag:
8127e43f39ac9b9e14d4a5a10bcbf41f122f32d7_d2efe5df

View File

@ -5,3 +5,4 @@ reproducer_zuul_based_quickstart_readme_file: "{{ artcl_collect_dir }}/README-re
reproducer_zuul_based_launcher_playbook: launcher-playbook.yaml.j2
launcher_env_setup_playbook: launcher-env-setup-playbook.yaml.j2
zuul_reproducer_dir: reproducer-quickstart
mirror_path: mirror.regionone.rdo-cloud.rdoproject.org

View File

@ -9,6 +9,12 @@
# -e nodepool_provider=libvirt \
# -e mirror_path=mirror.mtl01.inap.opendev.org
#
# To split mirror_path into different values for packages and pypi, use f.e.:
# ...
# -e mirror_fqdn=mirror.mtl01.inap.opendev.org \
# -e package_mirror=http://mirror.centos.org/centos
# -e pypi_fqdn=mirror.mtl02.inap.opendev.org \
#
# To run on a different cloud defined in clouds.yaml ( default is rdo-cloud):
# >> ansible-playbook launcher-playbook.yaml \
# -e cloud_name='<custom cloud>'
@ -53,7 +59,13 @@
clouds_yaml_path: "/home/{{ ansible_user }}/.config/openstack/clouds.yaml"
{% endraw -%}
ovb_key_name: tripleo-ci-team
mirror_path: mirror.regionone.rdo-cloud.rdoproject.org
mirror_path: "{{ mirror_path }}"
zuul_site_mirror_fqdn: "{{ zuul_site_mirror_fqdn | default(mirror_path) }}"
mirror_fqdn: "{{ mirror_fqdn | default(mirror_path) }}"
pypi_fqdn: "{{ pypi_fqdn | default(mirror_path) }}"
{% if package_mirror is defined -%}
package_mirror: "{{ package_mirror }}"
{% endif -%}
launch_job_branch: {{ zuul.branch }}
{% if 'periodic' not in zuul.job -%}
depends_on:
@ -95,7 +107,10 @@
remove_ovb_after_job: false
{% endif -%}
{% raw -%}
mirror_fqdn: {{ mirror_path }}
zuul_site_mirror_fqdn: {{ zuul_site_mirror_fqdn }}
mirror_fqdn: {{ mirror_fqdn }}
pypi_fqdn: {{ pypi_fqdn }}
package_mirror: {{ package_mirror }}
{% endraw -%}
{% if releases_file_output is defined -%}
ready_releases_file: |