From d7acac1b995a26e228da5ca7b8a32d99c26512e7 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Tue, 7 Aug 2018 21:51:09 +0100 Subject: [PATCH] Use a venv to build the python wheels To limit the python packages installed on the host, all packages installed by pip are implemented into a venv. While many of the repo_pip_packages may be available via distribution packages, the versions vary wildly. We therefore opt to use a venv instead to keep things simple. This reduces the requirement on the host to *only* require the virtualenv package which is installed in the openstack_hosts role. The 'virtualenv' package is removed from the list as it is not used. Change-Id: I0619f51960e23756df7010d476d70f55ceda8441 --- defaults/main.yml | 5 ++++- tasks/repo_build_prepare.yml | 4 ++++ tasks/repo_build_wheels.yml | 6 ++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index aa50369..b2b7cef 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -112,12 +112,15 @@ repo_build_venv_command_options: >- --no-setuptools --no-wheel +# Path to the repo build venv binaries +repo_build_bin: "/openstack/venvs/repo-build-{{ repo_build_release_tag }}/bin" + +# Python packages to install into the repo build venv repo_pip_packages: - cython - pbr - requests - urllib3 - - virtualenv - wheel repo_build_store_pip_sources: false diff --git a/tasks/repo_build_prepare.yml b/tasks/repo_build_prepare.yml index 825cfd4..13299ef 100644 --- a/tasks/repo_build_prepare.yml +++ b/tasks/repo_build_prepare.yml @@ -102,6 +102,8 @@ pip: name: "{{ repo_pip_packages }}" state: "{{ repo_build_pip_package_state }}" + virtualenv: "{{ repo_build_bin | dirname }}" + virtualenv_site_packages: "no" extra_args: >- --constraint {{ repo_build_release_path }}/requirements_constraints.txt {{ pip_install_options }} @@ -114,6 +116,8 @@ pip: name: "{{ repo_pip_packages }}" state: "{{ repo_build_pip_package_state }}" + virtualenv: "{{ repo_build_bin | dirname }}" + virtualenv_site_packages: "no" extra_args: >- --index-url {{ repo_build_pip_default_index }} --trusted-host {{ repo_build_pip_default_index | netloc_no_port }} diff --git a/tasks/repo_build_wheels.yml b/tasks/repo_build_wheels.yml index 7aabdb1..81f4cfe 100644 --- a/tasks/repo_build_wheels.yml +++ b/tasks/repo_build_wheels.yml @@ -41,7 +41,8 @@ - name: Download requirement pip sources shell: >- set -o pipefail; - yes i | pip install --timeout {{ repo_build_timeout }} + yes i | {{ repo_build_bin }}/pip install + --timeout {{ repo_build_timeout }} --download {{ repo_build_output }} --no-binary :all: --constraint {{ repo_build_release_path }}/requirements_constraints.txt @@ -61,7 +62,8 @@ - name: Create OpenStack-Ansible requirement wheels shell: >- set -o pipefail; - pip wheel --timeout {{ repo_build_timeout }} + {{ repo_build_bin }}/pip wheel + --timeout {{ repo_build_timeout }} --wheel-dir {{ repo_build_output }} --find-links {{ repo_build_global_links_path }} --find-links {{ repo_build_output }}