galaxy: Cannot import role to Galaxy after changing default branch from 'master' to 'main'
Bug Report
SUMMARY
I am trying to release a new version of https://github.com/artis3n/ansible-role-tailscale. I used to use master
, but moved over to main
as the default branch.
Galaxy fails to import the role - it is looking for a master
branch. I am not sure whether this is configurable when I first sync the repo to Galaxy, but it does not look like I can force a re-sync of the role without deleting the role from Galaxy, which I do not want to do.
Starting import: task_id=737380, repository=artis3n/ansible-role-tailscale
Task "737380" failed: Command '['git', 'clone', '--quiet', '--depth', '1', '--branch', 'master', 'https://github.com/artis3n/ansible-role-tailscale.git', '/var/tmp/galaxy/imports/tmppmsnb2cx']' returned non-zero exit status 128.
STEPS TO REPRODUCE
- Create a minimal ansible role using
master
as the default branch. - Through the Galaxy UI, select “My Content” -> “Add Content” -> “Import Role from GitHub.”
- Change the default branch of the repo to
main
. - Release a higher version of the role on GitHub.
- Through the Galaxy UI, select “My Content” -> “Import” next to your role
- Observe that the import fails.
EXPECTED RESULTS
Galaxy always uses the default branch on the repo, or provides a method to force a re-sync to update the default branch stored by Galaxy for the role’s repo.
ACTUAL RESULTS
Galaxy looked for master
to exist on the repo and the role failed to import and update on Ansible Galaxy.
Starting import: task_id=737380, repository=artis3n/ansible-role-tailscale
Task "737380" failed: Command '['git', 'clone', '--quiet', '--depth', '1', '--branch', 'master', 'https://github.com/artis3n/ansible-role-tailscale.git', '/var/tmp/galaxy/imports/tmppmsnb2cx']' returned non-zero exit status 128.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 2
- Comments: 19 (1 by maintainers)
I temporarily recreated the
master
branch frommain
. Ensured that got ingested by Ansible Galaxy (which then picked up the new config change setting the branch tomain
). When you confirm that Galaxy is correctly ingesting frommain
you can delete themaster
branch permanently.@dallinb Thank you for your support. Unfortunately Galaxy still tries to import the
master
branch. I also recreated themaster
branch and triggered an import which worked fine. But after removing themaster
branch, the import failed again:Is there anything else we can try?
Try setting
galaxy_info.github_branch
to the branch name in the metadata file.I’ve also found this issue, changing branches from
master
tomain
will break import into galaxy.ansible.comI’m keen not to have to re-import the role, it seems a bit of a faff.
From td2’s comment you can import with a different branch via the command line. Get your token from your galaxy preferences.
Hi @artis3n It is mentioned in https://galaxy.ansible.com/docs/contributing/creating_role.html#role-metadata