Documentation
¶
Overview ¶
Package registrytest runs an in-memory OCI registry for tests and builds images that look like the official php image and images derived from it. Images carry a real (small) layer so tests can check that layers are never downloaded.
Index ¶
- Constants
- func PHPEnv(v string) []string
- type Server
- func (s *Server) EmptyIndex(repo, tag string) v1.Hash
- func (s *Server) Image(sp Spec) v1.Image
- func (s *Server) Index(specs ...Spec) v1.ImageIndex
- func (s *Server) LayerFetched(reqs []string) bool
- func (s *Server) Mirrors() map[string]string
- func (s *Server) PHPIndex(v string, tags ...string) v1.Hash
- func (s *Server) PHPIndexOn(v, base string, platforms []string, tags ...string) (v1.Hash, []v1.Hash)
- func (s *Server) Push(repo, tag string, img v1.Image) v1.Hash
- func (s *Server) PushIndex(repo, tag string, idx v1.ImageIndex) v1.Hash
- func (s *Server) Requests() []string
- type Spec
Constants ¶
const Attestation = "attestation"
Attestation is an index entry that is a BuildKit attestation manifest.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Server ¶
type Server struct {
Host string
// Fail, when set, may answer a request itself with a status code (and
// Retry-After seconds when >= 0): return 0 to pass the request through.
Fail func(r *http.Request) (status int, retryAfter int)
// contains filtered or unexported fields
}
Server is an in-memory registry.
func (*Server) EmptyIndex ¶
EmptyIndex pushes an index with no manifests ({"manifests":[]}).
func (*Server) Index ¶
func (s *Server) Index(specs ...Spec) v1.ImageIndex
Index builds an OCI index of one image per spec; a spec with OS Attestation adds an attestation manifest (platform unknown/unknown).
func (*Server) LayerFetched ¶
LayerFetched reports whether any request fetched a pushed layer blob.
func (*Server) PHPIndex ¶
PHPIndex pushes an official-style multi-platform php index for version v at each tag, with an attestation manifest, and returns its digest. Platforms default to linux/amd64 and linux/arm64/v8.
func (*Server) PHPIndexOn ¶
func (s *Server) PHPIndexOn(v, base string, platforms []string, tags ...string) (v1.Hash, []v1.Hash)
PHPIndexOn pushes an official-style php index for version v built on base (an org.opencontainers.image.base.name value such as "debian:bookworm-slim" or "alpine:3.21") for each platform (default linux/amd64 and linux/arm64/v8), with an attestation manifest, at each tag. The first tag is the image version annotation.
type Spec ¶
type Spec struct {
OS, Arch, Variant string
Env []string
Created time.Time
// Base and Version set the org.opencontainers.image.base.name and
// org.opencontainers.image.version annotations (on the image manifest
// and its index entry), as Docker Hub's official images carry them.
Base, Version string
// History, when set, is the config's first history entry (created_by).
History string
}
Spec describes one platform image.