From ca9d61a6d741929e151752aa831de0902a524fc7 Mon Sep 17 00:00:00 2001 From: Martin Kopec Date: Fri, 11 Dec 2020 13:52:40 +0000 Subject: [PATCH] Add installing tempestconf from the given source Adds support for installing python-tempestconf from the given source. This will be especially handy in CI jobs (f.e. in Zuul) when python-tempestconf's new changes are needed to be verified against refstack-client and this role (as python-tempestconf is a dependency of refstack-client we don't want to accidentally break refstack-client by a new changes in the tempestconf) Change-Id: I4541050f550d377956db51acf2b29f3f691cd5b9 --- README.md | 1 + playbooks/refstack-client-devstack.yaml | 6 +++++- tasks/generate-accounts.yaml | 2 +- tasks/generate-tempestconf.sh.j2 | 2 +- tasks/generate-tempestconf.yaml | 2 +- tasks/install-refstack-client.yaml | 17 +++++++++-------- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index a730302..07f65cf 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ deployment is working by passing refstack tests. | guideline | False | 2020.06 | String | Specific refstack guideline. | | private_key_path_src * | False | None | String | If defined, the key defined by the param is copied to the targeted machine to private_key_path location.| | refstack_client_source | False | ~/.refstack-client | String | Destination where refstack-client will be cloned only if the dir doesn't exist or it's empty, otherwise it will be used as is.| +| tempestconf_source | False | None | String | A path to python-tempestconf's source. If not defined, refstack-client's default is applied. | | refstack_client_version | False | HEAD | String | Version of refstack-client cloned from git. | | server | False | https://refstack.openstack.org/api | String | Server url where the results will be uploaded to if upload_results is True. | | tempest_account_concurrency | False | 3 | Int | A concurrency accounts.yaml file is generated with by tempest. | diff --git a/playbooks/refstack-client-devstack.yaml b/playbooks/refstack-client-devstack.yaml index b604540..459c407 100644 --- a/playbooks/refstack-client-devstack.yaml +++ b/playbooks/refstack-client-devstack.yaml @@ -6,7 +6,6 @@ - hosts: tempest vars: - refstack_client_source: "{{ zuul.projects['opendev.org/osf/refstack-client'].src_dir }}" devstack_base_dir: "/opt/stack" # TODO(mkopec) set_auth_url override is needed here until the role uses # python-tempestconf version which contains a fix for the SSL support: @@ -28,6 +27,11 @@ - name: Run ansible-role-refstack-client include_tasks: ../tasks/main.yaml vars: + refstack_client_source: "{{ zuul.projects['opendev.org/osf/refstack-client'].src_dir }}" + # the task which installs refstack-client changes dir to the refstack-client's + # location, python-tempestconf is in the same org (osf) so it's cloned + # just one level up by the zuul + tempestconf_source: "../python-tempestconf" source_credentials: "{{ devstack_base_dir }}/devstack/openrc demo demo; {{ set_auth_url }}" source_admin_credentials: "{{ devstack_base_dir }}/devstack/openrc admin admin; {{ set_auth_url }}" additional_tempestconf_params: "auth.tempest_roles Member object-storage.operator_role Member" diff --git a/tasks/generate-accounts.yaml b/tasks/generate-accounts.yaml index af7e0da..d490771 100644 --- a/tasks/generate-accounts.yaml +++ b/tasks/generate-accounts.yaml @@ -57,4 +57,4 @@ - name: Set path to newly generated accounts.yaml set_fact: - path_to_accounts_file: "{{ refstack_client_source }}/etc/accounts.yaml" + path_to_accounts_file: "./etc/accounts.yaml" diff --git a/tasks/generate-tempestconf.sh.j2 b/tasks/generate-tempestconf.sh.j2 index 49375da..fcc9687 100644 --- a/tasks/generate-tempestconf.sh.j2 +++ b/tasks/generate-tempestconf.sh.j2 @@ -1,7 +1,7 @@ # Script to generate tempest.conf set -ex export PATH=$PATH:/usr/local/sbin:/usr/sbin -source {{ refstack_client_source }}/.venv/bin/activate +source .venv/bin/activate source {{ source_credentials }} printenv discover-tempest-config \ diff --git a/tasks/generate-tempestconf.yaml b/tasks/generate-tempestconf.yaml index 6c8743a..d763ed6 100644 --- a/tasks/generate-tempestconf.yaml +++ b/tasks/generate-tempestconf.yaml @@ -15,4 +15,4 @@ - name: Set path to newly generated tempest.conf set_fact: - path_to_tempest_config: "{{ refstack_client_source }}/etc/tempest.conf" + path_to_tempest_config: "./etc/tempest.conf" diff --git a/tasks/install-refstack-client.yaml b/tasks/install-refstack-client.yaml index 1525df6..07d3439 100644 --- a/tasks/install-refstack-client.yaml +++ b/tasks/install-refstack-client.yaml @@ -26,13 +26,14 @@ when: python3_is_available.rc == 0 - name: Install refstack-client - command: ./setup_env {{ python3_param | default('') }} + shell: > + ./setup_env {{ python3_param | default('') }} + {% if tempest_tag is defined %} + -t {{ tempest_tag }} + {% endif %} + {% if tempestconf_source is defined %} + -s {{ tempestconf_source }} + {% endif %} args: chdir: "{{ refstack_client_source }}" - when: tempest_tag is not defined - -- name: Install refstack-client and clone Tempest from a specific tag - command: ./setup_env -t {{ tempest_tag }} {{ python3_param | default('') }} - args: - chdir: "{{ refstack_client_source }}" - when: tempest_tag is defined + changed_when: true