Revert the use of wheel synchronizing

When using this role, a playbook can be used to orchestrate
doing all the builds on a single host. There is no need to
orchestrate this inside the role.

In order to gain the efficiencies of building everything on
a single host, a playbook can/should be used with the setting
'venv_reuse_build_only: yes'. Which will not continue to the
install stage.

Change-Id: Ib6e13ca7623942f8b0663b54528599b56b05fb19
This commit is contained in:
Jesse Pretorius 2018-03-29 16:36:39 +01:00
parent 24dda60d55
commit 58f0eaa468
4 changed files with 12 additions and 39 deletions

View File

@ -76,12 +76,6 @@ venv_reuse_build_wheels: yes
# prevent re-use of venvs between them.
venv_reuse_download_venv_path: "{{ lookup('env', 'HOME') | default('/opt', true) }}/cache/venvs/{{ venv_reuse_download_subfolder }}"
# The path where built wheels should be stored on the
# deployment host. By default, ensure that the location
# separates wheels per distribution and architecture to
# prevent reuse of wheels between them.
venv_reuse_download_wheel_path: "{{ lookup('env', 'HOME') | default('/opt', true) }}/cache/wheels/{{ venv_reuse_download_subfolder }}"
# NOTE(hwoarang): ansible_distribution may return a string with spaces
# such as "openSUSE Leap" so we need to replace the space with underscore
# in order to create a more sensible repo name for the distro.
@ -92,7 +86,7 @@ venv_reuse_download_path_owner: "{{ lookup('env', 'USER') | default('root', true
# The path where the wheels are cached on the target host
# for speeding up the build process.
venv_wheel_destination_path: "/var/cache/pip/wheels"
venv_wheel_destination_path: "/var/cache/python_wheels"
# The facts to set when the venv changes during a
# build, or the installation of a venv.

View File

@ -44,33 +44,15 @@
- "{{ venv_destination_path }}"
- "{{ venv_wheel_destination_path }}"
- name: Build and synchronize wheels when venv_reuse_build_wheels is enabled
- name: Build wheels for the packages to be installed into the venv
command: >-
pip wheel
--wheel-dir {{ venv_wheel_destination_path }}/
--find-links {{ venv_wheel_destination_path }}/
--log /var/log/python_wheel_build.log
{{ venv_pip_install_args }}
{{ venv_pip_packages | join(' ') }}
when: venv_reuse_build_wheels | bool
block:
- name: Copy any existing wheels to the target host for re-use
synchronize:
src: "{{ venv_reuse_download_wheel_path }}/"
dest: "{{ venv_wheel_destination_path }}"
owner: no
group: no
- name: Build wheels for the packages to be installed into the venv
command: >-
pip wheel
--wheel-dir {{ venv_wheel_destination_path }}/
--find-links {{ venv_wheel_destination_path }}/
--log /var/log/python_wheel_build.log
{{ venv_pip_install_args }}
{{ venv_pip_packages | join(' ') }}
- name: Copy any new wheels from the target host to the deploy host for re-use
synchronize:
mode: pull
src: "{{ venv_wheel_destination_path }}/"
dest: "{{ venv_reuse_download_wheel_path }}"
owner: no
group: no
#TODO(odyssey4me):
# Split the venv build into multiple parts:

View File

@ -32,16 +32,13 @@
- venv_reuse_build_only | bool
- not venv_reuse_enable | bool
- name: Ensure that venv_reuse paths exists on the deployment host
- name: Ensure that venv_reuse_download_path exists on the deployment host
file:
path: "{{ item }}"
path: "{{ venv_reuse_download_venv_path }}"
state: directory
owner: "{{ venv_reuse_download_path_owner }}"
delegate_to: localhost
run_once: yes
with_items:
- "{{ venv_reuse_download_venv_path }}"
- "{{ venv_reuse_download_wheel_path }}"
when:
- venv_reuse_enable | bool

View File

@ -28,7 +28,7 @@
- path: "{{ lookup('env', 'HOME') | default('/opt', true) }}/cache/venvs"
- path: "{{ lookup('env', 'HOME') | default('/opt', true) }}/cache/wheels"
condition: "{{ target_host_group_name == 'test1' }}"
- path: "/var/cache/pip"
- path: "/var/cache/python_wheels"
- name: Clean up facts from previous tests
ini_file: