{"id":395,"sha1":"835348da33be777d9e2ae33ef1e99f855a42d032","playbook":{"id":3,"items":{"plays":37,"tasks":567,"results":554,"hosts":7,"files":221,"records":0},"arguments":{"version":null,"verbosity":0,"private_key_file":null,"remote_user":null,"connection":"openstack.osa.ssh","timeout":null,"ssh_common_args":null,"sftp_extra_args":null,"scp_extra_args":null,"ssh_extra_args":null,"ask_pass":false,"connection_password_file":null,"force_handlers":true,"flush_cache":false,"become":false,"become_method":"sudo","become_user":null,"become_ask_pass":false,"become_password_file":null,"tags":["all"],"skip_tags":[],"check":false,"diff":false,"inventory":["/home/zuul/src/opendev.org/openstack/openstack-ansible/inventory/dynamic_inventory.py","/home/zuul/src/opendev.org/openstack/openstack-ansible/inventory/inventory.ini","/etc/openstack_deploy/inventory.ini"],"listhosts":false,"subset":null,"extra_vars":"Not saved by ARA as configured by 'ignored_arguments'","vault_ids":[],"ask_vault_pass":false,"vault_password_files":[],"forks":4,"module_path":null,"syntax":false,"listtasks":false,"listtags":false,"step":false,"start_at_task":null,"args":["setup-infrastructure.yml"]},"labels":[{"id":1,"name":"check:False"},{"id":2,"name":"tags:all"}],"started":"2025-12-14T10:15:01.440414Z","ended":"2025-12-14T10:21:34.655502Z","duration":"00:06:33.215088","name":null,"ansible_version":"2.18.6","client_version":"1.7.4","python_version":"3.13.5","server_version":"1.7.4","status":"completed","path":"/home/zuul/src/opendev.org/openstack/openstack-ansible/playbooks/setup-infrastructure.yml","controller":"aio1.openstack.local","user":"root"},"content":"---\n# Copyright 2018, Rackspace US, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n- name: Build the wheels on the build host\n  delegate_to: \"{{ venv_build_host }}\"\n  block:\n    # NOTE(jrosser) remove the use: parameter when https://github.com/ansible/ansible/issues/82598 is fixed\n    - name: Install distro packages for wheel build\n      vars:\n        _python_wheel_build_package_list: \"{{ venv_build_base_distro_package_list | union(venv_build_distro_package_list) }}\"\n      ansible.builtin.package:\n        name: \"{{ _python_wheel_build_package_list }}\"\n        state: \"{{ venv_distro_package_state }}\"\n        update_cache: \"{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}\"\n        cache_valid_time: \"{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary(venv_distro_cache_valid_time, omit) }}\"\n        use: \"{{ ansible_facts['pkg_mgr'] }}\"\n      when:\n        - _python_wheel_build_package_list | length > 0\n      register: _install_build_distro_packages\n      until: _install_build_distro_packages is success\n      retries: 5\n      delay: 2\n\n    - name: Clean up paths and files if venv_wheels_rebuild is enabled\n      ansible.builtin.file:\n        path: \"{{ item }}\"\n        state: absent\n      with_items:\n        - \"{{ _venv_build_requirements_prefix }}-requirements.txt\"\n        - \"{{ _venv_build_requirements_prefix }}-global-constraints.txt\"\n        - \"{{ _venv_build_requirements_prefix }}-source-constraints.txt\"\n        - \"{{ _venv_build_requirements_prefix }}-constraints.txt\"\n      when:\n        - venv_wheels_rebuild | bool\n\n    - name: Ensure a fresh venv_build_host_venv_path if venv_rebuild is enabled\n      ansible.builtin.file:\n        path: \"{{ venv_build_host_venv_path }}\"\n        state: absent\n      when:\n        - venv_rebuild | bool\n        - venv_wheels_rebuild | bool\n\n    - name: Create wheel directory on the build host\n      ansible.builtin.file:\n        path: \"{{ item }}\"\n        state: directory\n        owner: \"{{ venv_build_host_user_name | default(omit) }}\"\n        group: \"{{ venv_build_host_group_name | default(omit) }}\"\n        mode: \"0755\"\n      with_items:\n        - \"{{ venv_build_host_wheel_path }}\"\n        - \"{{ venv_build_host_requirements_path }}\"\n        - \"{{ venv_build_host_venv_path }}\"\n\n    - name: Build requirement and constraint files for the venv\n      ansible.builtin.copy:\n        dest: \"{{ item.dest }}\"\n        content: \"{{ item.content }}\"\n        owner: \"{{ venv_build_host_user_name | default(omit) }}\"\n        group: \"{{ venv_build_host_group_name | default(omit) }}\"\n        mode: \"0644\"\n      loop:\n        - dest: \"{{ _venv_build_requirements_prefix }}-requirements.txt\"\n          content: |-\n            {% for item in _venv_pip_packages | select() %}\n            {{ item }}\n            {% endfor %}\n        - dest: \"{{ _venv_build_requirements_prefix }}-global-constraints.txt\"\n          content: |-\n            {% for item in venv_build_global_constraints | select() %}\n            {{ item }}\n            {% endfor %}\n        - dest: \"{{ _venv_build_requirements_prefix }}-source-constraints.txt\"\n          content: |-\n            {% for item in venv_build_constraints | select() %}\n            {{ item }}\n            {% endfor %}\n      loop_control:\n        label: \"{{ item.dest }}\"\n      register: _requirements_contraints\n\n    - name: Upgrade the wheel build virtualenv pip/setuptools/wheel to the versions we want\n      ansible.builtin.pip:\n        name:\n          - pip\n          - setuptools\n          - wheel\n        state: \"{{ venv_pip_package_state }}\"\n        virtualenv: \"{{ venv_build_host_venv_path }}\"\n        virtualenv_command: \"{{ venv_python_executable }} -m venv\"\n        extra_args: >-\n          --constraint {{ _venv_build_requirements_prefix }}-global-constraints.txt\n          --constraint {{ _venv_build_requirements_prefix }}-source-constraints.txt\n          --find-links {{ venv_build_host_wheel_path }}/\n          --trusted-host {{ (openstack_repo_url | default('http://localhost')) | urlsplit('hostname') }}\n          --log /var/log/python_venv_build.log\n          {{ venv_pip_build_args }}\n      environment: \"{{ venv_pip_build_env | combine(_pip_upgrade_noconf) }}\"\n      vars:\n        _pip_upgrade_noconf:\n          PIP_CONFIG_FILE: \"{{ (venv_pip_upgrade_noconf | bool) | ternary('/dev/null', '') }}\"\n      register: _update_virtualenv_packages\n      until: _update_virtualenv_packages is success\n      retries: 5\n      delay: 2\n\n    - name: Build wheels and constraints file\n      when: _requirements_contraints.results | selectattr('changed') | length > 0\n      block:\n        - name: Clean up temporary wheel build path\n          ansible.builtin.file:\n            path: \"/tmp/{{ venv_install_destination_path | basename }}\"\n            state: absent\n\n        - name: Build wheels for the packages to be installed into the venv # noqa: no-changed-when\n          ansible.builtin.command: >-\n            {{  venv_build_host_venv_path }}/bin/pip wheel\n            --requirement {{ _venv_build_requirements_prefix }}-requirements.txt\n            --constraint {{ _venv_build_requirements_prefix }}-global-constraints.txt\n            --constraint {{ _venv_build_requirements_prefix }}-source-constraints.txt\n            --wheel-dir /tmp/{{ venv_install_destination_path | basename }}/\n            --find-links {{ venv_build_host_wheel_path }}/\n            --trusted-host {{ (openstack_repo_url | default('http://localhost')) | urlsplit('hostname') }}\n            --log /var/log/python_wheel_build.log\n            {{ venv_pip_build_args }}\n            {{ venv_wheels_rebuild | ternary('--no-cache-dir', '') }}\n          environment: \"{{ venv_pip_build_env }}\"\n          register: _build_python_wheels\n          until: _build_python_wheels is success\n          retries: 5\n          delay: 2\n\n        - name: Index built wheels\n          ansible.builtin.find:\n            paths: \"/tmp/{{ venv_install_destination_path | basename }}\"\n            file_type: file\n          register: _built_wheels\n\n        - name: Set wheel permissions\n          ansible.builtin.file:\n            path: \"/tmp/{{ venv_install_destination_path | basename }}\"\n            owner: \"{{ venv_build_host_user_name | default(omit) }}\"\n            group: \"{{ venv_build_host_group_name | default(omit) }}\"\n            state: directory\n            recurse: true\n          when:\n            - (venv_build_host_user_name is defined) or\n              (venv_build_host_group_name is defined)\n\n        - name: Move built wheels to common wheel path\n          ansible.builtin.shell: >-\n            mv /tmp/{{ venv_install_destination_path | basename }}/* {{ venv_build_host_wheel_path }}/\n          changed_when: false\n          args:\n            executable: /bin/bash\n\n        - name: Build constraints file for installation purposes\n          ansible.builtin.copy:\n            content: |-\n              {% for file_data in _built_wheels['files'] %}\n              {%   set file_name = file_data['path'] | basename %}\n              {{ file_name.split('-')[0] | lower }}=={{ (file_name.split('-')[1].split('_')) | join('.post') | lower }}\n              {% endfor %}\n            dest: \"{{ _venv_build_requirements_prefix }}-constraints.txt\"\n            owner: \"{{ venv_build_host_user_name | default(omit) }}\"\n            group: \"{{ venv_build_host_group_name | default(omit) }}\"\n            mode: \"0644\"\n","created":"2025-12-14T10:20:09.163188Z","updated":"2025-12-14T10:20:09.163246Z","path":"/home/zuul/src/opendev.org/openstack/ansible-role-python_venv_build/tasks/python_venv_wheel_build.yml"}