ansible-roles-ctl doesn't fetch collection through git commit/tags
Per discussion on irc, actual version of ansible-roles-ctl in master branch doesn't fetch collections using git commits/tags, like ansible-galaxy does. Example: (minimum requirements.yml file, just for the example) ``` cat requirements.yml ; ~/bin/ansible-roles-ctl status ; ~/bin/ansible-roles-ctl install --- roles: - src: https://github.com/CentOS/ansible-role-baseline name: baseline version: staging collections: - name: community.general type: git source: https://github.com/ansible-collections/community.general.git version: 4.5.0 role 'baseline' is properly installed, targeting branch 'staging' is up-to-date with origin collection 'community.general' is not installed role 'baseline' is already installed collection 'community.general' installation failed: 'TagReference' object has no attribute 'checkout' ``` It seems that then it just fetch from main development branch (main) and so installed version is then : ``` ansible-galaxy collection list # /home/arrfab/ansible/test/collections/ansible_collections Collection Version ----------------- ------- community.general 4.7.0 ``` Worth knowing that it works with a branch name instead but ansible collections (main ones) are using tags/commits and `ansible-galaxy` supports installing correct collection version using the same requirements.yml file : ``` rm -Rf collections/ ; mkdir collections ; ansible-galaxy collection install -r requirements.yml ; ansible-galaxy collection list Starting galaxy collection install process Process install dependency map Cloning into '/home/arrfab/.ansible/tmp/ansible-local-434227zwuckg4/tmp1whllz__/community.generali29s4xwh'... remote: Enumerating objects: 42718, done. remote: Counting objects: 100% (2839/2839), done. remote: Compressing objects: 100% (1356/1356), done. remote: Total 42718 (delta 1836), reused 2184 (delta 1377), pack-reused 39879 Receiving objects: 100% (42718/42718), 16.17 MiB | 24.45 MiB/s, done. Resolving deltas: 100% (26938/26938), done. Note: switching to '4.5.0'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example: git switch -c <new-branch-name> Or undo this operation with: git switch - Turn off this advice by setting config variable advice.detachedHead to false HEAD is now at 631d555f Release 4.5.0. Starting collection install process Installing 'community.general:4.5.0' to '/home/arrfab/ansible/test/collections/ansible_collections/community/general' Created collection for community.general:4.5.0 at /home/arrfab/ansible/test/collections/ansible_collections/community/general community.general:4.5.0 was installed successfully # /home/arrfab/ansible/test/collections/ansible_collections Collection Version ----------------- ------- community.general 4.5.0 ``` That would be really great to have ansible-roles-ctl supporting fetching correct version/tag for collections, and then also update in case it's updated in the requirements.yml file
issue