GetAuthorizationToken-authenticated Maven GET/HEAD requests now retain a
missing release version from the repository's own public:maven-* external
connection (Maven Central, Clojars, CommonsWare, Google Android, Gradle
Plugins), the way real CodeArtifact does, instead of always 404ing.
Follows AWS's own documented rules: release versions only (SNAPSHOT is
never imported through an external connection); the standard
pom/jar/-javadoc.jar/-sources.jar set imported together on a standard
request, a non-standard asset name imported individually and only on
demand; a retained version's own origin checked against any later asset
request for it, rejecting one from a different connection; package-level
upstream:BLOCK respected; and a direct mvn deploy of a version already
present in the connection rejected (ConflictException), matching AWS's
documented publish-side behavior.
Retained bytes are counted toward DescribeDomain's assetSizeBytes the
same way a direct deploy already is, gated on the real deploy outcome
rather than merely having fetched the bytes, and never double-counted on
an idempotent-match retry.
Verified against the real, live Maven Central in a Docker-gated
integration test (junit 4.13.2), and manually with a real mvn client
through a wildcard mirror.
Lists every package a repository holds across all five formats, with
each package's origin-control restrictions, filterable by format,
namespace prefix, package-name prefix, and publish/upstream
restriction. generic is enumerated by scanning stored package-version
and origin-config records repository-wide; each container-backed
format gets a new RepositorySidecarManager#listPackages primitive,
confirmed live against each real sidecar: Reposilite has no
list-everything endpoint, so Maven walks its directory tree, peeking
one representative child per directory to tell a group/artifact
directory apart from a plain namespace segment (both look identical
one level up); Verdaccio's /-/all, pypiserver's root simple index, and
BaGetter's Search resource (pressed into service for this admin
listing only, not the native NuGet protocol) answer directly.
Permanently removes one or more versions of a package, real assets included.
Confirmed against the wire model: the request shape has no versionRevisions
field at all (unlike UpdatePackageVersionsStatus/DisposePackageVersions), only
a single expectedStatus applied to the whole batch, and expectedStatus itself
accepts the full, unrestricted PackageVersionStatus enum. Deleting is allowed
from every status, Disposed included: the User Guide is explicit that "the
only action that can be taken on a package version that has been disposed is
for it to be deleted."
Unlike DisposePackageVersions, which keeps a tombstone record so
DescribePackageVersion keeps answering Disposed, a deleted version is "no
longer in the repository" at all: the generic record is removed outright and
a container-backed version's status override is cleared rather than
replaced, so DescribePackageVersion/GetPackageVersionAsset 404 on it
afterward and the freed coordinate can be freely republished. Reuses
deleteContainerBackedVersionAssets as-is for the real sidecar deletion, byte
accounting, and Maven metadata.xml cleanup, since those are identical
regardless of which action triggered them.
Moves package versions between Published/Unlisted/Archived (UpdatePackageVersionsStatus)
or permanently to Disposed with real asset deletion (DisposePackageVersions), for generic
and every container-backed format. Both share the same all-or-nothing batch semantics,
NOT_FOUND/MISMATCHED_REVISION/MISMATCHED_STATUS/NOT_ALLOWED error codes, and SKIPPED
fallback confirmed against the User Guide's own worked examples.
Container-backed formats (maven/npm/pypi/nuget) get a new in-memory status-override store,
since none of their sidecars have a native status concept beyond existing-or-not; generic
already had status/revision on its own record. GetPackageVersionAsset now 404s for
Archived/Disposed versions (assets undownloadable per the User Guide), and
ListPackageVersions correctly surfaces real Archived/Disposed/Unlisted data instead of the
previously-unreachable filtering branch.
Verified end to end against all four real sidecar containers, not just mocks.
Lists a package's versions with status, revision, and origin, the second of
the six missing list/lifecycle actions (ListPackageVersionAssets already
shipped). Scoped to all five formats from the start, matching real AWS: none
of the action's own format-field documentation carries a generic-only
restriction.
For generic, reads straight from the stored packageVersions records.
Container-backed formats (maven/npm/pypi/nuget) have no such record, so each
sidecar client gains a new RepositorySidecarManager.listPackageVersions
primitive: Reposilite's artifact-level directory listing plus each version's
own lastModifiedTime, Verdaccio's packument versions/time maps, pypiserver's
per-project JSON releases keys plus a HEAD on each version's file for
Last-Modified, and BaGetter's flat-container index.json plus the NuGet V3
Registration resource's catalogEntry.published (read only as an internal
timestamp source, not as a registration endpoint exposed to real NuGet
clients). Every container-backed version reports status Published, the same
convention DescribePackageVersion's own bridge already established.
Real-AWS behavior confirmed against the wire model and the User Guide before
writing any code: default page size is 50 (not the 100 this codebase's other
List actions use), sortBy=PUBLISHED_TIME is always applied (the only value
that enum has) most-recent-first, Archived and Disposed versions are excluded
unless the caller filters by that exact status (two sibling actions' own docs
name this operation as the one that hides them), Unlisted stays included by
default, and originType filtering to EXTERNAL/UNKNOWN always answers empty
since Floci never ingests from an external connection. defaultDisplayVersion
prefers npm's own dist-tags.latest, falling back to the most recently
published Published version for every format (the only stated rule for
Maven/PyPI; applied to generic/NuGet too as the best-justified inference,
since AWS states no rule for those two).
Verified live against all four real sidecar containers, not just mocks, with
new Docker-gated tests per format (Maven 26/26, npm 25/25, pypi 24/24, nuget
17/17 overall), plus the fast CodeArtifactServiceTest suite (210/210).
Checkstyle and docs-check clean.
Lists a package version's assets with size and SHA-256 hash, for generic
(from its own packageVersions record) and maven/npm/pypi/nuget (bridged to
each sidecar, reusing the listPackageVersionAssetNames/fetchPackageVersionAsset
primitives CopyPackageVersions already built). Confirmed live against all
four sidecars with Docker-gated tests; real AWS places no format restriction
on this action either.
First of the six list/lifecycle actions (item 10 in the design plan).
Fixes caught by Qodo's review after opening the PR, verified against the
wire model and the sidecar code before applying: the endpoint was registered
as GET, but real CodeArtifact's ListPackageVersionAssets is a bodyless POST
with query parameters, like every other List* action in this service (the
Describe*/Get* actions are the ones that use GET) - switched the controller
and its Docker-gated tests to POST. Also stopped fetching and hashing every
asset in a container-backed version before paginating: asset names are now
paginated first, and only the page actually being returned gets fetched and
hashed. Added regression tests for the validation paths (missing fields,
invalid format, and namespace requirements) that had none.
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.
Copies one or more versions of a package between repositories in the same
domain, matching AWS's documented all-or-nothing batch semantics: a version
missing from the source fails NOT_FOUND, a version already identical at the
destination is a silent no-op, a differing one fails ALREADY_EXISTS unless
allowOverwrite is set, and any one failure reports every other requested
version as SKIPPED rather than performing a partial copy. versionRevisions
is checked against the source's actual revision (MISMATCHED_REVISION on a
mismatch). Maven, npm, pypi, and nuget are not yet bridged, the same
restriction PublishPackageVersion already has for those formats, and are
documented as a known limitation.
Bridges the nuget package format to a real per-repository BaGetter
container, the same Manager/Client sidecar shape already established for
Maven (Reposilite), npm (Verdaccio), and pypi (pypiserver): a real NuGet V3
push/install round trip through CodeArtifactNuGetController, GetPackageVersionAsset
and GetPackageVersionReadme bridged to the live sidecar, and DeletePackage wired
through the same CONTAINER_BACKED_FORMATS dispatch the other three formats use.
GetPackageVersionReadme is answered live against BaGetter (its own readme-file
and nuspec-description endpoints) rather than captured at publish time, since
unlike Verdaccio and pypiserver, BaGetter can answer for a specific historical
version after the fact.
Pins bagetter/bagetter, the actively maintained fork of the original,
long-stale loic-sharma/BaGet (no commits since mid-2024, every one of its own
releases tagged -preview/-prerelease), confirmed directly against a live
container for push/download/readme/delete semantics before relying on them.
Maven, npm, and pypi publish straight to their own sidecar and never create
the generic-format packageVersions record DescribePackageVersion depended on,
so it always 404ed for those three formats. Real CodeArtifact's
PackageVersionDescription has no asset listing at all, so the bridge only
needs a cheap per-sidecar existence check for the exact version, not asset
enumeration: Verdaccio's packument already lists every version, Reposilite's
own details API answers directory existence the same way container
readiness probing already relies on, and pypiserver's per-project JSON
listing already groups files by version. The revision is synthesized the
same deterministic way GetPackageVersionAsset's own bridge already does, so
describing a version and fetching one of its assets see the same value.
Supports npm, pypi, and nuget, matching AWS's own documented restriction
for this action (not maven, Swift, generic, Ruby, or Cargo, which carry
no readme in real CodeArtifact).
Neither npm nor pypi can answer this live after the fact. A real
Verdaccio packument GET hoists readme to the top level only, for the
single most-recently-published version, and drops the per-version field
from its own response entirely, even though a real npm client's publish
envelope genuinely sends one per version (confirmed against a live
Verdaccio 6.10.4 container with a captured real npm-publish fixture).
pypiserver has no description field anywhere in its model or its RPC2
route (confirmed by reading pypiserver's own source at the pinned
version), so it never had a live path to begin with.
Both formats are therefore captured at publish/upload time instead:
npm's per-version readme field is read off the real publish envelope by
NpmPublishEnvelopeScanner and recorded after a successful forward to the
Verdaccio sidecar, and pypi's is read off the upload form's description
field the same way it already was. Both go through the same
recordPublishedPackageVersionReadme method and the same
packageVersionReadmes account-scoped store, cleaned up on
DeleteRepository and DeletePackage the same way packageOriginConfigs
already is. nuget is accepted as a valid format but always 404s, since
nothing in Floci implements the real NuGet wire protocol and no nuget
package version can ever exist here.
Refactors validatePackageToken to delegate to a new non-throwing
isValidPackageToken, reused by the readme capture path (fed raw
publish/upload input, never through the JSON API's own validation) to
guard the same escape-collision invariant escapeKeySegment depends on.
Extracts the container-backed revision synthesis already used by
GetPackageVersionAsset into a shared helper so GetPackageVersionReadme
reports a consistent revision for the same version coordinate.
Was hardcoded to 0L unconditionally. Generic-format bytes are summed live from
the still-existing PublishPackageVersion records (packageVersions), the same
lazily-computed-not-cached pattern repositoryCount already uses. Scoped per
still-live repository rather than one scan over the whole domain, matching
every other read path's own per-repository prefix.
Maven, npm, and pypi have no such record to sum: their publishes go straight to
their own sidecar (Reposilite/Verdaccio/pypiserver) and never create one. Each
proxy now reports its own successfully-written byte count directly through a new
recordContainerBackedAssetBytes, keyed exactly like packageOriginConfigs
(region/domain/repository/format/namespace/package, no version), only once it has
already decided, in its own terms, that a real write just happened:
- Maven: ReposiliteSidecarClient.deployArtifact now returns a DeployOutcome
(status plus whether it actually wrote new content), so the idempotent-match
short-circuit and a genuine redeployment:false conflict both correctly add
nothing. CodeArtifactMavenController parses the GAV path into namespace/package
name, including a group/artifact-level maven-metadata.xml upload, which it
attributes correctly once the metadata filename itself (not the segment count)
tells it apart from a real versioned asset.
- npm: NpmPublishEnvelopeScanner's attachment digest loop now also counts the
real decoded byte count alongside its SHA-512, so a multi-attachment publish is
sized by its actual tarball bytes, not the base64-and-JSON envelope. Recorded
only after Verdaccio's own response confirms a 200/201, off the event loop
(vertx.executeBlocking, on principle, even though the call itself is cheap); the
confirmed-republish short-circuit and a native Verdaccio rejection both add
nothing. A native npm unpublish (Verdaccio's unpublish:$all, bypassing this
service entirely) is detected separately and cleaned up the same way DeletePackage
would have.
- pypi: recorded after a real forwarded upload succeeds, under pypiserver's own
PEP 503 normalized name so an upload and a later delete spelled differently
still address the same count; the byte-identical idempotent short-circuit and the
different-content 409 both add nothing.
DeleteRepository and DeletePackage both clean up every format's own records
(packageVersions and its asset content included) by the same name-based
prefix/key, so a repository or package recreated under the same name never
inherits a predecessor's bytes. A per-package deletion fence, bumped only by an
actual delete (DeletePackage, or a native npm unpublish), replaces a sidecar
existence re-check for the race between an in-flight publish's own accounting and
a concurrent delete: comparing a snapshot taken before the real write against the
fence's current value catches "deleted" and "deleted and republished under the
same name" alike, with no network round trip needed to do it, so nothing here
holds the service-wide lock across a sidecar call. containerBackedAssetBytes
itself is kept in memory only, like the fence, not through StorageFactory: the
sidecar content it counts does not survive a Floci restart either, so neither
does the count.
Verified against real Reposilite, Verdaccio, and pypiserver containers (not just
mocks): each Docker-gated integration suite asserts assetSizeBytes increases by
exactly the real published/uploaded byte count, stays unchanged across an
idempotent retry, and drops back down after a real delete, native unpublish
included.
Known limitations documented: a maven-metadata.xml for a versioned snapshot is
attributed to its version string rather than its real artifact name (still counted
correctly in the domain total, just under a misnamed bucket nothing else looks up
by name); unpublishing a single version of a multi-version npm package is not
detected (this accounting is per-package, not per-version, so there is no
narrower count to subtract from regardless).
Addresses hectorvent's review on the PR: rebased to pick up #5102's
Digests.sha256Hex (the tests were merging clean but failing to compile against
current main), stopped containerBackedAssetBytes from surviving a restart the
content it counts does not, and closed the native-npm-unpublish gap in the
fence's own soundness argument.
Sets a package's publish/upstream origin-control restrictions, matching
AWS's documented behavior that this operation can create the package
(with no versions) when it doesn't exist yet, so a caller can lock a
package down before anything is ever published to it.
DescribePackage now reflects a stored configuration instead of the
fixed ALLOW/BLOCK defaults it previously always returned, and
PublishPackageVersion rejects a publish with ConflictException once a
package's origin configuration sets publish to BLOCK, the one publish
path this operation can actually gate since PublishPackageVersion only
ever accepts the generic format. Maven/npm/pypi publish through their
own native wire protocols and are not yet gated by this setting,
documented as a known limitation.
The format/namespace coordinate validation shared with DescribePackage
is extracted into one helper instead of being duplicated a second time.
clear() (the Resettable reset path) now also clears the new store; it
previously left an origin-config-only package (no versions) visible to
DescribePackage after a reset that wiped everything else.
DescribePackage's existence check for an origin-config-only package now
short-circuits before the sidecar/generic check runs at all: for a
container-backed format that check would otherwise start the real
Maven/npm/pypi sidecar container just to answer a describe for a
package nothing was ever actually published to.
DeletePackage now agrees with DescribePackage on all of this instead of
drifting from it. Its deletedPackage.originConfiguration reports the
restrictions that were actually stored, not a hard-coded ALLOW/BLOCK;
it clears the stored configuration as part of the delete, so a deleted
package cannot resurrect as a zero-version one on the next
DescribePackage; and it now recognizes an origin-config-only package
(no version ever published) as something it can delete, rather than
404ing on a package DescribePackage itself reports as existing.
DeletePackage's own namespace/format validation, previously a second
inline copy of the same rules, now goes through the shared helper too.
A rejected PutPackageOriginConfiguration now also has a test asserting
an invalid/missing upstream value alone is rejected (the prior tests
only exercised publish) and that a rejection, on either a package that
didn't exist yet or one with a prior configuration, changes nothing.
deleteRepository now also removes any packageOriginConfigs entries
under that repository: unlike sidecarContainerIds, which already gets
a fresh id on every creation specifically so a repository recreated
under the same name never inherits the previous one's sidecar content,
packageOriginConfigs was keyed purely by name, so a recreated
repository would otherwise inherit a prior package's restrictions,
including a publish:BLOCK the new repository's owner never set.
DeletePackage deletes a package and every one of its versions, matching
PackageSummary's own field name (package, not name, confirmed against the API
reference) in the deletedPackage response. A nonexistent package answers
ResourceNotFoundException instead of silently succeeding.
Existence and deletion go where the package actually lives: stored
generic-format versions and their asset bytes for generic, and each format's
sidecar for maven, npm, and pypi. Validates package and namespace shape, and
requires or rejects a namespace per format, the same boundary describePackage
already enforces, before touching repository or sidecar state.
Synchronized like every other mutating method on this service, so a publish
and a delete racing the same generic package cannot interleave. Within one
generic version's own delete, its metadata record is removed before its asset
bytes are cleaned up, so a cleanup failure on one asset can never leave a
surviving record pointing at bytes that are now gone; the failure is logged
and the rest of the package's assets still get cleaned up.
Verdaccio and Reposilite can each remove a whole package in one call,
confirmed against live containers: Verdaccio needs the packument's own _rev
appended as npm's real unpublish protocol does (a bare DELETE with no revision
is not a route at all), Reposilite removes everything under the group/artifact
directory in a single DELETE. pypiserver has no single whole-package route,
but its own management endpoint (POST / with :action=remove_pkg) does delete
a named version for real, confirmed live against the pinned v2.4.2 image:
every version is listed first through the same image's PyPI JSON API
endpoint, then each file removed under its own, unnormalized name (an sdist
and a wheel of the same release can legitimately differ there, so deleting by
one shared name alone could silently leave the other file behind).
RepositorySidecarManager.deletePackage's default still throws
UnsupportedOperationException for a sidecar that genuinely cannot do this,
and the service turns that into a documented InternalServerException rather
than claiming a success it cannot back up or leaving an unhandled 500.
DescribePackage returns a package's format, namespace, name, and origin
controls, and answers ResourceNotFoundException for a package that does not
exist. Existence is checked where the package actually lives: stored
generic-format package versions for generic, and each format's sidecar for
maven, npm, and pypi. A package whose name merely starts with another's name
does not match it.
Origin controls are reported as publish ALLOW and upstream BLOCK, the default
CodeArtifact assigns to a package whose first version was published directly.
Floci never ingests packages from upstream and does not store origin controls,
so these values are fixed.
For maven, npm, and pypi the existence check starts that repository's sidecar
if it is not already running, the same side effect the asset bridge has.
RepositorySidecarManager gains packageExists, implemented by each sidecar client.
Reposilite's own redeployment:false setting rejects a redeploy to an
existing GAV path unconditionally, even when the new content is
byte-identical to what is already there (confirmed against a real
instance). AWS's own CodeArtifact docs ("Overwriting package assets"
in the packages overview) say a republish of an asset whose content
matches what is already published succeeds because the operation is
idempotent; only a genuine content mismatch is a real conflict.
Reposilite has no content-aware mode of its own, so this fetches the
existing artifact first and short-circuits to a 200 on an exact match
rather than ever sending Reposilite a PUT it would reject regardless
of whether the retry was actually harmless.
Two follow-ups hectorvent flagged on #4619, approved but marked as
separate-PR material:
Compares an existing asset's persisted SHA-256 instead of reading its
bytes. The hash is normal metadata (not @JsonIgnore like the content
field), so this needs no disk read, no in-memory-store lookup, and no
special case for a backing file that happens to be missing - a stored
hash never "goes missing" the way a file can, and a genuinely different
republish still conflicts even when the file is gone, closing a gap the
previous byte-comparison approach had.
Extends the idempotent-retry allowance to an already-Published version.
AWS's "Overwriting package assets" rule isn't scoped to Unfinished, and
the terminal publish call (the one that actually finishes a version) is
the likeliest one a client retries after a dropped response. A brand-new
asset name against a Published version still always conflicts; only a
byte-identical replay of an asset that's already there is idempotent.
PublishPackageVersion silently overwrote a generic-format asset's stored
bytes whenever the same asset name was republished to an Unfinished
package version, with no comparison against what was already there. AWS's
own docs ("Overwriting package assets" in the CodeArtifact packages
overview) say a republish is only rejected when the content actually
differs from what's already stored; byte-identical content succeeds
idempotently. Compares the new upload against the existing asset's real
bytes (read the same way GetPackageVersionAsset does, not the in-memory
PackageAsset.content field, which is @JsonIgnore and unreliable after a
reload) and now returns ConflictException on a genuine mismatch instead of
silently replacing the content.
GetRepositoryEndpoint for format=npm now returns a working registry
endpoint: real npm/yarn/pnpm clients can publish to and install from it,
proxied straight through to a real Verdaccio instance rather than
reimplemented. Every request needs Authorization: Bearer <token> from
GetAuthorizationToken, matching npm's own _authToken config and, unlike
Maven's HTTP Basic support, Bearer only.
Unlike Reposilite, Verdaccio has no native concept of multiple named
repositories inside one instance, so each CodeArtifact repository gets
its own container instead of sharing one, started lazily on first use
and identified by a fresh id assigned at CreateRepository time so a
repository deleted and recreated under the same name never inherits the
previous one's packages. Each container is started with
VERDACCIO_PUBLIC_URL set to that repository's own proxy URL so package
metadata it returns (dist.tarball) points back through Floci instead of
the container's own internal, client-unreachable address.
VerdaccioSidecarManager implements the RepositorySidecarManager
interface CodeArtifactService already generalized DeleteRepository's
cleanup over, so a deleted repository's Verdaccio container is stopped
and removed the same generic way Maven's Reposilite storage is released.
The per-key container lifecycle (map of running containers, per-key
start lock, health poll, restart-on-unhealthy, stop-all) has nothing
Verdaccio-specific in it, so it is pulled out into PerKeyContainerPool
for a future per-repository sidecar to reuse directly.
CodeArtifactNpmDataPlane is a raw streaming proxy rather than a JAX-RS
controller, since npm's wire protocol has no fixed path shape the way
Maven's GAV layout does; Verdaccio already speaks that protocol
correctly, so this only needs to authenticate the request and forward
it. The publish/fetch integration test replays a real request the npm
CLI sent during manual verification, captured with a tiny Node.js
capture server, so it exercises the exact envelope shape (including a
real gzip tarball attachment) npm publish actually produces; the full
round trip was additionally verified by hand with the real npm CLI
against a live Floci instance.
DeleteRepository never cleaned up the Reposilite-side storage of a deleted
repository; it was left behind, wasting space over a long-running process.
Reposilite has no bulk-delete endpoint, but DELETE on a path recursively
removes everything under it in one call, so this deletes each of the
repository's top-level entries before removing it from the shared settings
list, verified against a live instance. Order matters: the repository must
stay registered while its files are deleted, since Reposilite 404s every
path, including DELETE, for an id absent from its settings.
Release is best-effort: the CodeArtifact-side metadata delete already
committed by the time it runs, matching real CodeArtifact's own
DeleteRepository (synchronous, always succeeds once the repository exists).
A sidecar that is unreachable must not turn an already-successful delete
into a 500, and must not leave the repository stuck, since a retry would
just 404 against the already-deleted record.
Introduces RepositorySidecarManager, a small interface every per-format
sidecar can implement, and CodeArtifactSidecarRegistry, which discovers
implementations via CDI. CodeArtifactService.deleteRepository releases
storage generically over whatever formats a repository has sidecar ids
for, so a future format's sidecar needs no change here. Reposilite is the
first and only implementation for now; CodeArtifactRepository's
mavenRepositoryId field becomes a sidecarContainerIds map for the same
reason.
GetRepositoryEndpoint for format=maven now returns a URL real Maven clients
(mvn deploy, mvn dependency:get, Gradle) can publish to and resolve from
directly, backed by a shared Reposilite sidecar container started lazily on
first use. A CodeArtifact repository maps to its own Reposilite repository,
provisioned automatically and never reused even across delete/recreate of a
same-named repository, so a fresh repository can never inherit a previous
one's artifacts.
Adds GetAuthorizationToken (a token scoped to a domain, with the 900-43200s
custom range; 0 falls back to 12 hours) and requires it on every Maven proxy
request, either as the password of HTTP Basic credentials, the form AWS's
Maven guide configures with username aws, or as a Bearer token. Maven
requests are not SigV4-signed, so the region and account come from the token.
Also enforces AWS's 5 GB asset size quota on the Maven endpoint, matching the
existing PublishPackageVersion check. Artifacts do not survive a Floci
restart; the service page documents this as a known limitation.
AWS returns ResourceNotFoundException (404) when DeleteDomain targets a
domain that does not exist, even though the API reference leaves it out
of the operation's error list. Keep that behaviour, pin it with unit and
integration tests, and note it in the docs and next to requireDomain.
Closes#4000
Every ConflictException, ResourceNotFoundException, and ServiceQuotaExceededException
the service threw carried a message only, but the wire model declares
resourceId/resourceType on all three, and the AWS SDK exposes them as typed
accessors. Populate them consistently using the resource's locally-unique name
(domain name, repository name, package version, or asset name) as resourceId.
Populating resourceId this way exposed a real crash: Map.of() rejects null
values, so any request missing a required identifier (domain, repository,
package, packageVersion, asset) turned what used to be a wrong-status
ResourceNotFoundException into a raw NullPointerException / HTTP 500. Fixed
by validating required identifiers up front (returning ValidationException,
matching AWS) and by making the extendedData-building helper itself
null-safe against a missing resourceId, so no single overlooked call site
can reintroduce a 500.
CreateDomain and CreateRepository accepted an unlimited number of domains and
repositories, but AWS caps an account at 10 domains per Region and a domain at
1,000 repositories, returning ServiceQuotaExceededException once reached.
Adds PublishPackageVersion, DescribePackageVersion, and GetPackageVersionAsset
for CodeArtifact's generic package format, matching AWS's own wire restriction
that PublishPackageVersion accepts only the generic format. Includes real
asset hashing (MD5, SHA-1, SHA-256, SHA-512), SHA-256 integrity verification
against the caller's x-amz-content-sha256 header, correct Unfinished/Published
status transitions, and the documented AWS quotas for this action (350 assets
per version, 5 GB max asset size), all returning ServiceQuotaExceededException
when exceeded.
Asset bytes are kept out of the JSON/WAL-backed package-version store
(@JsonIgnore on PackageAsset.content) and instead go through a dedicated
asset store, a disk file in persistent/hybrid/wal mode or a side map in
memory mode, the same split S3Object/S3Service already uses for object
bytes. Without this, a publish rewrote every asset of every package version
on disk each time, growing quadratically under this action's own
350-asset/5GB quotas. The asset name is also validated against the wire
model's AssetName pattern (no control characters), not just its length,
since it is echoed back verbatim in the X-AssetName response header on
GetPackageVersionAsset.
Verified against the real botocore service-2.json wire model and the AWS
CodeArtifact User Guide (including its PDF for the quotas table, since the
HTML quotas page is JS-rendered). Live-verified with the real AWS CLI and
the AWS SDK for Java v2 against a running Floci instance, including an exact
byte-for-byte asset round-trip and the real ConflictException when
republishing an already-Published version.
Floci had zero CodeArtifact support: no service package, no docs, nothing.
Any terraform apply touching aws_codeartifact_domain, aws_codeartifact_repository,
or either permissions-policy resource failed outright. This adds the full
CodeArtifact control plane: domain and repository CRUD, resource policies with
optimistic-locking revisions, tags, and the fixed set of real AWS-hosted
external (upstream) connections (public:npmjs, public:pypi, public:maven-central,
etc.).
Package publish/fetch endpoints per format (npm, PyPI, Maven, NuGet, generic)
are intentionally out of scope here: this closes the terraform apply gap, not
real package serving.
ListTagsForResource (POST /v1/tags?resourceArn=) is CodeArtifact's one tag
operation that addresses the resource with a query parameter on the bare path
rather than a path segment, unlike every other V1TagsController/SharedTagsController
handler. That method lives on V1TagsController itself rather than the shared
AbstractTagsController base: SharedTagsController (mounted at /tags) already
declares its own bare POST (tagResourceByBody, for TagResource), so a bare POST
on the shared base collides with it and Quarkus refuses to start. CodeArtifact's
handler is @V1Tags-qualified and only ever registered against V1TagsController,
so the method belongs there. core/common stays service-free: CodeArtifactTagHandler
registers itself as a bean the same way MskTagHandler does, and TagHandler gained
a default for the lowercase key/value entry names CodeArtifact uses instead of
AWS's usual capitalized Key/Value.
Known, documented limitations (see docs/services/codeartifact.md): no cycle
detection across upstream chains, no referential-integrity check when deleting
a repository other repositories reference as an upstream, and no authorization
check on cross-account domainOwner addressing (consistent with Floci's opt-in
IAM enforcement elsewhere).
Verified against the real botocore codeartifact service-2.json (protocol, exact
querystring vs. body placement per operation, exact ARN format, epoch-seconds
timestamps, real error shapes) and the live AWS API docs for behavioral rules
not in the wire model (DeleteDomain blocked while repositories exist, the real
fixed external-connection name/format list, PutDomainPermissionsPolicy's
all-body field placement vs. the sibling repository operation's querystring
placement).
Live-verified three ways:
- Unit tests including a concurrent-create race test proving the synchronized
guard actually holds under contention, plus full-stack QuarkusTest/RestAssured
integration tests.
- A real terraform init/apply/plan/destroy cycle against a running Floci
instance, independently confirming destroy actually tore the domain down via
a follow-up describe-domain call.
- A live AWS SDK v2 Java test exercising the real CodeartifactClient against a
live instance.