From 2d9d24d07d73d959241f3a7e4ba50e83542ebed0 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Wed, 10 Aug 2022 18:53:00 +0000 Subject: [PATCH] Also pin pip/setuptools when creating Xenial venvs We still have some Ubuntu Xenial servers, so cap the max usable pip and setuptools versions in their venvs like we already do for Bionic, in order to avoid broken installations. Switch our conditionals from release name comparisons to version numbers in order to more cleanly support ranges. Also make sure the borg run test is triggered by changes to the create-venv role. Change-Id: I5dd064c37786c47099bf2da66b907facb517c92a --- playbooks/roles/create-venv/tasks/main.yaml | 16 ++++++++++++++-- zuul.d/system-config-run.yaml | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/playbooks/roles/create-venv/tasks/main.yaml b/playbooks/roles/create-venv/tasks/main.yaml index cf0b7c559a..85350a248b 100644 --- a/playbooks/roles/create-venv/tasks/main.yaml +++ b/playbooks/roles/create-venv/tasks/main.yaml @@ -2,10 +2,22 @@ assert: that: create_venv_path is defined +# Xenial's default pip will try to pull in packages that +# aren't compatible with 3.5. Cap them +- name: Setup bionic era venv + when: ansible_distribution_version is version('16.04', '==') + pip: + name: + - pip<21 + - setuptools<51 + state: latest + virtualenv: '{{ create_venv_path }}' + virtualenv_command: '/usr/bin/python3 -m venv' + # Bionic's default pip will try to pull in packages that # aren't compatible with 3.6. Cap them - name: Setup bionic era venv - when: ansible_distribution_release == 'bionic' + when: ansible_distribution_version is version('18.04', '==') pip: name: - pip<22 @@ -15,7 +27,7 @@ virtualenv_command: '/usr/bin/python3 -m venv' - name: Setup later era venv - when: ansible_distribution_release != 'bionic' + when: ansible_distribution_version is version('20.04', '>=') pip: name: - pip diff --git a/zuul.d/system-config-run.yaml b/zuul.d/system-config-run.yaml index eb5ead9920..c34fb69b26 100644 --- a/zuul.d/system-config-run.yaml +++ b/zuul.d/system-config-run.yaml @@ -392,6 +392,7 @@ - playbooks/bootstrap-bridge.yaml - playbooks/roles/install-borg - playbooks/roles/borg-backup + - playbooks/roles/create-venv - playbooks/zuul/templates/host_vars/borg-backup - testinfra/test_borg_backups.py host-vars: