Ensure all pre-cloned git sources are found

Currently the find task only looks at one level deep
for repo folders, instead of the required three levels
deep.

Using the find module does not give us the ability to
set the depth level we want to do the find down to,
so we use a find command instead.

Change-Id: I0b218fe276292e13dbb40ab38c9a167025d16e45
This commit is contained in:
Jesse Pretorius 2017-10-31 09:38:55 +00:00 committed by Jesse Pretorius (odyssey4me)
parent a27ea8cfda
commit 56a4eb8ade

View File

@ -23,20 +23,32 @@
file:
state: directory
path: "{{ development_repo_directory }}"
# Git clones for developer testing are expected to be in the
# following structure, which mirrors how zuul v3 implements
# the clones:
#
# <user home directory>/src/<git organisation>/<repo>
#
# eg: /home/zuul/src/git.openstack.org/keystone
# /home/zuul/src/github.com/projectcalico/felix
#
- name: Check for repositories that are cloned in the repos directory
find:
paths: "{{ development_repo_directory }}/"
file_type: directory
command: "find {{ development_repo_directory }} -maxdepth 3 -mindepth 3 -type d"
register: projects_directory_find
tags:
- skip_ansible_lint
# For the constraint file we assume that the egg name
# matches the repo folder name.
- name: Set var for git install branch
copy:
dest: "{{ development_repo_directory }}/local-package-constraints-{{ test_branch | replace('/','_') }}.txt"
content: |
## Ansible Managed
{% if projects_directory_find.files is defined %}
{% for project in projects_directory_find.files %}
file://{{ project.path }}#egg={{ project.path.split("/")[-1] }}
{% for folder_path in projects_directory_find.stdout_lines %}
file://{{ folder_path }}#egg={{ folder_path.split("/")[-1] }}
{% endfor %}
{% endif %}
vars_files:
- test-vars.yml