From 29c368f98944a2191cd6936e2a0e222be404a4c6 Mon Sep 17 00:00:00 2001 From: Andrey Kurilin Date: Wed, 3 Feb 2021 22:15:50 +0200 Subject: [PATCH] [ci] Unblock CI * Remove listing nova agents from osresources. This API is not available anymore * move tox installation from pre playbook to a role Change-Id: Ic51f5c82e4ca89b997e2eb1d3d919661061c851f --- .zuul.d/rally-tox-functional.yaml | 1 - .../list-os-resources/library/osresources.py | 3 - .../roles/tox-install/tasks/main.yaml | 58 +++++++++++++++++ .../ci/playbooks/tox-functional-env-run.yaml | 1 + tests/ci/playbooks/tox-install.yaml | 64 ------------------- 5 files changed, 59 insertions(+), 68 deletions(-) create mode 100644 tests/ci/playbooks/roles/tox-install/tasks/main.yaml delete mode 100644 tests/ci/playbooks/tox-install.yaml diff --git a/.zuul.d/rally-tox-functional.yaml b/.zuul.d/rally-tox-functional.yaml index b42b2792..1d575c3d 100644 --- a/.zuul.d/rally-tox-functional.yaml +++ b/.zuul.d/rally-tox-functional.yaml @@ -20,5 +20,4 @@ devstack_localrc: USE_PYTHON3: true tox_env: "functional" - pre-run: tests/ci/playbooks/tox-install.yaml run: tests/ci/playbooks/tox-functional-env-run.yaml diff --git a/tests/ci/playbooks/roles/list-os-resources/library/osresources.py b/tests/ci/playbooks/roles/list-os-resources/library/osresources.py index fd64f2d6..789ed9c5 100755 --- a/tests/ci/playbooks/roles/list-os-resources/library/osresources.py +++ b/tests/ci/playbooks/roles/list-os-resources/library/osresources.py @@ -169,9 +169,6 @@ class Nova(ResourceManager): def list_hypervisors(self): return self.client.hypervisors.list() - def list_agents(self): - return self.client.agents.list() - def list_keypairs(self): return self.client.keypairs.list() diff --git a/tests/ci/playbooks/roles/tox-install/tasks/main.yaml b/tests/ci/playbooks/roles/tox-install/tasks/main.yaml new file mode 100644 index 00000000..4090346b --- /dev/null +++ b/tests/ci/playbooks/roles/tox-install/tasks/main.yaml @@ -0,0 +1,58 @@ +- name: Check required version of Python + args: + chdir: "{{ zuul.project.src_dir }}" + shell: + executable: /bin/sh + cmd: | + set -e + + iniget(){ + local xtrace + xtrace=$(set +o | grep xtrace) + set +o xtrace + local section=$1 + local file="tox.ini" + local option="basepython" + local line + + line=$(sed -ne "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ p; }" "$file") + echo ${line#*= python} + $xtrace + } + + tox_testenv_python=$(iniget 'testenv:{{ tox_env }}') + if [ "$tox_testenv_python" != "" ]; then + echo $tox_testenv_python + else + echo $(iniget 'testenv') + fi + register: python_version + +- name: Install the proper python version + become: True + become_user: root + shell: + executable: /bin/sh + cmd: | + set -e + + apt-get update + apt-get install python{{ python_version.stdout }}-dev --yes + +- name: Install the proper python pip version + become: True + become_user: root + shell: + executable: /bin/bash + cmd: | + set -e + curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py + python{{ python_version.stdout }} get-pip.py + +- name: Install python tox + become: True + become_user: root + shell: + executable: /bin/bash + cmd: | + pip{{ python_version.stdout }} install tox diff --git a/tests/ci/playbooks/tox-functional-env-run.yaml b/tests/ci/playbooks/tox-functional-env-run.yaml index f13c2d84..9f3909a5 100644 --- a/tests/ci/playbooks/tox-functional-env-run.yaml +++ b/tests/ci/playbooks/tox-functional-env-run.yaml @@ -11,5 +11,6 @@ # pass a check at 'prepare-for-rally-task' role. rally_task: "rally-jobs/simple-job.yaml" roles: + - tox-install - prepare-for-rally-task - tox-run \ No newline at end of file diff --git a/tests/ci/playbooks/tox-install.yaml b/tests/ci/playbooks/tox-install.yaml deleted file mode 100644 index abd9a235..00000000 --- a/tests/ci/playbooks/tox-install.yaml +++ /dev/null @@ -1,64 +0,0 @@ - -- hosts: all - name: Installs all required packages - tasks: - - name: Check required version of Python - args: - chdir: "{{ zuul.project.src_dir }}" - shell: - executable: /bin/sh - cmd: | - set -e - - iniget(){ - local xtrace - xtrace=$(set +o | grep xtrace) - set +o xtrace - local section=$1 - local file="tox.ini" - local option="basepython" - local line - - line=$(sed -ne "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ p; }" "$file") - echo ${line#*= python} - $xtrace - } - - tox_testenv_python=$(iniget 'testenv:{{ tox_env }}') - if [ "$tox_testenv_python" != "" ]; then - echo $tox_testenv_python - else - echo $(iniget 'testenv') - fi - register: python_version - - - name: Install the proper python version - become: True - become_user: root - shell: - executable: /bin/sh - cmd: | - set -e - - apt-get update - apt-get install python{{ python_version.stdout }}-dev --yes - - - name: Install the proper python pip version - become: True - become_user: root - shell: - executable: /bin/bash - cmd: | - set -e - curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py - python{{ python_version.stdout }} get-pip.py - - - name: Install python tox - become: True - become_user: root - shell: - executable: /bin/bash - cmd: | - pip{{ python_version.stdout }} install tox - roles: - - bindep