Allow installing collections from repos containing more than one

A git repo may contain one collection, several collections at
the top level or be organised into namespace/collection named
directories. See [1].

The '#' symbol is used to identify a particular collection from
a repository to install. This patch ensures that the paths
searched in CI for zuul source directories do not include parameters
beyond the '#' symbol, and that the contents of the collection
requirements file is also correct for installing any required
collections using the 'dir' type.

[1] https://docs.ansible.com/ansible/latest/dev_guide/developing_collections_distributing.html#specifying-the-collection-location-within-the-git-repository

Change-Id: I081212819c61b46c2ad143025e7287cd3ce5390a
This commit is contained in:
Jonathan Rosser 2023-11-20 16:43:21 +00:00
parent 038dd1b41b
commit 475621bb26

View File

@ -49,7 +49,7 @@
- name: Check the Zuul src dir for cloned collections
stat:
path: "{{ zuul_src_path }}/{{ item.source.split('/')[-3:] | join('/') }}"
path: "{{ zuul_src_path }}/{{ item.source.split('/')[2:] | join('/') | split('#') | first }}"
get_attributes: no
get_checksum: no
get_mime: no
@ -60,7 +60,7 @@
vars:
zuul_item:
name: "{{ item.item.name }}"
source: "{{ zuul_src_path }}/{{ item.item.source.split('/')[-3:] | join('/') }}"
source: "{{ zuul_src_path }}/{{ item.item.source.split('/')[2:] | join('/') | replace('#', '') }}"
type: "dir"
set_fact:
galaxy_collections_list_ci: "{{ galaxy_collections_list_ci | default([]) + [ (item.stat.exists | ternary(zuul_item, item.item)) ] }}"