From 54d56dbd56d7c7c4b57e81d6873345c78b6d8244 Mon Sep 17 00:00:00 2001 From: Chandan Kumar Date: Wed, 27 Mar 2019 13:26:30 +0530 Subject: [PATCH] Update role for new source build process The variable tempest_developer_mode and tempest_venv_download no longer carry any meaning. This review changes os_tempest to do the equivalent of what developer_mode was all the time, meaning that it always builds the venv and never requires the repo server, but it will use a repo server when available. As part of this, we move the source build out of its own file because it's now a single task to include the venv build role. This is just to make it easier to follow the code. Change-Id: I7ab81ab707a5576682abcbe9952d85e79a1f3856 --- defaults/main.yml | 23 ++++++----------------- tasks/tempest_install_source.yml | 30 ++---------------------------- tasks/tempestconf.yml | 10 +--------- 3 files changed, 9 insertions(+), 54 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 3d706e59..45ce42f0 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -45,28 +45,16 @@ tempest_run: no # from the stable release defined in global requirements. #tempest_git_repo: https://git.openstack.org/openstack/tempest tempest_git_install_branch: master -tempest_developer_mode: False -tempest_developer_constraints: +tempest_upper_constraints_url: "{{ requirements_git_url | default('https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=' ~ requirements_git_install_branch | default('master')) }}" +tempest_git_constraints: - "git+{{ tempest_git_repo }}@{{ tempest_git_install_branch }}#egg=tempest" + - "--constraint {{ tempest_upper_constraints_url }}" -# TODO(odyssey4me): -# This can be simplified once all the roles are using -# python_venv_build. We can then switch to using a -# set of constraints in pip.conf inside the venv, -# perhaps prepared by giving a giving a list of -# constraints to the role. -tempest_pip_install_args: >- - {{ tempest_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }} - {{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''), '') }} - {{ pip_install_options | default('') }} +tempest_pip_install_args: "{{ pip_install_options | default('') }}" # Name of the virtual env to deploy into tempest_venv_tag: "{{ venv_tag | default('untagged') }}" tempest_venv_bin: "/openstack/venvs/tempest-{{ tempest_venv_tag }}/bin" -# venv_download, even when true, will use the fallback method of building the -# venv from scratch if the venv download fails. -tempest_venv_download: "{{ not tempest_developer_mode | bool }}" -tempest_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/tempest.tgz # The location where the tempest logs will be placed tempest_log_dir: "/var/log/tempest" @@ -320,8 +308,9 @@ tempest_tempestconf_venv_bin: "/openstack/venvs/tempestconf/bin" # from the stable release defined in global requirements. # tempest_tempestconf_git_repo: https://git.openstack.org/openstack/python-tempestconf tempest_tempestconf_git_install_branch: master -tempest_tempestconf_developer_constraints: +tempest_tempestconf_git_constraints: - "git+{{ tempest_tempestconf_git_repo }}@{{ tempest_tempestconf_git_install_branch }}#egg=python_tempestconf" + - "--constraint {{ tempest_upper_constraints_url }}" tempest_tempestconf_pip_packages: - python-tempestconf tempest_tempestconf_profile: diff --git a/tasks/tempest_install_source.yml b/tasks/tempest_install_source.yml index 96ea2e76..e1ab4b66 100644 --- a/tasks/tempest_install_source.yml +++ b/tasks/tempest_install_source.yml @@ -13,31 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -# TODO(odyssey4me): -# This can be simplified once all the roles are using -# python_venv_build. We can then switch to using a -# set of constraints in pip.conf inside the venv, -# perhaps prepared by giving a giving a list of -# constraints to the role. -- name: Create developer mode constraint file - copy: - dest: "/opt/developer-pip-constraints.txt" - content: | - {% for item in tempest_developer_constraints %} - {{ item }} - {% endfor %} - when: tempest_developer_mode | bool - -- name: Ensure remote wheel building is disabled in developer mode - set_fact: - venv_build_host: "{{ inventory_hostname }}" - when: - - tempest_developer_mode | bool - - name: Install the python venv - include_role: + import_role: name: "python_venv_build" vars: + venv_build_constraints: "{{ tempest_git_constraints }}" venv_install_destination_path: "{{ tempest_venv_bin | dirname }}" venv_pip_install_args: "{{ tempest_pip_install_args }}" venv_pip_packages: "{{ tempest_pip_packages }}" @@ -73,8 +53,6 @@ virtualenv: "{{ tempest_venv_bin | dirname }}" virtualenv_site_packages: "no" extra_args: >- - {{ tempest_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }} - {{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }} {{ pip_install_options | default('') }} --isolated with_items: "{{ _test_requirements_stat.results }}" @@ -94,8 +72,6 @@ virtualenv: "{{ tempest_venv_bin | dirname }}" virtualenv_site_packages: "no" extra_args: >- - {{ tempest_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }} - {{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }} {{ pip_install_options | default('') }} --isolated with_items: "{{ tempest_plugins }}" @@ -112,8 +88,6 @@ virtualenv: "{{ tempest_venv_bin | dirname }}" virtualenv_site_packages: "no" extra_args: >- - {{ tempest_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }} - {{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }} {{ pip_install_options | default('') }} --isolated with_items: "{{ tempest_plugins }}" diff --git a/tasks/tempestconf.yml b/tasks/tempestconf.yml index 4ebaf2ea..a593a6bf 100644 --- a/tasks/tempestconf.yml +++ b/tasks/tempestconf.yml @@ -13,19 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Create developer mode constraint file for python-tempestconf - copy: - dest: "/opt/developer-pip-constraints.txt" - content: | - {% for item in tempest_tempestconf_developer_constraints %} - {{ item }} - {% endfor %} - when: tempest_developer_mode | bool - - name: Install python-tempestconf on venv include_role: name: "python_venv_build" vars: + venv_build_constraints: "{{ tempest_tempestconf_git_constraints }}" venv_install_destination_path: "{{ tempest_tempestconf_venv_bin | dirname }}" venv_pip_install_args: "{{ tempest_pip_install_args }}" venv_pip_packages: "{{ tempest_tempestconf_pip_packages }}"