Documentation
¶
Overview ¶
Package model holds the records strata indexes: images, tags, layers, referrers and lineage edges.
Index ¶
Constants ¶
const ( KindSBOM = "sbom" KindSignature = "signature" KindAttestation = "attestation" KindOther = "other" )
Referrer kinds.
const ( SourceLayers = "layers" SourceAttestation = "attestation" SourceAnnotation = "annotation" SourceLabel = "label" )
Edge sources, strongest first.
const ( ConfidenceExact = "exact" ConfidenceDeclared = "declared" ConfidenceInferred = "inferred" )
Edge confidences.
const PhantomPrefix = "phantom:"
PhantomPrefix marks a node ID that stands for a deleted ancestor, keyed by its chain ID rather than a manifest digest.
Variables ¶
This section is empty.
Functions ¶
func ClassifyArtifact ¶
ClassifyArtifact maps an OCI artifact type to sbom, signature, attestation or other.
Types ¶
type BaseRef ¶ added in v0.3.1
type BaseRef struct {
Digest string `json:"digest"`
Ref string `json:"ref"`
BaseDigest string `json:"base_digest"`
}
BaseRef is a base image a build says an image was built from, such as a FROM image recorded in BuildKit provenance. Ref names it as repo:tag, and BaseDigest is the digest the build resolved it to, which may be a multi-platform index.
type Config ¶
type Config struct {
User string `json:"user"`
Entrypoint []string `json:"entrypoint"`
Cmd []string `json:"cmd"`
Ports []string `json:"ports"`
EnvKeys []string `json:"env_keys"`
EnvValues map[string]string `json:"env_values,omitempty"`
Workdir string `json:"workdir"`
StopSignal string `json:"stop_signal"`
Healthcheck bool `json:"healthcheck"`
}
Config holds the run-time fields of an image config that strata indexes under config.*. Environment values are never kept, only keys, except for keys on the allowlist.
type Edge ¶
type Edge struct {
Child string `json:"child"`
Parent string `json:"parent"`
Source string `json:"source"`
Confidence string `json:"confidence"`
Evidence string `json:"evidence"`
}
Edge is a child-to-parent lineage link with its provenance.
type HistoryEntry ¶
type HistoryEntry struct {
CreatedBy string `json:"created_by"`
EmptyLayer bool `json:"empty_layer"`
}
HistoryEntry is one build step from the image config's history.
type Image ¶
type Image struct {
Digest string `json:"digest"`
Repo string `json:"repo"`
MediaType string `json:"media_type"`
IndexDigest string `json:"index_digest,omitempty"`
Platform Platform `json:"platform"`
Created time.Time `json:"created"`
Size int64 `json:"size"`
ConfigDigest string `json:"config_digest"`
Labels map[string]string `json:"labels"`
Annotations map[string]string `json:"annotations"`
Config Config `json:"config"`
History []HistoryEntry `json:"history,omitempty"`
Layers []Layer `json:"layers"`
ChainIDs []string `json:"chain_ids"`
External bool `json:"external,omitempty"`
}
Image is one platform manifest and its config.
func (*Image) Metadata ¶
Metadata merges config labels and manifest annotations into the single map strata stores and queries as label.*. Labels win on conflict, because they are what the image itself declares.
func (*Image) TopChainID ¶
TopChainID returns the chain ID of the image's full layer stack.
type IndexEntry ¶
IndexEntry links a multi-platform index to one of its platform manifests.
type Layer ¶
type Layer struct {
DiffID string `json:"diff_id"`
BlobDigest string `json:"blob_digest"`
Size int64 `json:"size"`
MediaType string `json:"media_type"`
CreatedBy string `json:"created_by,omitempty"`
}
Layer is one entry in an image's layer stack.
type Platform ¶
type Platform struct {
OS string `json:"os"`
Arch string `json:"arch"`
Variant string `json:"variant,omitempty"`
}
Platform identifies the OS and CPU an image runs on.
type Push ¶ added in v0.2.0
type Push struct {
Repo string `json:"repo"`
Digest string `json:"digest"`
PushedAt time.Time `json:"pushed_at"`
LastPulled time.Time `json:"last_pulled"`
}
Push is what a registry's own API reports about one manifest in one repo: when it was pushed and when it was last pulled. Zero times are unknown.
type Referrer ¶
type Referrer struct {
Subject string `json:"subject"`
Digest string `json:"digest"`
ArtifactType string `json:"artifact_type"`
Kind string `json:"kind"`
}
Referrer is an artifact attached to an image, such as an SBOM or a signature.