Merge "Use ZUUL_SRC_PATH to pass the path to Zuul git sources"

This commit is contained in:
Zuul 2018-08-09 05:45:27 +00:00 committed by Gerrit Code Review
commit f59152b5b6
2 changed files with 16 additions and 6 deletions

View File

@ -36,16 +36,22 @@
- name: Use Zuul provided sources in Zuul environment - name: Use Zuul provided sources in Zuul environment
block: block:
- name: Set Zuul sources path
set_fact:
zuul_src_path: "{{ lookup('env', 'ZUUL_SRC_PATH') }}"
- name: Check the Zuul src dir for cloned roles - name: Check the Zuul src dir for cloned roles
stat: stat:
path: "/home/zuul/src/{{ item.src.split('/')[-3:] | join('/') }}" path: "{{ zuul_src_path }}/{{ item.src.split('/')[-3:] | join('/') }}"
get_attributes: no
get_checksum: no
get_mime: no
register: zuul_roles register: zuul_roles
when: when:
- item.scm == "git" or item.scm is undefined - item.scm == "git" or item.scm is undefined
with_items: "{{ required_roles }}" with_items: "{{ required_roles }}"
- name: Link the Zuul provided roles - name: Link the Zuul provided roles
file: file:
src: "/home/zuul/src/{{ item.item.src.split('/')[-3:] | join('/') }}" src: "{{ zuul_src_path }}/{{ item.item.src.split('/')[-3:] | join('/') }}"
dest: "{{ item.item.path | default(role_path_default) }}/{{ item.item.name | default(item.item.src | basename) }}" dest: "{{ item.item.path | default(role_path_default) }}/{{ item.item.name | default(item.item.src | basename) }}"
state: link state: link
owner: root owner: root
@ -54,7 +60,7 @@
| selectattr('stat.exists') | selectattr('stat.exists')
| list }}" | list }}"
when: when:
- "lookup('env', 'ZUUL_PROJECT') != ''" - "lookup('env', 'ZUUL_SRC_PATH') != ''"
- name: Clone git repos (with git) - name: Clone git repos (with git)
git: git:

View File

@ -1,5 +1,9 @@
- hosts: all - hosts: all
tasks: tasks:
- name: Set the Zuul sources path
set_fact:
zuul_src_path: "{{ ansible_user_dir }}/src"
- name: Set current test repo (cross-repo) - name: Set current test repo (cross-repo)
set_fact: set_fact:
current_test_repo: "git.openstack.org/{{ osa_test_repo }}" current_test_repo: "git.openstack.org/{{ osa_test_repo }}"
@ -19,7 +23,7 @@
args: args:
chdir: "src/{{ current_test_repo }}" chdir: "src/{{ current_test_repo }}"
environment: environment:
# ZUUL_PROJECT is used by tests/get-ansible-role-requirements to # ZUUL_SRC_PATH is used by tests/get-ansible-role-requirements to
# determine when CI provided repos should be used. # where the CI provided git sources were cloned.
ZUUL_PROJECT: "{{ zuul.project.short_name }}" ZUUL_SRC_PATH: "{{ zuul_src_path }}"
ANSIBLE_PACKAGE: "{{ ansible_package | default('') }}" ANSIBLE_PACKAGE: "{{ ansible_package | default('') }}"