Documentation
¶
Overview ¶
Package docker is the storage layout of Docker and OCI images in a repository's item tree (decision 0031), which the JFrog CLI reads with AQL and the storage API: an image is a folder, each tag a folder of its own below it and each manifest pushed by digest a folder named sha256:<hex>, and every blob a file named sha256__<hex> in the folders of the images that use it. Finished uploads wait in the image's _uploads folder until a manifest links them.
Role ¶
artifacts module, ecosystem layer: the storage layout and index hooks of the registry slice, one format for the package types docker, oci and helmoci (Serves), which share one protocol and one layout (decision 0031), and the rules of their remote repositories (remote_*.go). Its Handler plugs into the item service through the format hooks (decision 0032), so every write and delete in those repositories reaches it whichever API carried it: a push, a jf rt upload, a copy, a move or a restore. The registry's writes are core's (artifacts/core/registry), and its protocol is the slice's http package, ecosystem/docker/http.
Inputs ¶
- Driving: the format registry (artifacts/ecosystem), which hands the item service's hooks for docker, oci and helmoci repositories to Handler; the registry protocol (ecosystem/docker/http), which parses manifests, checks digests, tags and image names, and lists tags, images and catalogs; the registry's writes (artifacts/core/registry), which name upload paths and digest folders, find blobs, manifests and referrers, set a stored manifest's properties and apply Max Unique Tags and Tag Retention (Retained, Manifests); the Docker REST operations (DockerAPI in ecosystem/docker/http), which check a promotion's tag; the registry source service the application builds over the shared policy of registry remotes, whose upstream fetches and cache uploads RegistryContent serves once installed, and whose reads it checks; the registry protocol's remote reads, which name their resources with RegistryResource; and Smart Remote, which the application gives ParseRegistryPath (smart.NewSmart).
- Driven: the format hooks' environment (format.Env), through which Handler reads stored manifests and chart configs and keeps the package index (artifacts/core/pkgindex); the item store's AQL search (port.ItemStore, artifacts/core/aql), through which the lookups find blobs, manifests, tags and referrers; the item store's page reader (port.DockerPageStore), from which TagPages and ImagePages read a tags list's and a catalog's pages (#1402); and core remote: the shared policy (remote.Policy), through which RegistryContent checks, reads and caches child manifests and configs and opens what the cache holds, and the registry port (remote.Registries), through which it opens upstream registry clients and sends foreign layer requests.
Outputs ¶
- The layout: Serves, UploadsFolder, BlobFile, UploadPath, DigestFolder and IsDigestFolder, ManifestFile and ListManifestFile, and the grammar of tags and digests (ValidTag, ReservedTag, ValidDigest and SHA256Hex).
- Manifests: Manifest, Descriptor and Platform, ParseManifest with ErrManifestInvalid and MaxManifestSize, the media types (MediaTypeOCIManifest and the rest, MediaTypeHelmConfig), an image's config (Config, ReadConfig), and the properties a stored manifest carries (Properties: ManifestProperty, LabelPropertyPrefix and the rest, and SubjectProperty and ArtifactTypeProperty, from which the referrers API is answered), and PushProperties, which a pushed image manifest adds ContentTypeProperty to.
- Lookups over the item store: FindBlob and FindBlobs (every copy of a blob in the image, from which a pull picks one the repository's patterns accept), FindManifest, FolderManifest, ManifestFolders, Tags, Manifests, Retained, ImageManifests and FindReferrers, with Compare and Fold, the specification's order of tags and names, and PushTime, a tag's place among its image's tags.
- Pages over the item store's page reader: TagPages (TagsAfter), an image's tags in Compare's order, with Found; and ImagePages (ImagesAfter), a repository's images; each reads a batch at a time.
- Handler: the hooks that index images and tags, classify a tag's manifest as metadata, admit writes under the generic deploy policy, settle the index after deletes and reindex a repository; and Chart, the Helm chart a tag holds (decision 0039).
- The remote rules: RegistryContent (Install, Read), which serves a remote repository's manifests, blobs, tag lists and referrers verified; RegistryResource, the cache and permission paths of a registry read; and ParseRegistryPath, the registry path grammar.
Invariants ¶
- This package never imports the router (internal/app) or its own http package (decision 0031). The item service calls its hooks and never imports it; the remote rules use only the item package's cache upload contract and its errors.
- An image is a package while it holds any manifest, tagged or not; a tag folder holding one is a version whose files are the folder's items, ordered by the tag's last push; digest folders and _uploads are no versions (decision 0018).
- A remote repository's index covers its cache, which alone holds its items: the hooks and the reindex read only there (pkgindex.Stored, decision 0018). Tag Retention and Max Unique Tags run after a push, which a remote never takes, so Retained and Manifests read a repository's own items.
- The layout's folder and file names and the manifest properties are what jf searches with AQL and reads through the storage API (research 23, 5.1 and 5.2), so they stay byte-identical.
- ParseManifest refuses a schema-1 manifest (DV-034), a type other than the four stored, and a descriptor without a valid digest; a manifest larger than MaxManifestSize (4 MiB) is never accepted.
- A remote read caches only verified content: every descriptor of a manifest is checked before it is cached, a foreign layer is fetched only under the repository's external dependency patterns and never with registry credentials or custom headers (decision 0007), and a listing joined from pages carries Vary: *, which keeps it out of the cache, when any page carried Vary.
- The cache variant registry-v1, the canonical manifest Accept list and the cache paths RegistryResource names stay byte-identical: a change would orphan every cached entry.
References ¶
- Decision 0031: docs/research/decisions/0031-docker-oci-registry.md (protocol and storage layout), and research 23 (docs/research/23-docker-oci-registry.md).
- Decision 0003: docs/research/decisions/0003-repository-model.md (repository model and Docker access method); decision 0032: docs/research/decisions/0032-package-format-handlers.md (format hooks); decision 0018: docs/research/decisions/0018-package-index.md; decision 0039: docs/research/decisions/0039-helm.md (Helm OCI); decision 0007: docs/research/decisions/0007-remote-repositories.md (remote repositories: proxy and cache).
- docs/operations/registry-remote.md (Docker, OCI and Helm OCI remote repositories, and the paths their cache uses) and docs/testing/nimmodel.md (the Docker remote a NIM repository pairs with).
- The OCI Distribution Specification v1.1.1: https://github.com/opencontainers/distribution-spec/blob/v1.1.1/spec.md.
- JFrog's pages decision 0031 cites: https://docs.jfrog.com/artifactory/docs/docker-repositories, https://docs.jfrog.com/artifactory/docs/additional-docker-information and https://docs.jfrog.com/integrations/reference/promotedockerimage.
- Target layout: docs/research/architecture-options/5-modular-monolith.md, line 229 (ecosystem/docker, also oci and helmoci), line 382 (one registry protocol for the three types), lines 656 and 657 (the registry remote rules, remote_*.go) and line 1001 (the mapping row).
- Plan: docs/implementation/plan.md#p6-dockeroci, #p8-pypi-nuget-helm-terraform-locals, #p9-remote-repositories and #p9d-modular-monolith-migration, epic ECO (https://github.com/weaveplatform/artifactweave/issues/943).
- https://github.com/weaveplatform/artifactweave/issues/223 (the storage layout), https://github.com/weaveplatform/artifactweave/issues/227 (tags in the package index and tag retention), https://github.com/weaveplatform/artifactweave/issues/624 (remote reads), https://github.com/weaveplatform/artifactweave/issues/1022, https://github.com/weaveplatform/artifactweave/issues/1023 and https://github.com/weaveplatform/artifactweave/issues/1180 (a remote repository's cached images in the index)
Status ¶
Implemented P6, with Helm OCI chart metadata in P8 and remote retrieval in P9. Moved here in P9d.
Testing ¶
- layout_test.go, list_test.go and manifest_test.go: paths, blob, manifest, tag, image and catalog lookups against stored items, manifest parsing and refusals, properties and image configs; list_page_test.go: TagPages and ImagePages against the same items, in every batch size, and their store failures.
- handler_test.go and index_fault_test.go: classification, generic admission, and store failures while indexing; push times.
- chart_test.go: a Helm chart's metadata on its tag, and configs or manifests that cannot be read.
- referrers_test.go: subjects, artifact types, index children and the referrers lookup.
- index_test.go: a cached image's package, dated by its earliest cached manifest and kept while a cached tag remains, and the reindex of a local and a remote repository over the hooks' index and from empty.
- retention_test.go: Manifests, from a repository's own items and never a remote's cache.
- contract_test.go: the format contract suite (artifacts/core/formattest) for docker, its cache scenario included.
- remote_content_test.go: registry path validation, listing pagination and its boundaries, descriptor integrity and the foreign layer policy; remote_path_test.go: the parser's name grammar against the transport's; remote_pages_test.go: the cache marker on a listing joined from pages.
- test/server/artifacts/docker's registry remote tests drive the remote rules through the application's wiring, and core remote's smart_registry_test.go gives Smart Remote this package's parser.
- The registry protocol's tests (ecosystem/docker/http) and the guard suites test/server/artifacts/docker and test/server/artifacts/helmoci drive the layout through the registry.
Index ¶
- Constants
- Variables
- func BlobFile(hex string) string
- func Compare(a, b string) int
- func DigestFolder(hex string) string
- func FindBlob(ctx context.Context, items port.ItemStore, repoKey, name, hex string) (model.Item, error)
- func FindBlobs(ctx context.Context, items port.ItemStore, repoKey, name, hex string) ([]model.Item, error)
- func FindManifest(ctx context.Context, items port.ItemStore, repoKey, name, hex string) (model.Item, error)
- func FindReferrers(ctx context.Context, items port.ItemStore, ...) ([]aql.Hit, error)
- func Fold(s string) string
- func FolderManifest(ctx context.Context, items port.ItemStore, repoKey string, cached bool, ...) (model.Item, bool, error)
- func ImageManifests(ctx context.Context, items port.ItemStore, repoKey, name string) ([]aql.Hit, error)
- func IsDigestFolder(folder string) bool
- func ManifestFolders(ctx context.Context, items port.ItemStore, repoKey, name, hex string) ([]string, error)
- func Manifests(ctx context.Context, items port.ItemStore, repoKey, name string) ([]model.Item, error)
- func ParseRegistryPath(path string) (image, operation, reference string, err error)
- func Properties(m Manifest, name, folder string, c Config) model.Properties
- func PushProperties(m Manifest, name, folder string, c Config) model.Properties
- func PushTime(m model.Item) time.Time
- func RegistryResource(image, operation, reference string) (source.Resource, error)
- func ReservedTag(tag string) bool
- func Retained(ctx context.Context, items port.ItemStore, repoKey, name, tag string) ([]model.Item, error)
- func SHA256Hex(d string) (hex string, ok bool)
- func Serves(t repo.PackageType) bool
- func Tags(ctx context.Context, items port.ItemStore, repoKey, name string) ([]string, bool, error)
- func UploadPath(name, hex string) string
- func ValidDigest(d string) bool
- func ValidTag(tag string) bool
- type Chart
- type Config
- type Descriptor
- type Handler
- func (Handler) Classify(_ repo.Config, p string) format.Class
- func (Handler) Deleted(ctx context.Context, env format.Env, c repo.Config, removed []model.Item) error
- func (Handler) Deleting(context.Context, format.Env, repo.Config, model.Item) error
- func (Handler) Deployed(ctx context.Context, env format.Env, c repo.Config, it model.Item) error
- func (Handler) Reindex(ctx context.Context, env format.Env, c repo.Config) error
- type ImagePages
- type Manifest
- type Platform
- type RegistryContent
- type TagPages
Constants ¶
const ( MediaTypeOCIManifest = "application/vnd.oci.image.manifest.v1+json" MediaTypeOCIIndex = "application/vnd.oci.image.index.v1+json" MediaTypeDockerManifest = "application/vnd.docker.distribution.manifest.v2+json" MediaTypeDockerList = "application/vnd.docker.distribution.manifest.list.v2+json" )
The manifest media types the registry stores (decision 0031).
const ( ManifestFile = "manifest.json" ListManifestFile = "list.manifest.json" )
The stored manifest's file name in its tag or digest folder, which jf reads (research 23, 5.1).
const ( ManifestProperty = "docker.manifest" ManifestDigestProperty = "docker.manifest.digest" ManifestTypeProperty = "docker.manifest.type" RepoNameProperty = "docker.repoName" SHA256Property = "sha256" // LabelPropertyPrefix starts the property of each label of an image's // config. LabelPropertyPrefix = "docker.label." // OSProperty and ArchitectureProperty are an image's platform, from its // config, as Artifactory sets them on manifest.json from 7.125.4. OSProperty = "docker.os" ArchitectureProperty = "docker.architecture" )
The properties set on every stored manifest (decision 0031). jf finds a manifest by digest through ManifestDigestProperty and SHA256Property, and Docker clients pulling through Artifactory fail with "missing signature key" when one is wrong (research 23, 5.2).
const ( // SubjectProperty is the subject's digest. SubjectProperty = "oci.subject" // ArtifactTypeProperty is the type the referrers API reports and filters // the manifest by. ArtifactTypeProperty = "oci.artifactType" )
The properties a manifest with a subject carries, from which the referrers API is answered: no referrers.json is written (DV-036).
const ContentTypeProperty = "artifactory.content-type"
ContentTypeProperty is the type a file downloads with on the item route (7.x's CONTENT_TYPE_PROP_KEY), which a pushed image manifest carries (PushProperties).
const MaxManifestSize = 4 << 20
MaxManifestSize is the largest manifest accepted: the specification asks registries to take at least 4 MB, and a larger one answers 413.
const MediaTypeHelmConfig = "application/vnd.cncf.helm.config.v1+json"
MediaTypeHelmConfig is the config of a Helm chart pushed as an OCI artifact: its Chart.yaml as JSON, beside a chart layer and, for a signed chart, a provenance layer (Helm's pkg/registry/constants.go; research 30, 6.1). The registry stores a chart like any image; only the package index reads the config.
const UploadsFolder = "_uploads"
UploadsFolder is the folder below an image that holds its finished uploads, as on Artifactory; jf leaves it out of its searches.
Variables ¶
var ErrManifestInvalid = errors.New("docker: invalid manifest")
ErrManifestInvalid is a manifest the registry refuses to store: MANIFEST_INVALID.
Functions ¶
func Compare ¶
Compare orders tags and image names as the specification orders tags, case-insensitively, with names that differ only in case ordered by their bytes, so that the order is total and a page continued after last neither repeats nor skips a name (decision 0031).
func DigestFolder ¶
DigestFolder is the folder below an image of the manifest pushed by its digest, whose SHA-256 is hex: every platform manifest of a multi-architecture push, and a tag's previous manifest kept by Tag Retention.
func FindBlob ¶
func FindBlob( ctx context.Context, items port.ItemStore, repoKey, name, hex string, ) (model.Item, error)
FindBlob returns a file holding the blob hex in one of the image name's own folders: a tag folder, a digest folder or _uploads, each a direct child of name (decision 0031). A blob only in a deeper folder belongs to another image whose name begins with this one, and is not found: the depth puts the file exactly two levels below name. kernel.ErrNotFound when there is none.
func FindBlobs ¶
func FindBlobs( ctx context.Context, items port.ItemStore, repoKey, name, hex string, ) ([]model.Item, error)
FindBlobs returns every file FindBlob could return for the blob hex: a layer that several tags of the image share has a copy in each tag folder, and a pull may serve any copy the repository's patterns accept.
func FindManifest ¶
func FindManifest( ctx context.Context, items port.ItemStore, repoKey, name, hex string, ) (model.Item, error)
FindManifest returns the stored manifest whose SHA-256 is hex in one of the image name's own folders, a tag folder or a digest folder, each a direct child of name, as FindBlob finds blobs. kernel.ErrNotFound when there is none.
func FindReferrers ¶
func FindReferrers( ctx context.Context, items port.ItemStore, repoKey, name, subject, artifactType string, ) ([]aql.Hit, error)
FindReferrers returns the stored manifests in the image name's own folders whose subject is the digest subject, those of artifactType alone when it is set, each with its properties. A manifest stored in several folders, by digest and by tag, is a hit in each.
func FolderManifest ¶
func FolderManifest( ctx context.Context, items port.ItemStore, repoKey string, cached bool, dir string, ) (model.Item, bool, error)
FolderManifest returns the manifest file in the image folder dir; ok is false when the folder holds none, and so is no tag.
func ImageManifests ¶
func ImageManifests( ctx context.Context, items port.ItemStore, repoKey, name string, ) ([]aql.Hit, error)
ImageManifests returns every stored manifest, image or index, in the image name's own folders: its tag folders and its digest folders, each a direct child of name, as FindManifest searches them. A manifest of an image whose name begins with this one sits deeper and is left out. Each hit carries its properties.
func IsDigestFolder ¶
IsDigestFolder reports whether a folder below an image is a digest folder (a push by digest, a platform manifest or a retained version), which is never a tag.
func ManifestFolders ¶
func ManifestFolders( ctx context.Context, items port.ItemStore, repoKey, name, hex string, ) ([]string, error)
ManifestFolders returns the folders of the image name in repoKey that hold the manifest whose SHA-256 is hex, tag folders and the digest folder alike, in the specification's order.
func Manifests ¶
func Manifests( ctx context.Context, items port.ItemStore, repoKey, name string, ) ([]model.Item, error)
Manifests returns every manifest stored in the image name, in its tag and digest folders alike.
func ParseRegistryPath ¶
ParseRegistryPath splits a registry API path, <image>/<operation>/<reference>, as RegistryResource builds it for a remote read, into its image name, operation and reference. The image must match the Distribution name grammar the transport sends; the operation must be manifests with a tag or a sha256 digest, blobs or referrers with a sha256 digest, or tags with list. Anything else is remote.ErrRequest. Smart Remote is given it as its registry path parser (smart.NewSmart), so that core remote never imports this package. It reads neither store nor network.
func Properties ¶
func Properties(m Manifest, name, folder string, c Config) model.Properties
Properties are the properties of the manifest stored in folder of the image name: the five jf and Docker clients rely on, oci.subject and oci.artifactType for a manifest with a subject, which the referrers API is answered from (DV-036), the image's docker.os and docker.architecture, and a docker.label.<label> for each of its labels. A label whose name no property key may carry is left out.
func PushProperties ¶
func PushProperties(m Manifest, name, folder string, c Config) model.Properties
PushProperties are the Properties of a manifest a client pushes to a local repository, and for an image manifest, stored as manifest.json, ContentTypeProperty set to its media type as well. 7.161.26's AbstractMetadataProviderTest (testDockerpkgIdResolver, testOciPkgIdResolver) gives a docker-local and an oci-local manifest.json the property beside the five of Properties, equal to docker.manifest.type, and a comment on RTFACT-26059 (7.19.4) changed it on a local manifest.json to change what a pull through another registry received. So the item route serves a pushed manifest.json with its media type; the registry answers with the pushed type whatever the property says (getManifest). No source shows the property on an index's list.manifest.json or on a remote repository's cached manifest, so neither carries it [I].
func PushTime ¶
PushTime is when a stored manifest was last written, its tag's place in the order of decision 0018: a later push of a different manifest replaces the file and so moves the tag to the newest place. A move keeps the time; a copy is a push at its target.
func RegistryResource ¶
RegistryResource fixes cache and authorization paths independently of an upstream namespace prefix. Manifest Accept is canonical so supported clients share exact bytes; delivery separately checks each caller's accepted types.
func ReservedTag ¶
ReservedTag reports whether a valid tag would collide with a folder the layout keeps beside tag folders: _uploads, as on Artifactory. A digest folder needs no reservation, since no tag may hold its colon, and sha256__<hex> is an ordinary tag, as in a 7.x local repository (research 23, 8).
func Retained ¶
func Retained( ctx context.Context, items port.ItemStore, repoKey, name, tag string, ) ([]model.Item, error)
Retained returns the previous manifests of the image name's tag that Tag Retention kept (decision 0031), oldest push first. A retained manifest is one that moved from the tag folder to its own digest folder and so still names the tag in docker.manifest, where a manifest pushed by digest names its digest folder.
func SHA256Hex ¶
SHA256Hex returns the hex of a valid sha256 digest; ok is false for another algorithm or an invalid digest.
func Serves ¶
func Serves(t repo.PackageType) bool
Serves reports whether repositories of package type t hold images: docker, and the oci and helmoci types that share its protocol and layout (research 04).
func Tags ¶
func Tags( ctx context.Context, items port.ItemStore, repoKey, name string, ) ([]string, bool, error)
Tags returns the tags of the image name in repoKey in the specification's order: the folders directly below it that hold a manifest (decision 0031). A digest folder holds a manifest but is no tag, and a reserved name is never one. found is false when the image holds no manifest at all, which the registry answers NAME_UNKNOWN.
func UploadPath ¶
UploadPath is the path of the finished upload of hex in the image name.
func ValidDigest ¶
ValidDigest reports whether d is a digest by the specification's grammar; a sha256 digest must also be 64 lower-case hex characters.
Types ¶
type Chart ¶
type Chart struct {
Name string `json:"name"`
Version string `json:"version"`
AppVersion string `json:"appVersion,omitempty"`
}
Chart is the chart a tag holds, as its config names it. Version is the chart's own, which may hold the "+" that Helm writes "_" in the tag.
type Config ¶
type Config struct {
// OS and Architecture are the config's own fields. A platform variant
// (arm's v7, arm64's v8) is not part of either: Artifactory documents
// no variant property, so docker.architecture holds the config's
// architecture exactly as an index's platform names it, recorded as
// [I] on #216 (decision 0031).
OS string
Architecture string
Labels map[string]string
}
Config is what an image's config gives its manifest's properties.
type Descriptor ¶
type Descriptor struct {
MediaType string `json:"mediaType"`
Digest string `json:"digest"`
Size int64 `json:"size"`
ArtifactType string `json:"artifactType,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
URLs []string `json:"urls,omitempty"`
// Platform is the platform an index's entry names; nil when it names
// none, as on every descriptor outside an index.
Platform *Platform `json:"platform,omitempty"`
}
Descriptor points at a blob or a manifest from a manifest.
type Handler ¶
type Handler struct {
// The generic format admits writes under every package type's deploy
// policy.
generic.Handler
}
Handler is the format of docker, oci and helmoci repositories, which the item service calls on every write and delete in them. It keeps the package index of decision 0018: an image is a package while it holds any manifest, tagged or not, and each tag folder holding a manifest is a version whose files are the folder's items, ordered by the tag's last push. Digest folders and _uploads are no versions. A tag holding a Helm chart keeps the chart's name, version and appVersion as the version's metadata (decision 0039), since its tag writes a version's "+" as "_".
func (Handler) Classify ¶
Classify reports a tag folder's manifests as metadata, since a push moves the tag to other content under the same path, and every other file, digest-addressed or a layer, as unique.
func (Handler) Deleted ¶
func (Handler) Deleted( ctx context.Context, env format.Env, c repo.Config, removed []model.Item, ) error
Deleted brings the index back in line with the tree after files of images were removed: a tag folder left without a manifest is no longer a version even if blobs remain in it, and an image is a package exactly while it still holds a manifest somewhere, which the item service's pruning of empty versions cannot know.
func (Handler) Deleting ¶
Deleting runs before a file of an image is removed. The item service drops the file's version link with it; Deleted settles the rest.
func (Handler) Deployed ¶
Deployed indexes a file stored in an image. A manifest in a tag folder makes the folder a version and links every file already in it, which covers copies, moves and restores that land the manifest after its blobs; another file joins its folder's version once the folder is a tag. A manifest in a digest folder keeps its image a package.
type ImagePages ¶
type ImagePages struct {
// contains filtered or unexported fields
}
ImagePages lists the images of one repository, each a folder holding a manifest in a tag or digest folder of its own (decision 0031), in byte order, reading the store a page of manifests at a time (#1402). Accept judges the images a catalog may list: those it refuses are skipped before the page is cut.
func ImagesAfter ¶
func ImagesAfter( pages port.DockerPageStore, repoKey, prefix, last string, accept func(string) bool, batch int, ) *ImagePages
ImagesAfter returns the images of repoKey that accept takes and that follow last in Compare's order, all of them when last is empty. With a prefix, as the registry-wide catalog names images <repo>/<image>, last is compared with the prefixed names. It reads batch manifests a query.
The store orders images by their bytes. An image the catalog lists has a valid name, which is lower case, so that is Compare's order, and with a prefix too: one repository's names share it.
type Manifest ¶
type Manifest struct {
// MediaType is the type the manifest is stored as: the Content-Type it
// was pushed with.
MediaType string
// Digest is the SHA-256 of the exact bytes pushed, in hex.
Digest string
// Config and Layers are an image manifest's blobs.
Config *Descriptor
Layers []Descriptor
// Manifests are an index's children.
Manifests []Descriptor
// Subject is the manifest this one refers to, if any.
Subject *Descriptor
// ArtifactType and Annotations are the manifest's own, which the
// referrers API reports for it.
ArtifactType string
Annotations map[string]string
}
Manifest is a parsed image manifest, image index or Docker manifest list.
func ParseManifest ¶
ParseManifest parses body, pushed with contentType, as the manifest whose SHA-256 is hex. It refuses with ErrManifestInvalid a schema-1 manifest (DV-034), any type but the four stored, a body that does not parse, a mediaType field that disagrees with contentType, and descriptors without a valid digest. Without a Content-Type the body's own mediaType names the type.
func (Manifest) BlobDescriptors ¶
func (m Manifest) BlobDescriptors() []Descriptor
BlobDescriptors are the descriptors behind Blobs: the config and every layer the registry must hold, in order and with any repeats, so that each descriptor's size can be checked against the stored content.
func (Manifest) Blobs ¶
Blobs are the digests of the blobs that must be in the image before an image manifest is stored: its config and its layers, once each, in the manifest's order. Non-distributable and foreign layers live elsewhere by design and are not required (decision 0031).
func (Manifest) Children ¶
Children are the digests of an index's manifests, once each, in the index's order.
func (Manifest) ConfigType ¶
ConfigType is the media type of an image manifest's config, "" for an index.
func (Manifest) ReferrerType ¶
ReferrerType is the artifactType the referrers API reports for the manifest: its own artifactType, or for an image manifest without one its config's media type, as the specification says. An index without one has none.
type Platform ¶
type Platform struct {
OS string `json:"os"`
Architecture string `json:"architecture"`
Variant string `json:"variant,omitempty"`
}
Platform is the platform an index's entry runs on. buildx names an attestation manifest's platform unknown/unknown.
type RegistryContent ¶
type RegistryContent struct {
Policy *remote.Policy
Registries remote.Registries
// contains filtered or unexported fields
}
RegistryContent is the Docker, OCI and Helm OCI rules of remote repositories (decision 0031): it fetches manifests, blobs, tag lists and referrers from the upstream registry, checks every descriptor and foreign layer before the cache publishes them, and joins paginated listings into one. Policy is the shared policy of registry remotes, apart from the ordinary one; Registries opens the upstream clients, whose pool and credentials belong to the application lifetime. It remembers the descriptors of the manifests it reads, by source identity and credential revision, so that a blob or a child manifest is held to the descriptor that named it. It is safe for concurrent use.
func (*RegistryContent) Install ¶
func (c *RegistryContent) Install()
Install makes c the policy's upstream fetch and its check of every cache upload, replacing both hooks. Call it before anything wraps the policy's PrepareUpload, as smart.NewSmart does, and before the policy serves a request.
func (*RegistryContent) Read ¶
func (c *RegistryContent) Read( ctx context.Context, q source.Request, permit source.Permit, ) (source.Result, error)
Read reads q through the policy and holds a manifest or a blob to the registry's evidence before it is served. Unless the read may not reach the upstream (a cache-only intent, no network, an offline repository), it revalidates the result, checks a blob's size against the descriptor a manifest gave for it, and parses a manifest, remembering its descriptors for the blobs and children read after it. A result that fails a check is source.ErrInvalidResult, a credential revision that changed under the read source.ErrSuperseded, and a store failure source.ErrUnavailable. Any other request returns what the policy returned.
type TagPages ¶
type TagPages struct {
// contains filtered or unexported fields
}
TagPages lists the tags of one image in the specification's order (Compare), reading the store a page of manifest folders at a time (#1402), so that a tags list holds the page it answers rather than every tag of the image. It is the paged form of Tags, which promotion uses to take every tag.
func TagsAfter ¶
func TagsAfter( pages port.DockerPageStore, repoKey, name, last string, batch int, ) *TagPages
TagsAfter returns the tags of the image name in repoKey that follow last in Compare's order, all of them when last is empty, reading batch folders a query.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package dockerhttp serves the registry protocol, the OCI Distribution Specification v1.1 with Docker's extensions, for docker, oci and helmoci repositories (decisions 0003 and 0031).
|
Package dockerhttp serves the registry protocol, the OCI Distribution Specification v1.1 with Docker's extensions, for docker, oci and helmoci repositories (decisions 0003 and 0031). |