Documentation
¶
Overview ¶
Package generic is the format of generic repositories: files without package metadata, so nothing is indexed. Every other format embeds its Handler for the deploy policy that applies to every package type (decision 0032).
Role ¶
artifacts module, ecosystem layer: the deploy and download policy that every format embeds (includesPattern, excludesPattern and blackedOut on a write, CheckDownload on a read). It has no http package: the item routes serve generic content.
Inputs ¶
- Driving: the format registry (artifacts/ecosystem), which hands generic repositories to Handler; every other format, which embeds Handler or calls CheckBlackedOut and CheckPatterns from its own Admit; the item service and core remote, which fall back to Handler when no format registry is set; and the download paths that call CheckDownload before they look for an item: the source boundary (artifacts/core/remote/source), the item and protocol routes, and the application's remote wiring.
- The repository configuration (repo.Config): its blackedOut flag and its include and exclude patterns (repo.PatternsOf).
Outputs ¶
- Handler: the format.Handler of generic content, whose hooks do nothing and whose Admit applies the deploy policy; Classify reports every file as unique content.
- CheckBlackedOut, CheckPatterns and CheckDownload: the refusals, as format.RejectionError values with Artifactory's statuses and messages.
Invariants ¶
- A download is refused before any lookup, whether or not the item exists and for an administrator too, as Artifactory does.
- A system path, a Maven index file or any path ending .index, passes a download's include and exclude patterns but not the blackout, as Artifactory 6.20's RepoBase.accepts passes it (NamingUtils.isSystem); 7.x documents nothing either way (#216).
- The refusal statuses and messages are Artifactory's (BlackedOutException, IncludeExcludeException and the virtual repository's "No repository found"), so they stay byte-identical.
- The package imports only the format contract, the repository configuration and shared types, never core remote or the source boundary, so those may import it without a cycle (decision 0044).
References ¶
- Decision 0032: docs/research/decisions/0032-package-format-handlers.md, "Generic deploy policy" and "Generic download policy" (lines 112 to 118), the latter amended for https://github.com/weaveplatform/artifactweave/issues/328.
- Decision 0003: docs/research/decisions/0003-repository-model.md (include and exclude patterns).
- Decision 0006: docs/research/decisions/0006-authorization-native-permission-model.md.
- Decision 0044: docs/research/decisions/0044-modular-monolith-migration.md, "Artifacts and remote" (core/remote/source keeps calling CheckDownload).
- Target layout: docs/research/architecture-options/5-modular-monolith.md, line 226 (ecosystem/generic), line 386 and line 1000 (the mapping row).
- Plan: docs/implementation/plan.md#p3-repositories-generic-artifacts-cli-aql-shape and #p9d-modular-monolith-migration, epic ECO (https://github.com/weaveplatform/artifactweave/issues/943).
- https://github.com/weaveplatform/artifactweave/issues/1030
Status ¶
Implemented P3 (generic artifacts), with the download policy amended for https://github.com/weaveplatform/artifactweave/issues/328 (decision 0032). Moved here in P9d.
Testing ¶
- generic_test.go: the deploy policy through Admit, the hooks doing nothing, and CheckDownload for blacked-out, pattern-refused, folder, root, virtual and system-path requests.
- contract_test.go: the format contract suite (artifacts/core/formattest).
Index ¶
- func CheckBlackedOut(c repo.Config, path string) error
- func CheckDownload(c repo.Config, path string, folder bool) error
- func CheckPatterns(c repo.Config, path string) error
- type Handler
- func (Handler) Admit(_ context.Context, _ format.Env, c repo.Config, w format.Write) (format.Write, error)
- func (Handler) Classify(repo.Config, string) format.Class
- func (Handler) Deleted(context.Context, format.Env, repo.Config, []model.Item) error
- func (Handler) Deleting(context.Context, format.Env, repo.Config, model.Item) error
- func (Handler) Deployed(context.Context, format.Env, repo.Config, model.Item) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckBlackedOut ¶
CheckBlackedOut refuses any write to, or download from, a blacked-out repository. Status and wording are Artifactory's BlackedOutException, which keeps RepoRejectException's default 404 for both (Artifactory OSS 6.20, RealRepoBase.assertValidPath). A format overriding Admit checks this first, and its own policies (Maven's snapshot handling) before CheckPatterns, in Artifactory's order.
func CheckDownload ¶
CheckDownload refuses what Artifactory refuses before it looks for the item a download names, whether or not it exists, and for an administrator too (DbLocalRepo.checkDownloadIsAllowed calls RealRepoBase.assertValidPath with downloadRequest set, ahead of the read permission check):
- any path of a blacked-out repository, 404;
- a path c's include and exclude patterns reject, 404 with IncludeExcludeException's message.
path is the one Artifactory checks: the archive of an archive entry and the file a checksum sidecar describes (RepoBase.accepts). folder is whether the request named a folder, which in Artifactory is a trailing slash (RepoPathImpl). The root is always accepted, and so is a system path (systemPath) by the patterns, though not by the blackout.
A virtual repository has no blackedOut (only RealRepoDescriptor carries it), and its own patterns refusing the path leave it no member to search (VirtualRepoDownloadStrategy.getInfoFromSearchableRepositories), which it answers 404 with that message.
Types ¶
type Handler ¶
type Handler struct{}
Handler implements format.Handler for generic content.
func (Handler) Admit ¶
func (Handler) Admit( _ context.Context, _ format.Env, c repo.Config, w format.Write, ) (format.Write, error)
Admit refuses writes to a blacked-out repository and to paths its include and exclude patterns reject, as Artifactory does for every package type.