Skip to content

Commit

Permalink
Update role for new source build process
Browse files Browse the repository at this point in the history
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
  • Loading branch information
chkumar246 committed Mar 28, 2019
1 parent f4df580 commit 54d56db
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 54 deletions.
23 changes: 6 additions & 17 deletions defaults/main.yml
Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand Down
30 changes: 2 additions & 28 deletions tasks/tempest_install_source.yml
Expand Up @@ -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 }}"
Expand Down Expand Up @@ -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 }}"
Expand All @@ -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 }}"
Expand All @@ -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 }}"
Expand Down
10 changes: 1 addition & 9 deletions tasks/tempestconf.yml
Expand Up @@ -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 }}"
Expand Down

0 comments on commit 54d56db

Please sign in to comment.