Add local ansible Galaxy repositories #157

Open
unkin-agent wants to merge 3 commits from benvin/local-ansible into benvin/remote-ansible
Member

Internal Ansible collections can only be installed from galaxy.ansible.com through the remote; there is nowhere to publish them for ansible-galaxy.

  • add the Galaxy v3 publish endpoint (multipart, base64 parts) with an import task that is already completed
  • read collection_info from MANIFEST.json under size and decompression caps, rejecting escaping paths and links
  • serve collection, paginated versions (root-relative links, as Galaxy does), version detail and artifact downloads
  • reject an existing namespace.name:version with 409
  • add docs/ansible/local.md, a UI snippet and an e2e-docker case driving real ansible-galaxy

requires unkin/artifactapi#137

Internal Ansible collections can only be installed from galaxy.ansible.com through the remote; there is nowhere to publish them for ansible-galaxy. - add the Galaxy v3 publish endpoint (multipart, base64 parts) with an import task that is already completed - read collection_info from MANIFEST.json under size and decompression caps, rejecting escaping paths and links - serve collection, paginated versions (root-relative links, as Galaxy does), version detail and artifact downloads - reject an existing namespace.name:version with 409 - add docs/ansible/local.md, a UI snippet and an e2e-docker case driving real ansible-galaxy requires unkin/artifactapi#137
unkin-agent added 1 commit 2026-10-18 03:38:04 +11:00
Add local ansible Galaxy repositories
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ba8d3a3c39
Author
Member
  • internal/provider/ansible/local.go:273 (VersionsPage link, built from base at internal/api/v1/ansible.go:199) — links.next/previous/first/last are absolute https://host/... URLs → emit root-relative paths (/api/v1/local/<repo>/api/v3/collections/<ns>/<name>/versions/?limit=..&offset=..) as the remote rewriter does. ansible-galaxy (api.py get_collection_versions, relative_link=True) does versions_url.replace(path, next_link), so an absolute next yields https://hosthttps://host/... and any collection with more than 100 versions fails to resolve. The tests follow next verbatim and the e2e publishes one version, so neither catches it; add a >100-version case asserting the link starts with /.
  • nit: internal/provider/ansible/local.go:243-246 — created/updated are compared as RFC3339Nano strings, which misorder when fractional seconds differ in length (...05Z sorts after ...05.5Z) → compare parsed times or store UnixNano.
  • nit: internal/provider/ansible/local.go:297 — last offset is len-limit, not page-aligned (250 items, limit 100 → 150, not 200) → (len-1)/limit*limit.
- internal/provider/ansible/local.go:273 (VersionsPage `link`, built from `base` at internal/api/v1/ansible.go:199) — `links.next`/`previous`/`first`/`last` are absolute `https://host/...` URLs → emit root-relative paths (`/api/v1/local/<repo>/api/v3/collections/<ns>/<name>/versions/?limit=..&offset=..`) as the remote rewriter does. ansible-galaxy (api.py get_collection_versions, relative_link=True) does `versions_url.replace(path, next_link)`, so an absolute next yields `https://hosthttps://host/...` and any collection with more than 100 versions fails to resolve. The tests follow `next` verbatim and the e2e publishes one version, so neither catches it; add a >100-version case asserting the link starts with `/`. - nit: internal/provider/ansible/local.go:243-246 — `created`/`updated` are compared as RFC3339Nano strings, which misorder when fractional seconds differ in length (`...05Z` sorts after `...05.5Z`) → compare parsed times or store UnixNano. - nit: internal/provider/ansible/local.go:297 — `last` offset is `len-limit`, not page-aligned (250 items, limit 100 → 150, not 200) → `(len-1)/limit*limit`.
unkin-agent added 2 commits 2026-10-18 04:00:24 +11:00
Merge remote-tracking branch 'origin/benvin/remote-ansible' into benvin/local-ansible
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
e27a318ec7
Author
Member

No findings.

No findings.
Some checks are pending
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin benvin/local-ansible:benvin/local-ansible
git checkout benvin/local-ansible
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: unkin/artifactapi#157