6193d699e0
The list_skipped role have a variable called list_skipped_job. This variable makes the role filter the list of tests to be skipped per job. This makes required in order to start use the tempest-skiplist to skip tests for specific jobs (for example component-pipeline jobs). Without passing this variable, we are not able to filter tempest tests per job. Depends-On: https://review.opendev.org/#/c/751828/ Change-Id: I640b4efc9474614b44cbcf56d52736760dffc230
207 lines
7.4 KiB
YAML
207 lines
7.4 KiB
YAML
---
|
|
# Load the skipp list
|
|
- name: Install and run tempest-skip tool
|
|
block:
|
|
- name: Load tests to be skipped
|
|
vars:
|
|
list_skipped_release: "{{ release }}"
|
|
list_skipped_job: "{{ zuul.job | default(omit) }}"
|
|
include_role:
|
|
name: list_skipped
|
|
|
|
- name: Add skiplist tests to tempest_test_blacklist - skip them
|
|
set_fact:
|
|
tempest_test_blacklist: "{{ tempest_skip_register.skipped_tests }}"
|
|
when: not tempest_run_skipped | default(false) | bool
|
|
|
|
- name: Add skiplist tests to tempest_test_whitelist - run them
|
|
set_fact:
|
|
tempest_test_whitelist: "{{ tempest_skip_register.skipped_tests }}"
|
|
tempest_test_blacklist: []
|
|
when: tempest_run_skipped | default(false) | bool
|
|
vars:
|
|
# when ansible.cfg have the option interpreter_python set to auto, ansible
|
|
# executes with the system python instead of virtualenv even though you are
|
|
# inside the virtualenv. Setting ansible_python_interpreter here ensures
|
|
# that this playbook will be executed the virtualenv python, which have the
|
|
# openstac-tempest-skiplist module
|
|
ansible_python_interpreter: "{{ local_working_dir }}/bin/python"
|
|
list_skipped_yaml_file: "{{ local_working_dir }}/usr/local/share/ansible/roles/validate-tempest/vars/tempest_skip.yml"
|
|
when: tempest_use_skiplist | default(true)
|
|
delegate_to: localhost
|
|
|
|
- name: set python_cmd
|
|
set_fact:
|
|
python_cmd: "python{{ ansible_python.version.major }}"
|
|
cacheable: true
|
|
when: python_cmd is not defined
|
|
|
|
- name: Check if virtualenv is in the system
|
|
command: "{{ python_cmd }} -m virtualenv --version"
|
|
register: virtualenv_exist
|
|
failed_when: false
|
|
changed_when: false
|
|
|
|
- when: virtualenv_exist.rc != 0
|
|
name: Install virtualenv
|
|
become: true
|
|
package:
|
|
state: present
|
|
name: >
|
|
{% if ansible_python.version.major == 3 %}
|
|
python3-virtualenv
|
|
{% else %}
|
|
python-virtualenv
|
|
{% endif %}
|
|
|
|
- name: Create clouds.yaml if it doesn't exist
|
|
shell: |
|
|
source {{ ansible_user_dir }}/overcloudrc
|
|
mkdir -p {{ ansible_user_dir }}/.config/openstack
|
|
cat <<EOF>>{{ ansible_user_dir }}/.config/openstack/clouds.yaml
|
|
clouds:
|
|
{{ tempest_cloud_name }}:
|
|
identity_api_version: $OS_IDENTITY_API_VERSION
|
|
region_name: regionOne
|
|
auth:
|
|
auth_url: $OS_AUTH_URL
|
|
password: $OS_PASSWORD
|
|
username: $OS_USERNAME
|
|
user_domain_name: Default
|
|
project_domain_name: Default
|
|
project_name: $OS_PROJECT_NAME
|
|
EOF
|
|
when:
|
|
- release in ['queens', 'rocky', 'stein']
|
|
- use_os_tempest is defined
|
|
- use_os_tempest | bool
|
|
|
|
# Ansible requires openstacksdk>=0.12 do the resource setup, however
|
|
# queens upper-constraint has openstacksdk==0.11.36, so we need to
|
|
# implement a custom venv with the right openstacksdk to make it work
|
|
- name: Queens specific settings and tasks
|
|
when: release in ['queens']
|
|
vars:
|
|
sdk_venv_path: "{{ ansible_user_dir }}/.sdk"
|
|
block:
|
|
- name: Set tempest_service_setup_host_python_interpreter
|
|
set_fact:
|
|
tempest_service_setup_host_python_interpreter: "{{ sdk_venv_path }}/bin/python"
|
|
|
|
- name: Prepare openstacksdk venv
|
|
import_role:
|
|
name: "python_venv_build"
|
|
vars:
|
|
venv_python_executable: "{{ python_cmd }}"
|
|
venv_build_constraints:
|
|
- "--constraint https://releases.openstack.org/constraints/upper/rocky"
|
|
venv_install_destination_path: "{{ sdk_venv_path }}"
|
|
venv_pip_packages:
|
|
- 'openstacksdk'
|
|
venv_wheel_build_enable: false
|
|
|
|
# This will execute the validate-tempest
|
|
- name: Execute validate-tempest (deprecated)
|
|
block:
|
|
- name: Execute validate-tempest role
|
|
include_role:
|
|
name: validate-tempest
|
|
when: run_tempest | bool
|
|
|
|
# This will execute os_tempest
|
|
- name: Execute os_tempest
|
|
block:
|
|
- name: Fail the tempest playbook on undefined cloud name and install method
|
|
fail:
|
|
msg: |
|
|
The variable tempest_install_method and tempest_cloud_name is required and
|
|
has not been set.
|
|
when:
|
|
- tempest_install_method is not defined
|
|
- tempest_cloud_name is not defined
|
|
|
|
- name: Initialize neutron service for network creation
|
|
set_fact:
|
|
tempest_service_available_neutron: true
|
|
|
|
- name: Create /root/.config/openstack directory
|
|
file:
|
|
state: directory
|
|
path: "/root/.config/openstack"
|
|
mode: 0700
|
|
become: true
|
|
|
|
- name: Copy clouds.yaml file to /root directory
|
|
block:
|
|
- name: Copy clouds.yaml file from user's home to /root directory
|
|
copy:
|
|
src: '{{ ansible_user_dir }}/.config/openstack/clouds.yaml'
|
|
remote_src: true
|
|
dest: '/root/.config/openstack/clouds.yaml'
|
|
mode: 0600
|
|
become: true
|
|
rescue:
|
|
- name: Copy clouds.yaml file /etc/openstack to /root directory
|
|
copy:
|
|
src: '/etc/openstack/clouds.yaml'
|
|
remote_src: true
|
|
dest: '/root/.config/openstack/clouds.yaml'
|
|
mode: 0600
|
|
become: true
|
|
|
|
- name: Set network vars
|
|
set_fact:
|
|
tempest_public_net_physical_type: 'datacentre'
|
|
tempest_private_net_provider_type: "{{ (release in ['queens']) | ternary('vlan', 'geneve') }}"
|
|
tempest_public_subnet_cidr: '{{ tempest_cidr }}'
|
|
tempest_public_subnet_gateway_ip: '{{ tempest_cidr|nthhost(1) }}'
|
|
tempest_public_subnet_allocation_pools: '{{ tempest_cidr|nthhost(100) ~ "-" ~ tempest_cidr|nthhost(150) }}'
|
|
tempest_private_net_seg_id: "{{ (release in ['queens']) | ternary('', omit) }}"
|
|
tempest_network_ping_gateway: true
|
|
when: tempest_cidr is defined
|
|
|
|
- name: Set tempest workspace related vars
|
|
set_fact:
|
|
tempest_use_tempestconf: true
|
|
tempest_service_setup_host: '{{ inventory_hostname }}'
|
|
tempest_workspace: "{{ ansible_user_dir }}/tempest"
|
|
stackviz_venv_bin: "{{ ansible_user_dir }}/stackviz_venv/bin"
|
|
|
|
- name: set facts while running tempest from source
|
|
set_fact:
|
|
tempest_git_repo: https://opendev.org/openstack/tempest
|
|
tempest_tempestconf_git_repo: https://opendev.org/osf/python-tempestconf
|
|
tempest_tempestconf_venv_bin: "{{ ansible_user_dir }}/tempestconf_venv/bin"
|
|
tempest_venv_bin: "{{ ansible_user_dir }}/tempest_venv/bin"
|
|
when: tempest_install_method == 'source'
|
|
|
|
- name: set cirros image facts for periodic
|
|
vars:
|
|
default_cirros_image: http://images.rdoproject.org/cirros/cirros-0.4.0-x86_64-disk.img
|
|
set_fact:
|
|
tempest_tempestconf_profile_extras:
|
|
image: "{{ featureset_override['cirros_image'] | default(default_cirros_image) }}"
|
|
|
|
# stackviz in venv pulls oslo.db due upstream constraints,
|
|
# but it dropped py2 support so on such system we need to skip it
|
|
# https://bugs.launchpad.net/tripleo/+bug/1862134
|
|
- name: disable stackviz in python2 environment
|
|
set_fact:
|
|
tempest_run_stackviz: false
|
|
when:
|
|
- release|default('master') in ['master', 'queens', 'stein', 'train']
|
|
- ansible_distribution|lower in ['redhat', 'centos']
|
|
- ansible_distribution_major_version is version('7', '=')
|
|
|
|
- name: Run os_tempest role
|
|
vars:
|
|
ansible_become: true
|
|
debug: true
|
|
tempest_run: 'yes'
|
|
include_role:
|
|
name: os_tempest
|
|
when:
|
|
- not run_tempest | bool
|
|
- use_os_tempest is defined
|
|
- use_os_tempest | bool
|