[build-test-packages] combine all methods of providing changes

The current implementation of build-test-packages allows for
precisely one method of providing what changes to build.
Either passing a artg_change_list dict directly via variable,
reading GERRIT vars from the env, or reading ZUUL vars from
the env.

This patch makes it possible for multiple of these methods to
be used without stomping on eachother. It is needed to be able
to run the gate which specifically exercises this role, but may
be useful in other scenarios as well.

Change-Id: Ib2290411865f9bb1a2804af64e85541530ae2e97
This commit is contained in:
John Trowbridge 2017-01-24 19:40:42 -05:00
parent 5c25c362df
commit d736c8ab19
3 changed files with 19 additions and 5 deletions

View File

@ -185,7 +185,7 @@ def resolve_dep(host, change_id, branch, revision):
'msg': ', '.join(output_msg)}
else:
return {'changed': True,
'ansible_facts': {'artg_change_list': deps},
'ansible_facts': {'jenkins_change_list': deps},
'msg': ', '.join(output_msg)}

View File

@ -39,7 +39,7 @@ def process(host, changes):
"branch": params[1],
"refspec": params[2]})
return {'changed': True,
'ansible_facts': {'artg_change_list': output}}
'ansible_facts': {'zuul_change_list': output}}
def main():

View File

@ -67,23 +67,37 @@
args:
chdir: '{{ ansible_user_dir }}/DLRN'
- name: get env variables for changes and default change list
set_fact:
gerrit_host: "{{ lookup('env', 'GERRIT_HOST') }}"
zuul_changes: "{{ lookup('env', 'ZUUL_CHANGES') }}"
artg_change_list: "{{ artg_change_list|default([]) }}"
- name: Parse Jenkins changes
jenkins_deps:
host: "{{ lookup('env', 'GERRIT_HOST') }}"
change_id: "{{ lookup('env', 'GERRIT_CHANGE_ID') }}"
branch: "{{ lookup('env', 'GERRIT_BRANCH') }}"
patchset_rev: "{{ lookup('env', 'GERRIT_PATCHSET_REVISION') }}"
when: artg_change_list is not defined and "{{ lookup('env', 'GERRIT_HOST') }}" != ""
when: gerrit_host != ""
- name: Add Jenkins changes to the change list
set_fact:
artg_change_list: "{{ artg_change_list|union(jenkins_change_list|default([])) }}"
- name: Parse Zuul changes
zuul_deps:
host: "{{ lookup('env', 'ZUUL_HOST')|default('review.openstack.org', true) }}"
changes: "{{ lookup('env', 'ZUUL_CHANGES') }}"
when: artg_change_list is not defined and "{{ lookup('env', 'ZUUL_CHANGES') }}" != ""
when: zuul_changes != ""
- name: Add Zuul changes to the change list
set_fact:
artg_change_list: "{{ artg_change_list|union(zuul_change_list|default([])) }}"
- name: Clone and build the specific DLRN projects
include: dlrn-build.yml artg_change={{ item }}
with_items: '{{ artg_change_list|default([]) }}'
with_items: '{{ artg_change_list }}'
when: item.project not in artg_skipped_projects
- block: