Galaxy import successful but latest versions error to download

I found a report of this error [role import] Unexpected behaviour - role missing with inconsistent information · Issue #3303 · ansible/galaxy · GitHub but it was requested to create a thread here.

Basically, I uploaded version 3.1.0 of staticdev.python_developer role using GA (as always) and when it try to download it says it doesn’t exist despite I checked in the logs and upload was successful. Also from Galaxy login I can see the successful import.

It seems to be happening with more people and other roles also.

EDIT: I see what you are saying if I run ansible-galaxy role install -p roles --force staticdev.python_developer,3.1.0

It kind of seems like a CDN issue. When I load the role in the UI, the api response for versions says there are 39 versions.

When I curl the role from the API it says 38 versions.

(venv) [jtanner@p1 deleteme]$ curl -s -L http://galaxy.ansible.com/api/v1/roles/27179/versions/ | jq . | head -n 25
{
  "count": 38,
  "next": null,
  "next_link": null,
  "previous": null,
  "previous_link": null,
  "results": [
    {
      "id": "797f3edb-83b2-4f2b-b010-73449cb10033",
      "name": "0.1.0",
      "version": "0.1.0",
      "created": "2021-06-07T17:12:19.467498Z",
      "modified": "2021-06-07T17:12:19.467530Z",
      "commit_date": "2021-01-05T15:27:59-05:00",
      "commit_sha": "4936e45151ce422e67a75e526fdf7ef65efa37a8",
      "download_url": "https://github.com/staticdev/ansible-role-python-developer/archive/0.1.0.tar.gz"
    },

Ah, there’s two different roles … staticdev.python-developer and staticdev.python_developer

In the import log, it shows the client passed in python-developer as the alternate_role_name which took precedence over any other possibilities…

==== PARAMETERS ==== 
importer username: staticdev 
matched user: staticdev id:6381 
github_user: staticdev 
github_repo: ansible-role-python-developer 
github_reference: None 
alternate_clone_url: None 
alternate_namespace_name: None 
alternate_role_name: python-developer 

So now we have staticdev.python-developer AND staticdev.python_developer

The latter is the one you have always maintained whereas the former is the new one created by the import.

To get 3.1.0 into staticdev.python_developer, you need to import with these args …

ansible-galaxy role import --role-name=python_developer staticdev ansible-role-python-developer

Afterwards you can delete the incorrect role by it’s ID …

curl -X DELETE -H 'Authorization: token <YOUR_GALAXY_TOKEN>' https://galaxy.ansible.com/api/v1/roles/37626/

We’ve been discussing these new behaviors in the announcement thread here Ansible Galaxy’s role import enhancements and fixes for the new year - #9 by githubixx

1 Like

@tannerjc thanks for analysing the issue. I will then put my comments on the thread you mentioned.

Hey @tannerjc

Thank you for providing steps to resolve this issue. Like @staticdev, I also have an Ansible role which just experienced the same problem.

There are now two roles:

  • Original role: dbrennand.caddy_docker
  • Newly imported role: dbrennand.caddy-docker

I’ll join discussions in Ansible Galaxy’s role import enhancements and fixes for the new year - #9 by githubixx

For anyone finding this thread and using GitHub Actions to publish their Ansible role, my current workaround is to extract the galaxy_info.role_name using yq and provide this to the --role-name CLI argument.

yq is installed by default on ubuntu-latest GitHub runner.

1 Like

@dbrennand thanks for the update. Can you add it to the other thread also please?

Hello!
As per the initial request which was on the github issue I’d like to say there is still an issue in the display on ansible galaxy. I join a picture here where you can see a difference between the latest version uploaded and the top right of the screen


Should we create a dedicated thread for this issue?
Thanks in advance

hm, seems this is only transient and the display is now correct, you might disregard my previous comment, sorry for inconvenience

It takes a couple of minutes until the new version shows up everywhere. I have no idea how much ‘couple’ is. I guess there is some caching involved.