From 475621bb26477255d4ba64ce56b6afca6ee19e92 Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Mon, 20 Nov 2023 16:43:21 +0000 Subject: [PATCH] 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 --- scripts/get-ansible-collection-requirements.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/get-ansible-collection-requirements.yml b/scripts/get-ansible-collection-requirements.yml index 83ab191428..b56bd7ee9e 100644 --- a/scripts/get-ansible-collection-requirements.yml +++ b/scripts/get-ansible-collection-requirements.yml @@ -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)) ] }}"