Merge "Use upper-constraints in the Tobiko ansible roles"

This commit is contained in:
Zuul 2024-03-18 16:21:38 +00:00 committed by Gerrit Code Review
commit 205b496e37
4 changed files with 44 additions and 5 deletions

View File

@ -1,8 +1,16 @@
---
- name: "check if upper-constraints file exists"
stat:
path: "{{ openstack_requirements_dir }}/upper-constraints.txt"
register: upper_constraints_file
- name: "ensure Bindep is installed"
command: >
'{{ python_executable }}' -m pip install --user 'bindep>={{ bindep_min_version }}'
'{{ python_executable }}' -m pip install \
{% if upper_constraints_file.stat.exists == true %}-c'{{ upper_constraints_file.stat.path }}'{% endif %} \
--user bindep>='{{ bindep_min_version }}'
register: install_bindep
changed_when: "'Successfully installed' in install_bindep.stdout"

View File

@ -18,6 +18,8 @@ test_project:
test_git_repo: '{{ git_base }}/x/tobiko.git'
test_src_dir: ''
openstack_requirements_dir: "/opt/stack/requirements"
# NOTE: if test_dir and tobiko_dir variables endup being the same actual
# directory then test_src and test_git_* variables will be overriden

View File

@ -57,10 +57,17 @@
failed_when: (python_info | length) == 0
- name: "check if upper-constraints file exists"
stat:
path: "{{ openstack_requirements_dir }}/upper-constraints.txt"
register: upper_constraints_file
- name: "upgrade '{{ python_command }}' packages to the latest versions"
command: >
'{{ python_info[python_command].executable }}' -m pip install '{{ item }}' \
--upgrade --user
'{{ python_info[python_command].executable }}' -m pip install \
{% if upper_constraints_file.stat.exists == true %}-c'{{ upper_constraints_file.stat.path }}'{% endif %}
'{{ item }}' --upgrade --user
register: upgrade_python_packages
changed_when:
"'Successfully installed' in upgrade_python_packages.stdout"

View File

@ -1,9 +1,31 @@
---
- name: "check if upper-constraints file exists"
stat:
path: "{{ openstack_requirements_dir }}/upper-constraints.txt"
register: upper_constraints_file
- name: "Determine min tox version to be installed"
when: upper_constraints_file.stat.exists == true
block:
- name: "Check requirements repo branch"
ansible.builtin.command:
cmd: git rev-parse --abbrev-ref HEAD
chdir: "{{ openstack_requirements_dir }}"
register: requirements_branch
- name: "Set min tox version for Ubuntu 20.04"
set_fact:
tox_min_version: "3.28"
when: requirements_branch.stdout == "stable/2023.1" or "stable/zed"
- name: "ensure Tox is installed"
command: >
{{ python_executable }} -m pip install --user
'tox>={{ tox_min_version }}{% if tox_max_version is not none %},<={{ tox_max_version }}{% endif %}'
'{{ python_executable }}' -m pip install \
{% if upper_constraints_file.stat.exists is true %}-c'{{ upper_constraints_file.stat.path }}'{% endif %} \
--user 'tox>={{ tox_min_version }}{% if tox_max_version is not none %},<={{ tox_max_version }}{% endif %}'
register: install_tox
changed_when: "'Successfully installed' in install_tox.stdout"