Disambiguate the roles of ci_testing, ci_testing_zuul etc

We currently use both ci_testing and ci_testing_zuul to define
whether we are being run from CI. However, ci_testing_zuul
required a hostname match to be defined, and ci_testing
depended on the ZUUL_CHANGES environment variable, set in
OpenStack CI. This was a little confusing.

This change splits up the boolean values which control
CI-related tasks in the following way:

ci_testing - Used for general-purpose CI tasks that are not
tied to the OpenStack CI infrastructure
ci_testing_zuul - Used for CI tasks that are specific to
the OpenStack CI infrastructure
ci_testing_zuul_changes - Used for CI tasks when
ZUUL_CHANGES is set.

Also, move away from the old hostname-based check to confirm
whether we are running under OpenStack CI as this could prove
to be fragile. Instead, look for the ZUUL_BRANCH environment
variable.

Change-Id: Ica8e84886c85911676c711ddcdd61604de8f3ee4
This commit is contained in:
stephane 2015-06-25 10:45:39 -07:00 committed by Julia Kreger
parent 8e5fd0748a
commit 39814e29e2
5 changed files with 16 additions and 9 deletions

View File

@ -23,6 +23,6 @@
command: git pull --ff-only chdir=/opt/stack/python-ironicclient
- name: "python-ironicclient - Apply CI changes if necessary"
script: parse_zuul_changes.py /opt/stack/python-ironicclient https://review.openstack.org openstack/python-ironicclient "{{ lookup('env', 'ZUUL_CHANGES') }}"
when: ci_testing == true
when: ci_testing_zuul_changes is defined
- name: "python-ironicclient - Installing patched python-ironicclient library."
command: pip install --force-reinstall /opt/stack/python-ironicclient

View File

@ -43,7 +43,7 @@
command: git pull --ff-only chdir=/opt/stack/ironic/
- name: "Ironic - Apply CI changes if necessary"
script: parse_zuul_changes.py /opt/stack/ironic https://review.openstack.org openstack/ironic "{{ lookup('env', 'ZUUL_CHANGES') }}"
when: ci_testing == true
when: ci_testing_zuul_changes is defined
- name: "Ironic Client - Install from source if configured to do so."
include: ironicclient_source_install.yml
when: skip_install is not defined and ((ironicclient_source_install is defined and ironicclient_source_install == true) or ci_testing == true)

View File

@ -23,6 +23,6 @@
command: git pull --ff-only chdir=/opt/stack/shade
- name: "Shade - Apply CI changes if necessary"
script: parse_zuul_changes.py /opt/stack/shade https://review.openstack.org openstack-infra/shade "{{ lookup('env', 'ZUUL_CHANGES') }}"
when: ci_testing == true
when: ci_testing_zuul_changes is defined
- name: "Shade - Installing patched shade library."
command: pip install --force-reinstall /opt/stack/shade

View File

@ -12,9 +12,14 @@
sudo: yes
gather_facts: yes
pre_tasks:
- name: "Set ci_testing flag if a list of changes are found in the environment variables"
- name: "Set ci_testing_zuul if it appears we are running in upstream OpenStack CI"
set_fact:
ci_testing: true
ci_testing_zuul: true
when: lookup('env', 'ZUUL_BRANCH') != ""
- name: "Set ci_testing_zuul_changes if ZUUL_CHANGES is set"
set_fact:
ci_testing_zuul_changes: true
when: lookup('env', 'ZUUL_CHANGES') != ""
- name: "Set ci_testing_zuul if it appears we are running in upstream OpenStack CI"
set_fact:
@ -30,6 +35,7 @@
shell: netstat -apn|grep LISTEN
when: ci_testing_zuul is defined
roles:
- role: bifrost-create-vm-nodes
- role: ironic-install
cleaning: false
testing: true

View File

@ -9,14 +9,15 @@
set_fact:
baremetal_csv_file: "/tmp/baremetal.csv"
when: baremetal_csv_file is not defined
- name: "Set ci_testing flag if a list of changes are found in the environment variables"
set_fact:
ci_testing: true
when: lookup('env', 'ZUUL_CHANGES') != ""
- name: "Set ci_testing_zuul if it appears we are running in upstream OpenStack CI"
set_fact:
ci_testing: true
ci_testing_zuul: true
when: "'bare-trusty' in ansible_hostname"
when: lookup('env', 'ZUUL_BRANCH') != ""
- name: "Set ci_testing_zuul_changes if ZUUL_CHANGES is set"
set_fact:
ci_testing_zuul_changes: true
when: lookup('env', 'ZUUL_CHANGES') != ""
- name: "Collect process list if running in OpenStack CI"
command: ps aux
when: ci_testing_zuul is defined