diff --git a/bindep.txt b/bindep.txt index 784c912c3..1036ca3da 100644 --- a/bindep.txt +++ b/bindep.txt @@ -22,7 +22,10 @@ libselinux-python [platform:rhel-7] libselinux-python [platform:centos-7] python-devel [platform:rhel-7] python-devel [platform:centos-7] +python-pip [platform:centos-7] +python-pip [platform:rhel-7] python-virtualenv [platform:centos-7] +python-virtualenv [platform:rhel-7] # RHEL/CentOS 8 python3-libselinux [platform:rhel-8] diff --git a/infrared_plugin/plugin.spec b/infrared_plugin/plugin.spec index 4d7a6a0c1..5f38fdf13 100644 --- a/infrared_plugin/plugin.spec +++ b/infrared_plugin/plugin.spec @@ -163,6 +163,10 @@ subparsers: type: Value help: test cases log file ansible_variable: test_log_file + upper-constraints-file: + type: Value + help: URL or path to upper contraints file + ansible_variable: upper_constraints_file - title: Collect stage options: diff --git a/roles/tests/Vagrantfile b/roles/tests/Vagrantfile index 1d28dcbb8..01f799dc9 100644 --- a/roles/tests/Vagrantfile +++ b/roles/tests/Vagrantfile @@ -18,6 +18,9 @@ TOX_INI_DIR = '../..' TEST_DIR = File.dirname(__FILE__) +UPPER_CONSTRAINTS_FILE = ENV.fetch( + "UPPER_CONSTRAINTS_FILE", + "https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt") # list of VMs NODES = { @@ -120,6 +123,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| node.vm.provision "ansible" do |ansible| ansible.limit = 'all' ansible.playbook = playbook_file + ansible.extra_vars = { + 'upper_constraints_file' => UPPER_CONSTRAINTS_FILE, + } end end end diff --git a/roles/tests/test_infrared_plugin.yaml b/roles/tests/test_infrared_plugin.yaml index d0e4e4ed3..72e54bff7 100644 --- a/roles/tests/test_infrared_plugin.yaml +++ b/roles/tests/test_infrared_plugin.yaml @@ -16,12 +16,14 @@ state: absent - name: "run Tox InfraRed plugin" - command: > - '{{ tox_executable }}' -e infrared -- - --host secondary - --collect-dir '{{ test_collect_dir }}' - args: + command: + cmd: > + '{{ tox_executable }}' -e infrared -- + --host secondary + --collect-dir '{{ test_collect_dir }}' chdir: /vagrant + environment: + UPPER_CONSTRAINTS_FILE: '{{ remote_constraints_file }}' ignore_errors: yes register: run_tox diff --git a/roles/tobiko-common/defaults/main.yaml b/roles/tobiko-common/defaults/main.yaml index 2bd3c5eb5..86e8318d2 100644 --- a/roles/tobiko-common/defaults/main.yaml +++ b/roles/tobiko-common/defaults/main.yaml @@ -63,3 +63,10 @@ test_log_file: '{{ test_report_dir | realpath }}/tobiko.log' # Local where test cases results are being collected to test_collect_dir: '{{ test_src_dir | realpath }}/{{ test_report_name }}' + + +# --- Workaround compatibility issues ----------------------------------------- + +upper_constraints_file: + 'https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt' + diff --git a/roles/tobiko-ensure-python3/tasks/constraints.yaml b/roles/tobiko-ensure-python3/tasks/constraints.yaml new file mode 100644 index 000000000..4633f038b --- /dev/null +++ b/roles/tobiko-ensure-python3/tasks/constraints.yaml @@ -0,0 +1,35 @@ +--- + +- block: + + - name: "look at remote host constraints file '{{ upper_constraints_file }}'" + stat: + path: '{{ upper_constraints_file | realpath }}' + when: "not upper_constraints_file.startswith('http')" + register: stat_upper_constraints_file + failed_when: 'not stat_upper_constraints_file.stat.exists' + + - name: "set remote upper constraints file path" + set_fact: + remote_constraints_file: '{{ upper_constraints_file }}' + + rescue: + - name: "create temporary upper requirements file" + tempfile: + state: file + suffix: .txt + register: create_upper_constraints_file + + - debug: var=create_upper_constraints_file + + - name: "copy upper requirements file" + copy: + src: '{{ upper_constraints_file }}' + dest: '{{ create_upper_constraints_file.path }}' + mode: "0644" + + - name: "set remote upper constraints file path" + set_fact: + remote_constraints_file: '{{ create_upper_constraints_file.path }}' + + - debug: var=upper_constraints_file diff --git a/roles/tobiko-ensure-python3/tasks/install.yaml b/roles/tobiko-ensure-python3/tasks/install.yaml index 6429f34bf..5a1b39153 100644 --- a/roles/tobiko-ensure-python3/tasks/install.yaml +++ b/roles/tobiko-ensure-python3/tasks/install.yaml @@ -37,11 +37,12 @@ - name: "upgrade '{{ python_command }}' packages to the latest versions" command: > '{{ python_info[python_command].executable }}' -m pip install '{{ item }}' \ - --upgrade --user + --upgrade --user -c '{{ remote_constraints_file }}' loop: - pip - setuptools - wheel + - virtualenv - name: "show python_info facts" diff --git a/roles/tobiko-ensure-python3/tasks/python3.yaml b/roles/tobiko-ensure-python3/tasks/python3.yaml index 1fcb6dcfc..a8feaba2d 100644 --- a/roles/tobiko-ensure-python3/tasks/python3.yaml +++ b/roles/tobiko-ensure-python3/tasks/python3.yaml @@ -14,6 +14,9 @@ - (python_version | string).split(".")[0] == '3' +- include_tasks: constraints.yaml + + - include_tasks: install.yaml vars: python_command: '{{ python3_command }}' diff --git a/roles/tobiko-tox/defaults/main.yaml b/roles/tobiko-tox/defaults/main.yaml index b592f37f1..b827d6adf 100644 --- a/roles/tobiko-tox/defaults/main.yaml +++ b/roles/tobiko-tox/defaults/main.yaml @@ -18,4 +18,7 @@ tox_report_env: TOBIKO_TEST_REPORT_DIR: '{{ tox_report_dir }}' TOBIKO_TEST_REPORT_NAME: '{{ tox_report_name }}' -tox_constrain_env: {} +tox_constraints_file: '{{ remote_constraints_file }}' + +tox_constrain_env: + UPPER_CONSTRAINTS_FILE: '{{ tox_constraints_file }}' diff --git a/tox.ini b/tox.ini index c6b3c8997..e129dd021 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,7 @@ minversion = 3.4.0 [base] deps = - -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} + -c{env:UPPER_CONSTRAINTS_FILE} -r{toxinidir}/requirements.txt passenv = PS1 @@ -18,11 +18,12 @@ setenv = OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true} OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:true} OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true} + PS1=[tobiko@{envname}] {env:PS1:} PYTHON={env:PYTHON:python3} PYTHONWARNINGS=ignore::Warning,{env:PYTHONWARNINGS:} TOBIKO_PREVENT_CREATE={env:TOBIKO_PREVENT_CREATE:false} VIRTUAL_ENV={envdir} - PS1=[tobiko@{envname}] {env:PS1:} + UPPER_CONSTRAINTS_FILE={env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} commands = stestr run {posargs} @@ -188,7 +189,7 @@ whitelist_externals = rm deps = - -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} + -c{env:UPPER_CONSTRAINTS_FILE} -rinfrared-requirements.txt passenv = {[testenv:venv]passenv} @@ -213,6 +214,7 @@ commands = ir tobiko \ --tobiko-src-dir {toxinidir} \ --collect-dir '{toxinidir}/test_results' \ + --upper-constraints '{env:UPPER_CONSTRAINTS_FILE}' \ {posargs} diff --git a/zuul.d/devstack.yaml b/zuul.d/devstack.yaml index 3f26ba138..0804b6f32 100644 --- a/zuul.d/devstack.yaml +++ b/zuul.d/devstack.yaml @@ -12,6 +12,7 @@ - openstack/devstack-gate - openstack/heat - openstack/neutron + - openstack/requirements - x/tobiko timeout: 7200 vars: @@ -68,6 +69,7 @@ yaml: true yml: true tobiko_dir: '/opt/stack/tobiko' + upper_constraints_file: '{{ ansible_user_dir }}/src/opendev.org/openstack/requirements/upper-constraints.txt' pre-run: playbooks/devstack/pre.yaml run: playbooks/devstack/run.yaml diff --git a/zuul.d/infrared.yaml b/zuul.d/infrared.yaml index e06d8a44e..17e360f6d 100644 --- a/zuul.d/infrared.yaml +++ b/zuul.d/infrared.yaml @@ -10,18 +10,20 @@ pre-run: playbooks/infrared/pre.yaml run: playbooks/infrared/run.yaml required-projects: - x/tobiko + - name: openstack/requirements + - name: x/tobiko vars: test_collect_dir: '{{ zuul_output_dir }}/logs' test_inventory_file: '{{ zuul_work_dir }}/ansible_hosts' tox_envlist: infrared tox_extra_args: -- --host secondary --collect-dir {{ test_collect_dir | quote }} + tox_constraints_file: '{{ upper_constraints_file }}' + upper_constraints_file: '{{ ansible_user_dir }}/src/opendev.org/openstack/requirements/upper-constraints.txt' tox_environ: ANSIBLE_INVENTORY: '{{ test_inventory_file }}' zuul_output_dir: '{{ ansible_user_dir }}/zuul-output' zuul_work_dir: "{{ zuul.projects['opendev.org/x/tobiko'].src_dir }}" - - job: name: tobiko-tox-infrared-centos-7 parent: tobiko-tox-infrared diff --git a/zuul.d/tripleo.yaml b/zuul.d/tripleo.yaml index 8c664381f..506d0d103 100644 --- a/zuul.d/tripleo.yaml +++ b/zuul.d/tripleo.yaml @@ -4,9 +4,9 @@ description: Base Tobiko TripleO job parent: tripleo-ci-centos-8-scenario002-standalone required-projects: + - openstack/requirements - openstack/tripleo-ci - x/tobiko - pre-run: playbooks/tripleo/pre.yaml run: playbooks/tripleo/run.yaml post-run: playbooks/tripleo/post.yaml @@ -14,6 +14,7 @@ test_conf: keystone: cloud_name: standalone + upper_constraints_file: '{{ ansible_user_dir }}/src/opendev.org/openstack/requirements/upper-constraints.txt' featureset: '052' featureset_override: run_tempest: false