From ab69cca0cea475a4caa0351af3ad65e2ee226368 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Thu, 9 Jul 2020 12:06:30 +0200 Subject: [PATCH] Get rid of ci_testing variable in roles The roles should not change their behavior based on the presence of Zuul. Use the existing copy_from_local_path variable to copy pre-cached repositories. Also get rid of the redundant ci_testing_zuul. Change-Id: Idfdfe2087b020cd8069d1088991e088873783825 --- .../roles/bifrost-create-vm-nodes/defaults/main.yml | 1 - .../roles/bifrost-create-vm-nodes/tasks/main.yml | 11 ++--------- .../roles/bifrost-ironic-install/defaults/main.yml | 1 - playbooks/roles/bifrost-prep-for-install/README.md | 5 ----- .../roles/bifrost-prep-for-install/defaults/main.yml | 1 - .../roles/bifrost-prep-for-install/tasks/main.yml | 4 ++-- playbooks/test-bifrost-create-vm.yaml | 7 ++++--- playbooks/test-bifrost.yaml | 10 +++++----- releasenotes/notes/ci-testing-faa63db25ebc94df.yaml | 9 +++++++++ 9 files changed, 22 insertions(+), 27 deletions(-) create mode 100644 releasenotes/notes/ci-testing-faa63db25ebc94df.yaml diff --git a/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml b/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml index 2b41a0ba3..e58dc39d7 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml +++ b/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml @@ -52,4 +52,3 @@ force_update_repos: 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 888d59499..8e9aadf40 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml +++ b/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml @@ -77,13 +77,6 @@ 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: @@ -100,11 +93,11 @@ version: "{{ reqs_git_branch }}" update: "{{ update_repos | bool }}" clone: yes - when: ci_testing_zuul | bool == false and copy_from_local_path | bool == false + when: 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 + when: copy_from_local_path | bool - include: prepare_libvirt.yml diff --git a/playbooks/roles/bifrost-ironic-install/defaults/main.yml b/playbooks/roles/bifrost-ironic-install/defaults/main.yml index 9fd83b09e..60ac58aa1 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/main.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/main.yml @@ -27,7 +27,6 @@ transform_boot_image: false # If testing is true, then the environment is setup for using libvirt # virtual machines for the hardware instead of real hardware. testing: false -ci_testing: false # Use Rabbit MQ as a message bus. use_rabbitmq: false diff --git a/playbooks/roles/bifrost-prep-for-install/README.md b/playbooks/roles/bifrost-prep-for-install/README.md index bd1b7fdc0..a793a4c51 100644 --- a/playbooks/roles/bifrost-prep-for-install/README.md +++ b/playbooks/roles/bifrost-prep-for-install/README.md @@ -80,11 +80,6 @@ copy_from_local_path: Boolean value, defaults to false. If set to true, pre-existing repository state. This is largely something that is needed in CI testing if dependent changes are pre-staged in the local repositories. - -ci_testing_zuul: Boolean value, default false. This value is utilized - to tell the preparatory playbook when the prep role - is running in a CI system with Zuul, which in such - cases the repositories must be copied, not overwritten. Dependencies ------------ diff --git a/playbooks/roles/bifrost-prep-for-install/defaults/main.yml b/playbooks/roles/bifrost-prep-for-install/defaults/main.yml index 887e0e832..1fb943f7b 100644 --- a/playbooks/roles/bifrost-prep-for-install/defaults/main.yml +++ b/playbooks/roles/bifrost-prep-for-install/defaults/main.yml @@ -55,7 +55,6 @@ force_update_repos: true # Conditional variables utilized based on CI or manual testing options. copy_from_local_path: false -ci_testing_zuul: false bifrost_install_sources: - git_folder: "{{ ironic_git_folder }}" diff --git a/playbooks/roles/bifrost-prep-for-install/tasks/main.yml b/playbooks/roles/bifrost-prep-for-install/tasks/main.yml index 3fd31d8b2..e1c5b4976 100644 --- a/playbooks/roles/bifrost-prep-for-install/tasks/main.yml +++ b/playbooks/roles/bifrost-prep-for-install/tasks/main.yml @@ -30,9 +30,9 @@ update: "{{ update_repos | bool }}" clone: yes loop: "{{ bifrost_install_sources }}" - when: ci_testing_zuul | bool == false and copy_from_local_path | bool == false and item.source_install | default(true) | bool + when: copy_from_local_path | bool == false and item.source_install | default(true) | bool - name: "Copy from local path" command: cp -a {{ item.git_url }} {{ item.git_folder }} creates={{ item.git_folder }} loop: "{{ bifrost_install_sources }}" - when: (ci_testing_zuul | bool == true or copy_from_local_path | bool == true) and item.source_install | default(true) | bool + when: copy_from_local_path | bool == true and item.source_install | default(true) | bool diff --git a/playbooks/test-bifrost-create-vm.yaml b/playbooks/test-bifrost-create-vm.yaml index 760dda641..65ced2d11 100644 --- a/playbooks/test-bifrost-create-vm.yaml +++ b/playbooks/test-bifrost-create-vm.yaml @@ -24,13 +24,14 @@ - name: "Set ci_testing flag if running in the CI" set_fact: ci_testing: true - ci_testing_zuul: true + copy_from_local_path: true + reqs_git_url: "{{ lookup('env', 'WORKSPACE') }}/openstack/requirements" when: lookup('env', 'ZUUL_BRANCH') | length > 0 - name: "Collect process list if running in OpenStack CI" command: ps aux - when: ci_testing_zuul is defined + when: ci_testing | default(false)| bool - name: "Collect list of listening network sockets if running in OpenStack CI" shell: netstat -apn|grep LISTEN - when: ci_testing_zuul is defined + when: ci_testing | default(false)| bool roles: - role: bifrost-create-vm-nodes diff --git a/playbooks/test-bifrost.yaml b/playbooks/test-bifrost.yaml index bc08eb9ad..7ec82e278 100644 --- a/playbooks/test-bifrost.yaml +++ b/playbooks/test-bifrost.yaml @@ -12,10 +12,10 @@ become: no gather_facts: yes pre_tasks: - - name: "Set ci_testing_zuul if it appears we are running in upstream OpenStack CI" + - name: "Set ci_testing and other variables if it appears we are running in upstream OpenStack CI" set_fact: ci_testing: true - ci_testing_zuul: true + copy_from_local_path: true ironic_git_url: "{{ lookup('env', 'WORKSPACE') }}/openstack/ironic" ironicclient_git_url: "{{ lookup('env', 'WORKSPACE') }}/openstack/python-ironicclient" openstacksdk_git_url: "{{ lookup('env', 'WORKSPACE') }}/openstack/openstacksdk" @@ -46,14 +46,14 @@ pre_tasks: - name: "Collect process list if running in a CI System" command: ps aux - when: ci_testing is defined + when: ci_testing | default(false)| bool - name: "Collect list of listening network sockets if running in a CI system" shell: netstat -apn|grep LISTEN - when: ci_testing is defined + when: ci_testing | default(false)| bool - name: "Use a cached cirros image" set_fact: cirros_deploy_image_upstream_url: file:///opt/cache/files/cirros-0.4.0-x86_64-disk.img - when: ci_testing is defined and ci_testing_zuul is defined and ci_testing_zuul | bool + when: ci_testing | default(false)| bool roles: - role: bifrost-keystone-install - role: bifrost-ironic-install diff --git a/releasenotes/notes/ci-testing-faa63db25ebc94df.yaml b/releasenotes/notes/ci-testing-faa63db25ebc94df.yaml new file mode 100644 index 000000000..9955b3441 --- /dev/null +++ b/releasenotes/notes/ci-testing-faa63db25ebc94df.yaml @@ -0,0 +1,9 @@ +--- +upgrade: + - | + The variable ``ci_testing`` is no longer taken into account by the roles. + Use the existing ``copy_from_local_path`` if you need Bifrost to copy + repositories from their pre-cached locations. +other: + - | + The variable ``ci_testing_zuul`` is no longer used or set.