Check out global requirements when creating test VMs

As part of the test VM preparation, we need to use upper-constraints.

Change-Id: I5aaab91f0590c49972e5eb03d1c70559698b2f39
This commit is contained in:
Dmitry Tantsur 2020-01-28 16:48:25 +01:00
parent fdeefa810f
commit 6da10694af
3 changed files with 39 additions and 8 deletions

View File

@ -40,5 +40,14 @@ bifrost_venv_dir: "{{ lookup('env', 'VENV') | default('/opt/stack/bifrost') }}"
bifrost_venv_env:
VIRTUAL_ENV: "{{ bifrost_venv_dir }}"
PATH: "{{ bifrost_venv_dir }}/bin:{{ ansible_env.PATH }}" # include regular path via lookup env
reqs_git_folder: /opt/stack/requirements
git_branch: master
git_root: "/opt/stack"
reqs_git_url: https://opendev.org/openstack/requirements
reqs_git_folder: "{{ git_root }}/requirements"
reqs_git_branch: "{{ git_branch }}"
upper_constraints_file: "{{ lookup('env', 'UPPER_CONSTRAINTS_FILE') | default(reqs_git_folder + '/upper-constraints.txt', True) }}"
# Conditional variables utilized based on CI or manual testing options.
copy_from_local_path: false
ci_testing_zuul: false

View File

@ -88,6 +88,35 @@
vars:
ansible_python_interpreter: '/usr/bin/python3'
- name: "Set ci_testing_zuul if it appears we are running in upstream OpenStack CI"
set_fact:
ci_testing: true
ci_testing_zuul: true
reqs_git_url: "{{ lookup('env', 'WORKSPACE') }}/openstack/requirements"
when: lookup('env', 'ZUUL_BRANCH') | length > 0
- name: ensure installation root folder exists
become: yes
file:
state: directory
dest: "{{ git_root }}"
owner: "{{ ansible_user_id }}"
group: "{{ ansible_user_gid }}"
- name: download requirements via git
git:
dest: "{{ reqs_git_folder }}"
force: yes
repo: "{{ reqs_git_url }}"
version: "{{ reqs_git_branch }}"
update: yes
clone: yes
when: ci_testing_zuul | bool == false and copy_from_local_path | bool == false
- name: copy requirements from local path
command: cp -a {{ reqs_git_url }} {{ reqs_git_folder }} creates={{ reqs_git_folder }}
when: ci_testing_zuul | bool == true or copy_from_local_path | bool == true
- include: prepare_libvirt.yml
- name: truncate explicit list of vm names

View File

@ -127,13 +127,6 @@ logs_on_exit() {
}
trap logs_on_exit EXIT
# Clone the requirements repo if we don't already have
# a copy. This is provided by OpenStack CI jobs, but
# is not automatically present when doing local testing.
if [ ! -d "$ANSIBLE_INSTALL_ROOT/requirements" ]; then
cd $ANSIBLE_INSTALL_ROOT
git clone http://opendev.org/openstack/requirements
fi
# Change working directory
cd $BIFROST_HOME/playbooks