diff --git a/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml b/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml index 06c6f7b20..9ab562bdb 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml +++ b/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml @@ -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 diff --git a/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml b/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml index 78b0510a7..0413126ce 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml +++ b/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml @@ -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 diff --git a/scripts/test-bifrost.sh b/scripts/test-bifrost.sh index 418f35dbc..57b31c319 100755 --- a/scripts/test-bifrost.sh +++ b/scripts/test-bifrost.sh @@ -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