Repository navigation
Conversation
cache_delete (PROXY_CACHE_DELETE) registers
DELETE /api/cache/{ecosystem}/{name}/{version}, which removes a
version's cached files, or only ?filename=, so the next request fetches
them from the upstream again. Records are cleared and the stored objects
queued for deletion like a replaced artifact. Pushed archives are left
alone: a whole-version delete skips them and naming one answers 409.
With it enabled, the version page shows a Delete button for each cached
file and one for the whole version. The UI calls /ui/api/cache so the
same ingress rules that guard /ui guard its deletes. Neither route has
authentication of its own, so the option is off by default.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There is no way to remove a single cached artifact. Once a file is cached it stays until
max_sizeor retention evicts it. That is a problem when an upstream republishes a version, or when a Maven non-unique SNAPSHOT or a file from the wrong upstream gets cached. Maven files are cached by path and never checked against the upstream again. The only documented fix is to wipe the whole cache.This adds an opt-in
cache_deleteoption (PROXY_CACHE_DELETE), off by default.DELETE /api/cache/{ecosystem}/{name}/{version}removes the cached files of a version, or only the file named by?filename=. The next request fetches them from the upstream again.DB.DiscardArtifact). Downloads in progress can finish.The version page in the UI shows a Delete button for each cached file and a "Delete all cached files" button. Each needs a second click to confirm. The whole-version delete matters for Maven: since #484 the
.sha1and.ascfiles are cached separately, so deleting only the jar would leave its old checksum cached.Neither route has authentication of its own, in the same way the UI has none. The UI sends its deletes to
/ui/api/cache, so the ingress rules that guard/uialso guard its deletes. The docs say to restrict/api/cacheand/uibefore turning the option on.Docs: README (API table, Cache Management),
docs/configuration.md(Cache Delete API),config.example.yaml. Swagger is regenerated.Tested with:
go vet ./...,go test ./...and golangci-lint v2.13.1./ui/api/cache, the next request fetched it again, and a whole-version delete then removed the jar,.sha1and.pom.