I’m working with a semi-air-gapped installation of Galaxy_NG:4.8.1, and have automated a process of downloading collection tars from galaxy.ansible.com and uploading them to the private hub’s community repository. The redhat certified/validated content repositories are not blocked by firewall, so those are synced directly, while the community repository remote source is blocked. The current list of collections I’m “manually syncing” from the community repository are based on https://github.com/ansible-community/ansible-build-data/tree/main/7/galaxy-equirements.yml, but I run into errors when trying to upload artifacts that already exist in rh-certified (such as the ansible.* collections).
There is a process in the UI to copy collections between repositories.
Log in to hub
Navigate to Collections → Repositories
Locate your destination repository and click the [More Actions] icon (3 vertical dots); then select Edit
Select the Collections version tab.
Click [Add Collection] and select the collections that you want to add to the repository.
Click [Select].
I would like to ensure all of the collections I require from the community upstream is synced to the local community repository, even if the artifact is already in another repository. While I could manually do this in the UI, that’s very tedious. Is there a way to automate the “Add Collection” function through the API? I’m having a hard time finding this specific function in the swagger-ui, but I feel like it may be because the api path is counter-intuitive to the UI’s process.
One slight correction… source_path & dest_path correspond to a base_path of a distribution pointing to the repository, not the repository name.
They will only be the same if you create them that way, the UI will do that by default as long as the repository name doesn’t have spaces or other special chars, and as long as a distribution with that name doesn’t already exist, and the base_path is not already taken.
That would certainly be nice if Galaxy will automatically associate existing/matching artifacts with new uploads to the destined repositories, especially if it works with “orphaned” artifacts.
Looks like Galaxy_NG just needs to bump the requirements to pulp-ansible==0.20.3, but I don’t know if there are other changes that would need to be made.