Run wheels build for each unique distro/arch

There may be multiple architecures and OS versions in
ansible_play_hosts. However, with run_once we build wheels only
for one selected distro and do not repsect multi-arch/multi-distro
setups.
Instead of run_once we need to select single (and first in play)
host of each architecture and distro and delegate wheels building
from it. That is needed, because venv_build_host is selected based
on the facts gathered for current inventory_hostname and will
depend on it's arch/distro.

Change-Id: I492d17169538ad2768e28f7c48314bdec407ab36
Closes-Bug: #1964535
This commit is contained in:
Dmitriy Rabotyagov
2022-06-29 15:08:30 +02:00
committed by Dmitriy Rabotyagov
parent 04f5847349
commit 57a2f226eb
3 changed files with 21 additions and 2 deletions

View File

@@ -0,0 +1,6 @@
---
fixes:
- |
Wheels build for multi-arch and multi-distro setups is fixed. For that
you still need to have set of venv_build_targets that will define targets
for each operating system and architecture.

View File

@@ -63,8 +63,9 @@
apply:
tags:
- build
when: venv_wheel_build_enable | bool
run_once: yes
when:
- venv_wheel_build_enable | bool
- inventory_hostname in _venv_wheels_first_play_hosts
tags:
- always

View File

@@ -56,6 +56,18 @@ venv_build_targets: |-
{% endfor %}
{{ targets }}
_venv_wheels_first_play_hosts: |
{% set first_hosts = {} %}
{% for host in ansible_play_hosts %}
{% set arch = hostvars[host]['ansible_facts']['architecture'] %}
{% set distro = hostvars[host]['ansible_facts']['distribution_version'] %}
{% set distro_arch = [distro, arch] | join('_') %}
{% if distro_arch not in first_hosts %}
{% set _ = first_hosts.update({distro_arch: host}) %}
{% endif %}
{% endfor %}
{{ first_hosts.values() }}
_venv_pip_packages: "{{ (venv_default_pip_packages | union(venv_pip_packages)) | sort | select | list }}"
_venv_build_dist_arch: "{{ (ansible_facts['distribution'] | lower) | replace(' ', '_') }}-{{ ansible_facts['distribution_version'].split('.')[:2] | join('.') }}-{{ ansible_facts['architecture'] | lower }}"