ansible / galaxy

Legacy Galaxy still available as read-only on https://old-galaxy.ansible.com - looking for the new galaxy -> https://github.com/ansible/galaxy_ng
Apache License 2.0
849 stars 330 forks source link

Cannot import roles from GitHub Organzation with different user than the one in the organization namespace. #3363

Open varnishsoftware opened 2 weeks ago

varnishsoftware commented 2 weeks ago

Bug Report

SUMMARY

We have logged in in Ansible Galaxy using the user @varnishsoftware, which has access to our GitHub organization https://github.com/varnish.

We have requested a varnish namespace, which has been created for us to be managed by @varnishsoftware GitHub user in this issue https://github.com/ansible/galaxy/issues/3362

We want to use the @varnishsoftware user to import roles into varnish namespace from our GitHub Org repositories. Ansible Galaxy forms the clone url using the user varnishsoftware(https://github.com/varnishsoftware/) and the clone fails of course, because the organization namespace is varnish, and not varnishsoftware.

CLI for importing has no options to change the clone url. How can we achieve this? I suppose we are not the first ones requesting this, but we couldn't find any info in Ansible Galaxy docs.

Local ansible and ansible-galaxy version details:

ansible [core 2.17.0]
ansible-galaxy [core 2.17.0]
  config file = None
  python version = 3.12.4 (main, Jun  6 2024, 18:26:44) [Clang 15.0.0 (clang-1500.3.9.4)] 
  jinja version = 3.1.4
  libyaml = True
STEPS TO REPRODUCE
ansible-galaxy role import --api-key <REDACTED> varnish ansible-role-varnish-cache --role-name varnish-cache
ansible-galaxy role import --api-key <REDACTED> varnishsoftware ansible-role-varnish-cache --role-name varnish-cache
EXPECTED RESULTS

We would expect that it would be possible to import roles with a different user than the organization namespace one.

ACTUAL RESULTS

Import fails

#### Import using varnish (org namespace)will fail as the username is the org namespace and does not exist:
##################################################################################

ansible-galaxy role import --api-key <REDACTED> varnish ansible-role-varnish-cache --role-name varnish-cache
Successfully submitted import request 2077679198302395257752346447180680240
Starting import: task_id=2077679198302395257752346447180680240, pulp_id=0190257e-4a44-7571-b953-01a6367f4c30

==== PARAMETERS ====
importer username: varnishsoftware
matched user: varnishsoftware id:24725
github_user: varnish
github_repo: ansible-role-varnish-cache
github_reference: None
alternate_clone_url: None
alternate_namespace_name: None
alternate_role_name: varnish-cache

==== CHECK FOR MATCHING ROLE(S) ====
user:varnish repo:ansible-role-varnish-cache did not match any existing roles

===== CLONING REPO =====
cloning https://github.com/varnish/ansible-role-varnish-cache ...
cloning failed: Cloning into '/tmp/tmpwbqvjo59/ansible-role-varnish-cache'...
fatal: could not read Username for 'https://github.com': terminal prompts disabled

#### Import using varnishsoftware will fail as the username is used to create the clone url:
###################################################################

ansible-galaxy role import --api-key <REDACTED> varnishsoftware ansible-role-varnish-cache --role-name varnish-cache
Successfully submitted import request 2077679273391212899680576883024351274
Starting import: task_id=2077679273391212899680576883024351274, pulp_id=0190257f-3ce4-7912-8fad-ce28faae502a

==== PARAMETERS ====
importer username: varnishsoftware
matched user: varnishsoftware id:24725
github_user: varnishsoftware
github_repo: ansible-role-varnish-cache
github_reference: None
alternate_clone_url: None
alternate_namespace_name: None
alternate_role_name: varnish-cache

==== CHECK FOR MATCHING ROLE(S) ====
user:varnishsoftware repo:ansible-role-varnish-cache did not match any existing roles

===== CLONING REPO =====
cloning https://github.com/varnishsoftware/ansible-role-varnish-cache ...
cloning failed: Cloning into '/tmp/tmp6odfmzgs/ansible-role-varnish-cache'...
fatal: could not read Username for 'https://github.com': terminal prompts disabled
francomile commented 5 days ago

Can you please provide any feedback on this ticket please?