l3ender / nexus-repository-ansiblegalaxy

A Nexus Repository 3 plugin that allows usage of Ansible Galaxy repositories.
30 stars 12 forks source link

feat: support for hosted ansible collections #12

Closed lerminou closed 1 year ago

lerminou commented 1 year ago

The aim of this PR is to handle self-hosted ansible collections in NXRM. I'm not a pure java developer so maybe there are some inconsistencies regarding best-practices.

I successfully tested the repository plugin with a ansible-galaxy client connected to the NXRM instance. With both 3.41 and 3.42 versions

Previous versions are incompatibles and would require a minor change for some interfaces to work.

# ansible-galaxy collection install org.generic -vvvvv  --no-cache  --force

Process install dependency map
Initial connection to galaxy_server: http://127.0.0.1:8081/repository/hosted/
Opened /home/lerminou/.ansible/galaxy_token
Calling Galaxy at http://127.0.0.1:8081/repository/hosted/
Calling Galaxy at http://127.0.0.1:8081/repository/hosted/api
Found API version 'v1, v2' with Galaxy server my_org_hub (http://127.0.0.1:8081/repository/hosted/api)
Calling Galaxy at http://127.0.0.1:8081/repository/hosted/api/v2/collections/org/generic/versions/?page_size=100
Calling Galaxy at http://127.0.0.1:8081/repository/hosted/api/v2/collections/org/generic/versions/1.0.5/
Calling Galaxy at http://127.0.0.1:8081/repository/hosted/api/v2/collections/org/generic/versions/1.0.5/
Calling Galaxy at http://127.0.0.1:8081/repository/hosted/api/v2/collections/community/crypto/versions/?page_size=100
Starting collection install process
Fetching a collection tarball for 'org.generic:1.0.5' from Ansible Galaxy
Downloading http://127.0.0.1:8081/repository/hosted/download/org-generic-1.0.5.tar.gz to /home/lerminou/.ansible/tmp/ansible-local-8134832ezs6ihx/tmpw4cpoxyl/org-generic-1.0.5-owa8o84o
Validating downloaded file hash 233e538935db57d17dcdda702991435816f5b06018903d44486222c18229feb7 with expected hash 233e538935db57d17dcdda702991435816f5b06018903d44486222c18229feb7
Collection 'org.generic:1.0.5' obtained from server my_org_hub http://127.0.0.1:8081/repository/hosted/api
Installing 'org.generic:1.0.5' to '/home/lerminou/.ansible/collections/ansible_collections/org/generic'
org.generic:1.0.5 was installed successfully

fix: update to NXRM 3.41+

It relates to the following issue #s:

cc @DarthHater @bhamail @l3ender

l3ender commented 1 year ago

Thanks for the PR. I've merged in the latest from master after the 0.2.2 release. Can you please check and make sure everything looks good?

I will be digging into this change in the coming weeks. Thanks again!

l3ender commented 1 year ago

Hi @lerminou - would you mind granting me permission to write to your fork/branch? We can collaborate on this change together until it is complete. Thanks!

lerminou commented 1 year ago

Hi @l3ender , the ElasticSearchFacet is now listed twice, I will modify it and I granted you an access to the fork, you should have a pending invitation.

l3ender commented 1 year ago

Hi @lerminou, I built this branch and tried deploying both to 3.41.1-01 and 3.43.0-01 (OSS) but am not seeing the ability to create any ansiblegalaxy repos after doing so. Can you please check on it? Thanks!

lerminou commented 1 year ago

Hi @l3ender , I built the plugin on my side, I needed a reboot of the container to see the ansiblegalaxy repository. but it works, and I have the same behaviour for other community plugins like "composer" image

lerminou commented 1 year ago

Hi @l3ender , can we merge it ?

lerminou commented 1 year ago

tested and working with the latest Sonatype version 3.45

l3ender commented 1 year ago

Thanks much for your work and patience, @lerminou! I am going to merge, but since I haven't had time to test or use it myself, I am going to tag it as a beta release.

l3ender commented 1 year ago

Released as 0.3.0. Thanks again!