mirror of
https://github.com/floci-io/floci.git
synced 2026-12-05 02:58:00 -05:00
feat(codeartifact): bridge CopyPackageVersions to every sidecar format (#5888)
CopyPackageVersions only covered the generic format; maven, npm, pypi, and nuget each publish straight to their own sidecar and keep no packageVersions record this action could read from or write to. Bridges all four, each confirmed live against a real container: maven reuses Reposilite's existing mvn-deploy write path, while npm/pypi/nuget each speak their own real wire protocol directly (Verdaccio's packument PUT, pypiserver's twine-shaped multipart upload, and BaGetter's NuGet push), the same protocol each format's own data-plane proxy already forwards unmodified for a native client. CopyPackageVersions now supports every format CodeArtifact does, matching real AWS, which places no format restriction on this action at all. An overwrite deletes a conflicting existing asset immediately before rewriting it for every format, since each sidecar rejects a plain overwrite of differing content; a best-effort compensating cleanup restores or removes whatever one version's write itself touched if a later step in that same version fails, preserving the original error. A copied Maven version is also merged into the destination's maven-metadata.xml so real clients can discover it, and copied bytes feed the same byte-accounting mechanism native publishes already use. A copied npm or pypi version's readme is propagated from this service's own captured-at-publish-time record, since neither sidecar can answer for one after the fact. The synthesized revision for every container-backed format is truncated to fit versionRevisions' own 50-character limit, so a revision obtained from DescribePackageVersion can be handed straight back into a revision-pinned copy. Also closes a cross-version batch-write gap: source assets are verified against the real sidecar before any destination write in the same batch, the same split the generic path already uses. Fixes two more real-sidecar quirks found on review: pypiserver's own delete call removes every file sharing a release's exact name and version, not just the one asset name it was asked to delete, so a release carrying both an sdist and a wheel lost one of them on overwrite when assets were deleted one at a time, interleaved with the writes. Every destination asset a version already holds is now deleted up front, in its own phase, before any new content is written, which changes nothing for Maven/npm/nuget since their own deletes are already scoped to exactly the asset (or, for npm/nuget, the single asset a version ever holds) being removed. An npm copy also used to rebuild a minimal version document from scratch, dropping dependencies and anything else npm's own protocol carries beyond dist; it now reuses the source's own version entry verbatim, with only dist itself rewritten to point at the copy.
This commit is contained in:
1 parent
c17bd49096
commit
5dcddc9dfa
14 files changed
+2124
-46
No files matched your search
@@ -45,7 +45,7 @@ behind them yet.
|
||||
| `DescribePackageVersion` | Returns a package version's status, revision, and origin. |
|
||||
| `GetPackageVersionAsset` | Downloads one asset from a package version by name, optionally pinned to a specific revision. |
|
||||
| `GetPackageVersionReadme` | Returns the readme text for a package version; `npm`, `pypi`, and `nuget` only, matching AWS's own restriction for this action. |
|
||||
| `CopyPackageVersions` | Copies one or more versions of a package from one repository to another in the same domain; `generic` only. |
|
||||
| `CopyPackageVersions` | Copies one or more versions of a package from one repository to another in the same domain. |
|
||||
| `TagResource` | Adds or updates tags on a domain or repository ARN. |
|
||||
| `UntagResource` | Removes tags by key from a domain or repository ARN. |
|
||||
| `ListTagsForResource` | Lists the tags on a domain or repository ARN. |
|
||||
@@ -257,15 +257,28 @@ state.
|
||||
`DisposePackageVersions`, and `UpdatePackageVersionsStatus` don't exist yet; the only way to
|
||||
move a version from `Unfinished` to `Published` today is a follow-up `PublishPackageVersion`
|
||||
call that omits the `unfinished` flag.
|
||||
- **`CopyPackageVersions` only supports the `generic` format, unlike real AWS.** The API
|
||||
reference does not restrict this action's `format` parameter the way it restricts
|
||||
`PublishPackageVersion`'s to `generic` alone; real CodeArtifact copies Maven, npm, pypi, and
|
||||
nuget versions too. This is a Floci implementation gap, not an AWS restriction being mirrored:
|
||||
Maven, npm, pypi, and nuget publish straight to their own sidecar and keep no `packageVersions`
|
||||
record this could read from or write to, so bridging them needs the same per-sidecar
|
||||
fetch-then-republish shape `GetPackageVersionAsset`'s own bridge already uses, not yet built.
|
||||
`includeFromUpstream` is accepted but has no effect, since Floci has no upstream-ingestion path
|
||||
for any format to begin with (see the upstream-resolution limitation below).
|
||||
- **`CopyPackageVersions` has no full cross-call rollback on a mid-copy sidecar failure.**
|
||||
(`generic`, `maven`, `npm`, `pypi`, and `nuget` are all supported — matching real AWS, which
|
||||
places no `format` restriction on this action at all, unlike `PublishPackageVersion`'s own
|
||||
restriction to `generic`; `generic` copies through its own `packageVersions` record, while
|
||||
`maven`, `npm`, `pypi`, and `nuget` each bridge straight to their own sidecar's real wire
|
||||
protocol — `mvn deploy`, `npm publish`, `twine upload`, and `nuget push` respectively, confirmed
|
||||
against a live container for each — since none of the four keeps a `packageVersions` record
|
||||
this action could otherwise read from or write to.) A container-backed copy retains byte-for-byte
|
||||
source assets, and a best-effort compensating cleanup restores or removes whatever one version's
|
||||
own write touched if a later step in that same version fails, preserving the original error, but
|
||||
a sidecar outage mid-cleanup can still leave a version in an inconsistent state, the same
|
||||
residual risk the generic path's own write-level failure handling already accepts. A single call
|
||||
also holds every fetched asset in memory until the whole batch's destination writes complete, so
|
||||
a batch of many large assets is bounded by available heap, not disk; the same nominal-quota
|
||||
tradeoff the 5 GB limitation below already accepts elsewhere. A copied `npm` or `pypi` version's
|
||||
readme is propagated to the destination too, from this service's own record captured at publish
|
||||
time, since neither sidecar can answer for one after the fact (`GetPackageVersionReadme`'s own
|
||||
constraint, described earlier in this document); `nuget` needs no equivalent step, since
|
||||
`GetPackageVersionReadme` already answers it live from the `.nupkg` this action already copies
|
||||
in full. `includeFromUpstream` is accepted but has no effect, since Floci has no
|
||||
upstream-ingestion path for any format to begin with (see
|
||||
the upstream-resolution limitation below).
|
||||
- **The 5 GB asset size quota is nominal.** `PublishPackageVersion` and the Maven, pypi, and
|
||||
nuget repository endpoints all receive the request body as a single byte array before Floci ever
|
||||
checks its length, so a request already large enough to exhaust available heap fails before the
|
||||
|
||||
Reference in new issue
Block a user