From 88e3f7be98f4710b67cbe8582afe47a18f521cad Mon Sep 17 00:00:00 2001 From: Matthew Vernon Date: Mon, 17 Oct 2022 09:47:14 +0100 Subject: [PATCH] Fix Zed CI This is a combination of 3 commits. ==================== py2constraints: pin PasteDeploy version PasteDeploy version 3.0 (2022-10-16) dropped support for python2 (as well as <3.7), which causes our py2 tests to fail. So cap the version here at 2.1.1, the last which is compatible with our tests. Even doing this doesn't stop pip install swift pulling in a newer PasteDeploy in the tools/playbooks/saio_single_node_setup/make_rings.yaml playbook (causing the probes test on CentOS-7 to fail); so handle CentOS 7 explicitly. Signed-off-by: Matthew Vernon (cherry picked from commit cc033154ad4a4f345258457f3ceed9143fb3d46d) ==================== playbooks: replace ansible_ssh_user with ansible_user ansible_ssh_user has been deprecated since Ansible 2.0 [1] [1] https://github.com/ansible/ansible/blob/stable-2.0/CHANGELOG.md (cherry picked from commit 07b5f139a5f6353ec40a52047dd8456a820d3518) ==================== CI: Install pip from pinned upstream for py2 probe tests As part of that, invert the inheritance so the py2 job derives from the py3 job. (cherry picked from commit 3571cdf2f77978f9a8c835a66048278ce8086473) ==================== Change-Id: If69ae0f8eac8fe8ff7d5e4f4f1bff6d0ea9e7a8b --- .zuul.yaml | 30 +++++++++++-------- py2-constraints.txt | 1 + .../common/install_dependencies.yaml | 9 ++++++ .../multinode_setup/common_config.yaml | 4 +-- .../playbooks/multinode_setup/make_rings.yaml | 8 ++--- tools/playbooks/multinode_setup/run.yaml | 2 +- .../templates/make_multinode_rings.j2 | 2 +- .../saio_single_node_setup/setup_saio.yaml | 14 ++++----- 8 files changed, 43 insertions(+), 27 deletions(-) diff --git a/.zuul.yaml b/.zuul.yaml index e6de70f1ef..d1f63a24a9 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -345,14 +345,30 @@ - job: name: swift-probetests-centos-7 - parent: unittests + parent: swift-probetests-centos-8-stream nodeset: centos-7 description: | Setup a SAIO dev environment and run Swift's probe tests under Python 2. - timeout: 7200 vars: bindep_profile: test py27 + ensure_pip_from_packages: False + ensure_pip_from_packages_with_python2: False + ensure_pip_from_upstream: True + ensure_pip_from_upstream_interpreters: + - python2 + ensure_pip_from_upstream_url: "https://bootstrap.pypa.io/pip/2.7/get-pip.py" + +- job: + name: swift-probetests-centos-8-stream + parent: unittests + nodeset: centos-8-stream + description: | + Setup a SAIO dev environment and run Swift's probe tests + under Python 3. + timeout: 7200 + vars: + bindep_profile: test py36 pre-run: - tools/playbooks/common/install_dependencies.yaml - tools/playbooks/saio_single_node_setup/setup_saio.yaml @@ -360,16 +376,6 @@ run: tools/playbooks/probetests/run.yaml post-run: tools/playbooks/probetests/post.yaml -- job: - name: swift-probetests-centos-8-stream - parent: swift-probetests-centos-7 - nodeset: centos-8-stream - description: | - Setup a SAIO dev environment and run Swift's probe tests - under Python 3. - vars: - bindep_profile: test py36 - - job: name: swift-probetests-centos-8-stream-arm64 parent: swift-probetests-centos-8-stream diff --git a/py2-constraints.txt b/py2-constraints.txt index af78a2708a..40a5e5d860 100644 --- a/py2-constraints.txt +++ b/py2-constraints.txt @@ -78,3 +78,4 @@ dnspython===1.16.0 setuptools===44.1.1 pycadf===2.10.0 smmap===3.0.5 +PasteDeploy==2.1.1 diff --git a/tools/playbooks/common/install_dependencies.yaml b/tools/playbooks/common/install_dependencies.yaml index 714ddf50d9..6e2693a27f 100644 --- a/tools/playbooks/common/install_dependencies.yaml +++ b/tools/playbooks/common/install_dependencies.yaml @@ -43,3 +43,12 @@ # For some reason, pip on py2 isn't smart enough to prevent us # trying to install a too-new mock?? - 'mock<4' + + - name: install PasteDeploy - CentOS 7 + pip: name={{ item }} state=present extra_args='--upgrade' + with_items: + # py2_constraints isn't obeyed by pip install swift + - 'PasteDeploy==2.1.1' + when: + - ansible_facts['distribution'] == "CentOS" + - ansible_facts['distribution_major_version'] == "7" diff --git a/tools/playbooks/multinode_setup/common_config.yaml b/tools/playbooks/multinode_setup/common_config.yaml index 15a000260d..a81f449e3b 100644 --- a/tools/playbooks/multinode_setup/common_config.yaml +++ b/tools/playbooks/multinode_setup/common_config.yaml @@ -69,7 +69,7 @@ - hosts: test-runner tasks: - name: add new env. variable for running tests - lineinfile: dest=/home/{{ ansible_ssh_user }}/.bashrc line="export SWIFT_TEST_CONFIG_FILE=/home/{{ ansible_ssh_user}}/test.conf" + lineinfile: dest=/home/{{ ansible_user }}/.bashrc line="export SWIFT_TEST_CONFIG_FILE=/home/{{ ansible_user}}/test.conf" - name: copy the sample configuration files for running tests - template: src=test.conf.j2 dest=/home/{{ ansible_ssh_user }}/test.conf + template: src=test.conf.j2 dest=/home/{{ ansible_user }}/test.conf diff --git a/tools/playbooks/multinode_setup/make_rings.yaml b/tools/playbooks/multinode_setup/make_rings.yaml index 6eda38dc5a..b2ef444ff1 100644 --- a/tools/playbooks/multinode_setup/make_rings.yaml +++ b/tools/playbooks/multinode_setup/make_rings.yaml @@ -126,20 +126,20 @@ when: previous_swift_version | default(latest_swift_release.stdout) is not match("^(rocky|stein|train|ussuri)-em.*|^2\.(1?[0-9]|2[0-5])\.|^(origin/)?stable/[a-u].*") - name: create remakerings from template - template: src=make_multinode_rings.j2 dest=/home/{{ ansible_ssh_user }}/make_multinode_rings mode=0755 + template: src=make_multinode_rings.j2 dest=/home/{{ ansible_user }}/make_multinode_rings mode=0755 - name: create rings dir file: > - path=/home/{{ ansible_ssh_user }}/rings + path=/home/{{ ansible_user }}/rings state=directory - name: make rings shell: - cmd: /home/{{ ansible_ssh_user }}/make_multinode_rings + cmd: /home/{{ ansible_user }}/make_multinode_rings executable: /bin/bash - name: scp rings to all swift-cluster nodes - command: scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ConnectTimeout=5 -o ConnectionAttempts=360 /home/{{ ansible_ssh_user }}/rings/{{ item[0] }} {{ ansible_ssh_user }}@{{ hostvars[item[1]].nodepool.public_ipv4 }}:/etc/swift + command: scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ConnectTimeout=5 -o ConnectionAttempts=360 /home/{{ ansible_user }}/rings/{{ item[0] }} {{ ansible_user }}@{{ hostvars[item[1]].nodepool.public_ipv4 }}:/etc/swift with_nested: - ['account.ring.gz', 'container.ring.gz', 'object.ring.gz', 'object-1.ring.gz', 'object-2.ring.gz'] - "{{ groups['swift-cluster'] }}" diff --git a/tools/playbooks/multinode_setup/run.yaml b/tools/playbooks/multinode_setup/run.yaml index 072b157cc4..5ea82fa31c 100644 --- a/tools/playbooks/multinode_setup/run.yaml +++ b/tools/playbooks/multinode_setup/run.yaml @@ -40,4 +40,4 @@ tox_envlist: func-py3 tox_environment: TOX_CONSTRAINTS_FILE: https://releases.openstack.org/constraints/upper/yoga - SWIFT_TEST_CONFIG_FILE: /home/{{ ansible_ssh_user }}/test.conf + SWIFT_TEST_CONFIG_FILE: /home/{{ ansible_user }}/test.conf diff --git a/tools/playbooks/multinode_setup/templates/make_multinode_rings.j2 b/tools/playbooks/multinode_setup/templates/make_multinode_rings.j2 index c1e05a83b4..fdb9b27352 100755 --- a/tools/playbooks/multinode_setup/templates/make_multinode_rings.j2 +++ b/tools/playbooks/multinode_setup/templates/make_multinode_rings.j2 @@ -2,7 +2,7 @@ set -e -cd /home/{{ ansible_ssh_user }}/rings +cd /home/{{ ansible_user }}/rings rm -f *.builder *.ring.gz backups/*.builder backups/*.ring.gz diff --git a/tools/playbooks/saio_single_node_setup/setup_saio.yaml b/tools/playbooks/saio_single_node_setup/setup_saio.yaml index c78cefda70..5353be184f 100644 --- a/tools/playbooks/saio_single_node_setup/setup_saio.yaml +++ b/tools/playbooks/saio_single_node_setup/setup_saio.yaml @@ -161,22 +161,22 @@ create: no - name: copy the SAIO scripts for resetting the environment - command: cp -r {{ zuul.project.src_dir }}/doc/saio/bin /home/{{ ansible_ssh_user }}/bin creates=/home/{{ ansible_ssh_user }}/bin + command: cp -r {{ zuul.project.src_dir }}/doc/saio/bin /home/{{ ansible_user }}/bin creates=/home/{{ ansible_user }}/bin - name: set the correct file mode for SAIO scripts - file: dest=/home/{{ ansible_ssh_user }}/bin mode=0777 recurse=yes + file: dest=/home/{{ ansible_user }}/bin mode=0777 recurse=yes - name: add new env. variable for loopback device - lineinfile: dest=/home/{{ ansible_ssh_user }}/.bashrc line="export SAIO_BLOCK_DEVICE=/srv/swift-disk" + lineinfile: dest=/home/{{ ansible_user }}/.bashrc line="export SAIO_BLOCK_DEVICE=/srv/swift-disk" - name: remove line from resetswift - lineinfile: dest=/home/{{ ansible_ssh_user }}/bin/resetswift line="sudo find /var/log/swift -type f -exec rm -f {} \;" state=absent + lineinfile: dest=/home/{{ ansible_user }}/bin/resetswift line="sudo find /var/log/swift -type f -exec rm -f {} \;" state=absent - name: add new env. variable for running tests - lineinfile: dest=/home/{{ ansible_ssh_user }}/.bashrc line="export SWIFT_TEST_CONFIG_FILE=/etc/swift/test.conf" + lineinfile: dest=/home/{{ ansible_user }}/.bashrc line="export SWIFT_TEST_CONFIG_FILE=/etc/swift/test.conf" - name: make sure PATH includes the bin directory - lineinfile: dest=/home/{{ ansible_ssh_user }}/.bashrc line="export PATH=${PATH}:/home/{{ ansible_ssh_user }}/bin" + lineinfile: dest=/home/{{ ansible_user }}/.bashrc line="export PATH=${PATH}:/home/{{ ansible_user }}/bin" - name: increase open files limit to run probe tests - lineinfile: dest=/home/{{ ansible_ssh_user }}/.bashrc line="ulimit -n 4096" + lineinfile: dest=/home/{{ ansible_user }}/.bashrc line="ulimit -n 4096"