Documentation
¶
Overview ¶
Package registry implements an OCI Distribution Spec registry that accepts pushed images and triggers conversion to hypeman's disk format.
Package registry implements token authentication for OCI Distribution registries.
Index ¶
- Variables
- type BlobStore
- func (s *BlobStore) Delete(_ context.Context, repo string, h v1.Hash) error
- func (s *BlobStore) Get(_ context.Context, repo string, h v1.Hash) (io.ReadCloser, error)
- func (s *BlobStore) Put(_ context.Context, repo string, h v1.Hash, r io.ReadCloser) error
- func (s *BlobStore) Stat(_ context.Context, repo string, h v1.Hash) (int64, error)
- type Registry
- type TokenError
- type TokenErrorResponse
- type TokenHandler
- type TokenResponse
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = notFoundError{}
ErrNotFound is returned when a blob is not found.
Functions ¶
This section is empty.
Types ¶
type BlobStore ¶
type BlobStore struct {
// contains filtered or unexported fields
}
BlobStore implements blob storage on the filesystem.
func NewBlobStore ¶
NewBlobStore creates a new filesystem-backed blob store.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry provides an OCI Distribution Spec compliant registry that stores pushed images in hypeman's OCI cache and triggers conversion to ext4 disk format.
func New ¶
New creates a new Registry that stores blobs in the OCI cache directory and triggers image conversion when manifests are pushed.
func (*Registry) Handler ¶
Handler returns the http.Handler for the registry endpoints. This wraps the underlying registry to intercept manifest PUTs and trigger conversion.
func (*Registry) LiveCacheManifestDigests ¶ added in v0.1.0
LiveCacheManifestDigests returns the manifest digests of every tag the registry has accepted since startup, including BuildKit cache exports and regular image pushes. Used by the OCI cache GC as additional roots: the in-memory registry never adds these to index.json (and the Docker manifest blob a push stores is only reachable this way), so without these roots the GC would sweep blobs that are still being served to clients.
type TokenError ¶ added in v0.0.6
TokenError is returned when token authentication fails.
type TokenErrorResponse ¶ added in v0.0.6
type TokenErrorResponse struct {
Errors []TokenError `json:"errors"`
}
TokenErrorResponse wraps token errors.
type TokenHandler ¶ added in v0.0.6
type TokenHandler struct {
// contains filtered or unexported fields
}
TokenHandler handles /v2/token requests implementing Docker Registry Token Authentication. This endpoint is called by Docker/BuildKit clients after receiving a 401 with WWW-Authenticate.
func NewTokenHandler ¶ added in v0.0.6
func NewTokenHandler(verifier *jwtauth.Verifier, revoked *tokenrevocation.List) *TokenHandler
NewTokenHandler creates a new token endpoint handler. All clients must provide explicit credentials (Basic or Bearer auth with JWT).
func (*TokenHandler) ServeHTTP ¶ added in v0.0.6
func (h *TokenHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles GET /v2/token requests. Query parameters:
- scope: repository:name:actions (e.g., "repository:builds/abc123:push,pull")
- service: the registry service name (optional)
Authentication:
- Basic auth: JWT as username (legacy) or password (identitytoken format)
- Bearer auth: the JWT token directly
type TokenResponse ¶ added in v0.0.6
type TokenResponse struct {
// Token is the bearer token to use for registry requests
Token string `json:"token"`
// AccessToken is an alias for Token (some clients expect this)
AccessToken string `json:"access_token,omitempty"`
// ExpiresIn is the lifetime of the token in seconds
ExpiresIn int `json:"expires_in,omitempty"`
// IssuedAt is the time the token was issued (RFC3339)
IssuedAt string `json:"issued_at,omitempty"`
}
TokenResponse is the response from the /v2/token endpoint per Docker Registry Token spec. See: https://distribution.github.io/distribution/spec/auth/token/