Allow repo host packages to be upgraded before repo build

To cater for a situation where the repo build packages are changing,
but the repo does not yet have the package built, we need to ensure
that the install task for it can fetch from pypi (or the designated
pypi mirror). To do this we try the local repo first, then fall back
to using the designated default index which defaults to pypi.

Change-Id: Iba7e9939250b24dc64fdd1883f963d0253ddad7e
This commit is contained in:
Jesse Pretorius 2018-04-23 12:25:21 +01:00 committed by Jesse Pretorius (odyssey4me)
parent 9818d28e14
commit de46da9d14
1 changed files with 32 additions and 9 deletions

View File

@ -89,17 +89,40 @@
(repo_build_wheel_rebuild | bool) or
(repo_build_venv_rebuild | bool)
- name: Install pip packages
pip:
name: "{{ repo_pip_packages }}"
state: "{{ repo_build_pip_package_state }}"
extra_args: "--constraint {{ repo_build_release_path }}/requirements_constraints.txt {{ pip_install_options }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 5
# Note(odyssey4me):
# To cater for a situation where the pip packages are changing, but the repo
# does not yet have the package built, we need to ensure that this task can
# fetch from pypi. To do this we try the local repo first, then fall back to
# using pypi.
- name: Try installing from the repo first, then fall back to using pypi
tags:
- repo-build-install
block:
- name: Install pip packages (from repo)
pip:
name: "{{ repo_pip_packages }}"
state: "{{ repo_build_pip_package_state }}"
extra_args: >-
--constraint {{ repo_build_release_path }}/requirements_constraints.txt
{{ pip_install_options }}
register: install_packages
until: install_packages | success
retries: 5
delay: 5
rescue:
- name: Install pip packages (from pypi mirror)
pip:
name: "{{ repo_pip_packages }}"
state: "{{ repo_build_pip_package_state }}"
extra_args: >-
--index-url {{ repo_build_pip_default_index }}
--trusted-host {{ repo_build_pip_default_index | netloc_no_port }}
--constraint {{ repo_build_release_path }}/requirements_constraints.txt
{{ pip_install_options }}
register: install_packages
until: install_packages | success
retries: 5
delay: 5
- name: Create repo log directory
file: