Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • A ansible-roles-ctl
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OSCI
  • ansible-roles-ctl
  • Issues
  • #1
Closed
Open
Issue created Mar 22, 2022 by Fabian Arrotin@arrfab

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

Assignee
Assign to
Time tracking