Failed role import to galaxy-ng

Bug Report

SUMMARY

I want to import a new version of my role into Galaxy

STEPS TO REPRODUCE
ansible-galaxy role import --token $(cat ~/.ansible-token) bodsch ansible-nginx
Successfully submitted import request 2051048527698290606629078391600408671
running
bodsch.nginx 0.9.0 has already been imported
  File "/venv/lib64/python3.11/site-packages/pulpcore/tasking/tasks.py", line 66, in _execute_task
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/app/galaxy_ng/app/api/v1/tasks.py", line 145, in legacy_role_import
    raise Exception(msg)

The latest released Tag are 0.22.3

EXPECTED RESULTS

The version I specified will be imported

ACTUAL RESULTS
ansible-galaxy role import -vvvvvv --token $(cat ~/.ansible-token) --branch "0.22.3" bodsch ansible-nginx
ansible-galaxy [core 2.15.4]
  config file = None
  configured module search path = ['/home/bodsch/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.11/site-packages/ansible
  ansible collection location = /home/bodsch/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible-galaxy
  python version = 3.11.5 (main, Sep  2 2023, 14:16:33) [GCC 13.2.1 20230801] (/usr/bin/python)
  jinja version = 3.1.2
  libyaml = True
No config file found; using defaults
Initial connection to galaxy_server: https://galaxy.ansible.com
Opened /home/bodsch/.ansible/galaxy_token
Calling Galaxy at https://galaxy.ansible.com/api/
Found API version 'v3, pulp-v3, v1' with Galaxy server default (https://galaxy.ansible.com/api/)
Calling Galaxy at https://galaxy.ansible.com/api/v1/imports/
Successfully submitted import request 2051048026056949700847675561756079610
Calling Galaxy at https://galaxy.ansible.com/api/v1/imports?id=2051048026056949700847675561756079610
running
Calling Galaxy at https://galaxy.ansible.com/api/v1/imports?id=2051048026056949700847675561756079610
bodsch.nginx 0.9.0 has already been imported
  File "/venv/lib64/python3.11/site-packages/pulpcore/tasking/tasks.py", line 66, in _execute_task
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/app/galaxy_ng/app/api/v1/tasks.py", line 145, in legacy_role_import
    raise Exception(msg)
1 Like

I see the same issue, you can import a role once, if it isn’t previously known to Galaxy. As of now you can’t update roles.

Collections work fine on the other hand, but that’s probably due to it receiving an artifact to process and import…

I can see the same issue. It seems like the latest version which is supposed to be imported is being resolved/sorted from the github tags “alphabetically”. Like for example “1.9.5” is higher than “1.24.3” because the third character is 9 vs. 2.

ansible-galaxy role import --api-key *** --server https://galaxy.ansible.com --branch main lablabs ansible-role-rke2
Successfully submitted import request 2051670272694773312054891301182841146
running
running
lablabs.rke2 1.9.5 has already been imported
  File "/venv/lib64/python3.11/site-packages/pulpcore/tasking/tasks.py", line 66, in _execute_task
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/app/galaxy_ng/app/api/v1/tasks.py", line 145, in legacy_role_import
    raise Exception(msg)
1 Like

These issues are being fixed in fix role imports with mismatched github_user by jctanner · Pull Request #1925 · ansible/galaxy_ng · GitHub

3 Likes

Thank you for the feedback!
Is there already a date when the fix will go live?

The errors I receive on my end have changed, I now receive this:

Successfully submitted import request 2052920556269238465263671269171824387
running
namespace thulium_drake is invalid
  File "/venv/lib64/python3.11/site-packages/pulpcore/tasking/tasks.py", line 66, in _execute_task
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/app/galaxy_ng/app/api/v1/tasks.py", line 224, in legacy_role_import
    result = import_legacy_role(checkout_path, namespace.name, importer_config, logger)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/galaxy_importer/legacy_role.py", line 51, in import_legacy_role
    return _import_legacy_role(dirname, namespace, cfg, logger)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/galaxy_importer/legacy_role.py", line 57, in _import_legacy_role
    data = LegacyRoleLoader(dirname, namespace, cfg, logger).load()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/galaxy_importer/loaders/legacy_role.py", line 39, in load
    self._validate_namespace()
  File "/venv/lib64/python3.11/site-packages/galaxy_importer/loaders/legacy_role.py", line 61, in _validate_namespace
    raise exc.ImporterError(f"namespace {self.namespace} is invalid")

Is that a different form of the same problem, or does this have a different cause?

Looks like the original issue was fixed in fix role imports with mismatched github_user by jctanner · Pull Request #1925 · ansible/galaxy_ng but it has not yet made it into a release yet?

@ltalirz galaxy.ansible.com is CI/CD with the master branch on GitHub - ansible/galaxy_ng: Galaxy NextGen so we don’t actually need to make releases for new code. The patch you are referring to went to production sometime early last week or the preceding weekend.

Did you run into a problem?

Thanks for the quick reply and the clarification @tannerjc !

The symptom I see is the same as the one in the issue that brought me to this thread

However, this is only at the level of the galaxy github action and it is possible that this action now fails in a different way (I don’t have verbose logs of what happens inside the action).

I’ll try uploading the role manually and report back.