From 641b627a7add556f464648cdfc3eca5ccd3e1ab5 Mon Sep 17 00:00:00 2001 From: abregman Date: Sun, 17 Mar 2019 13:49:08 +0200 Subject: [PATCH] Add install command to IR plugin * Allow users and CI pipelines to run tobiko install command * Users can specify which environment to use Also: * Removed os-fault configuration generation - this is done by Tobiko itself * Remove other unused tasks Change-Id: Ieeba8d4094cb3764a2a2de99debbac3acd886180 --- infrared/install.yml | 27 ++++++++++++++++ infrared/main.yml | 14 ++------ infrared/plugin.spec | 23 +++++++++++--- infrared/tasks/configure.yml | 12 ------- infrared/tasks/install.yml | 37 ---------------------- infrared/tasks/run.yml | 11 ------- infrared/tasks/templates/os-faults.yaml.j2 | 35 -------------------- 7 files changed, 49 insertions(+), 110 deletions(-) create mode 100644 infrared/install.yml delete mode 100644 infrared/tasks/configure.yml delete mode 100644 infrared/tasks/install.yml delete mode 100644 infrared/tasks/run.yml delete mode 100644 infrared/tasks/templates/os-faults.yaml.j2 diff --git a/infrared/install.yml b/infrared/install.yml new file mode 100644 index 000000000..d6b6ecdce --- /dev/null +++ b/infrared/install.yml @@ -0,0 +1,27 @@ +--- +- name: Install Tobiko + hosts: undercloud + any_errors_fatal: true + gather_facts: yes + tasks: + - name: Install required packages + become: yes + yum: + name: "{{ item }}" + state: present + with_items: + - 'python-virtualenv' + - 'git' + + - name: Create Virtualenv + vars: + packages: ['pip', 'setuptools', 'pbr', 'tox'] + pip: + virtualenv: "{{ test.venv }}" + name: "{{ packages }}" + state: latest + + - name: Create virtual env for Tobiko test cases + shell: | + "source {{ test.venv }}/bin/activate" + "tox -e {{ test.environment }} --notest" diff --git a/infrared/main.yml b/infrared/main.yml index e33e16887..d57b5a3d8 100644 --- a/infrared/main.yml +++ b/infrared/main.yml @@ -1,11 +1,3 @@ -- name: Install Tobiko - import_playbook: tasks/install.yml - -- name: Set up os-faults configuration - import_playbook: tasks/configure.yml - -- name: Run Tobiko - import_playbook: tasks/run.yml - when: - - test.tests is defined - - test.tests +--- +- import_playbook: install.yml + when: test.install|default(False) diff --git a/infrared/plugin.spec b/infrared/plugin.spec index 94f5dbf48..883e864a7 100644 --- a/infrared/plugin.spec +++ b/infrared/plugin.spec @@ -4,12 +4,27 @@ config: subparsers: tobiko: - description: Tobiko Options + description: Executes Tobiko Framework include_groups: ["Ansible options", "Inventory", "Common options", "Answers file"] groups: - - title: Testing Parameters + - title: Stages Control options: - tests: + install: + type: Bool + help: | + Install Tobiko + - title: Install Options + options: + env: + type: Value + help: | + The tox environment to use + dir: + type: Value + help: | + The directory where Tobiko will be installed and used + venv: type: Value + default: '~/tobiko_venv' help: | - Group of tests to execute + path of existing virtual environment diff --git a/infrared/tasks/configure.yml b/infrared/tasks/configure.yml deleted file mode 100644 index 1c0c520cb..000000000 --- a/infrared/tasks/configure.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- name: Generate os-faults configuration - hosts: undercloud - any_errors_fatal: true - gather_facts: yes - - tasks: - - name: Create os-faults configuration file - template: - src: "templates/os-faults.yaml.j2" - dest: "~/os-faults.yaml" - mode: 0755 diff --git a/infrared/tasks/install.yml b/infrared/tasks/install.yml deleted file mode 100644 index f31e6b265..000000000 --- a/infrared/tasks/install.yml +++ /dev/null @@ -1,37 +0,0 @@ ---- -- name: Install Tobiko - hosts: undercloud - any_errors_fatal: true - gather_facts: yes - - tasks: - - name: Install required packages - become: yes - yum: - name: "{{ item }}" - state: present - with_items: - - 'python-virtualenv' - - 'git' - - - name: Clone Tobiko project - git: - repo: 'https://github.com/rhos-infra/tobiko' - dest: "~/tobiko" - - - name: Create Virtualenv - pip: - virtualenv: "~/tobiko_venv" - name: "{{ item }}" - state: latest - with_items: - - pip - - setuptools - - pbr - - - name: Install Tobiko - pip: - chdir: "~/tobiko" - virtualenv: "~/tobiko_venv" - name: "." - editable: true diff --git a/infrared/tasks/run.yml b/infrared/tasks/run.yml deleted file mode 100644 index 6fb5c5226..000000000 --- a/infrared/tasks/run.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- - -- name: Run Tobiko - hosts: undercloud - any_errors_fatal: true - gather_facts: no - tasks: - - - name: Run Tobiko Tests - shell: | - tobiko -e {{ test.tests }} diff --git a/infrared/tasks/templates/os-faults.yaml.j2 b/infrared/tasks/templates/os-faults.yaml.j2 deleted file mode 100644 index e55350dfc..000000000 --- a/infrared/tasks/templates/os-faults.yaml.j2 +++ /dev/null @@ -1,35 +0,0 @@ -cloud_management: - driver: universal - -node_discover: - driver: node_list - args: -{% for host_name in groups.overcloud_nodes|sort %} - - fqdn: {{ host_name }} - ip: {{ hostvars[host_name]['ansible_host'] }} - auth: - username: heat-admin - private_key_file: /home/stack/.ssh/id_rsa - become: true -{% endfor %} - -services: - openvswitch: - driver: system_service - args: - service_name: openvswitch - grep: openvswitch - -containers: - neutron_ovs_agent: - driver: docker_container - args: - container_name: neutron_ovs_agent - neutron_metadata_agent: - driver: docker_container - args: - container_name: neutron_metadata_agent - neutron_api: - driver: docker_container - args: - container_name: neutron_api