registrycatalog

package
v1.5.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package registrycatalog implements a minimal client for the Docker Registry HTTP API v2's catalog endpoints (_catalog, <name>/tags/list), used to browse repositories and tags in Levelrail's own built-in registry (internal/reconcile/registry) from the app-creation UI. Deliberately scoped to that one registry: see internal/api's RegistryCatalogClient interface doc comment for why an arbitrary external registry's catalog isn't queried the same way.

Index

Constants

View Source
const AllowPrivateEnv = "APP_REGISTRY_ALLOW_PRIVATE_NETWORKS"

AllowPrivateEnv additionally lets operators use registries on loopback. Private LAN ranges are allowed by default; link-local and metadata addresses are always refused.

Variables

View Source
var ErrNotFound = errors.New("registrycatalog: repository not found")

ErrNotFound reports that the registry has no such repository, the v2 API's own signal (a 404 from tags/list) for a name nothing has ever been pushed to, distinct from an unreachable registry or a rejected credential.

Functions

func AllowPrivate

func AllowPrivate() bool

AllowPrivate reports whether AllowPrivateEnv is set to a true value.

Types

type Client

type Client struct {
	HTTP *http.Client
}

Client queries a Docker Registry HTTP API v2 server's catalog endpoints over Basic Auth.

func NewClient

func NewClient() *Client

NewClient returns a Client with a bounded per-request timeout: every call here is a single small JSON request, not a long-lived stream, the same shape githubapp.NewClient establishes for its own client.

func NewExternalClient

func NewExternalClient() *Client

NewExternalClient is NewClient for operator-supplied registry addresses: dials are guarded against internal targets and redirects are not followed, so the Basic credential never leaves the chosen host.

func (*Client) DeleteManifest

func (c *Client) DeleteManifest(ctx context.Context, baseURL, username, password, repository, digest string) error

DeleteManifest removes the manifest with this digest, which untags every tag pointing at it.

func (*Client) ListRepositories

func (c *Client) ListRepositories(ctx context.Context, baseURL, username, password string) ([]string, error)

ListRepositories queries GET {baseURL}/v2/_catalog, returning every repository name the registry knows about, sorted for a stable UI order (the wire response's own ordering is unspecified).

func (*Client) ListTags

func (c *Client) ListTags(ctx context.Context, baseURL, username, password, repository string) ([]string, error)

ListTags queries GET {baseURL}/v2/{repository}/tags/list. repository may itself contain slashes (a namespaced name like "org/app"): it is path-escaped per segment, not as a whole, so those slashes still separate real path segments on the wire.

func (*Client) ListTagsAnonymous

func (c *Client) ListTagsAnonymous(ctx context.Context, baseURL, repository string) ([]string, error)

ListTagsAnonymous lists every tag of a public repository, following the anonymous bearer token flow and Link pagination of the OCI distribution API.

func (*Client) TagInfo

func (c *Client) TagInfo(ctx context.Context, baseURL, username, password, repository, tag string) (TagInfo, error)

TagInfo reads the digest and build time of repository:tag. Created is zero when the image config carries none (an index or a foreign manifest), which sorts as oldest.

type RateLimitError

type RateLimitError struct {
	RetryAfter time.Duration
}

RateLimitError reports an upstream 429 together with its Retry-After.

func (*RateLimitError) Error

func (e *RateLimitError) Error() string

type TagInfo

type TagInfo struct {
	Tag     string
	Digest  string
	Created time.Time
}

TagInfo is one tag with the digest its manifest has and when the image was built.

func PlanPrune

func PlanPrune(tags []TagInfo, keep int, inUse map[string]bool) []TagInfo

PlanPrune picks the tags to remove so the newest keep tags remain. A tag in inUse is never returned, and a digest shared with a kept or in-use tag is never returned either, because deleting a manifest untags every tag that points at it. keep <= 0 plans nothing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL