chartstamp

package
v0.2.14 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package chartstamp derives the chart a release publishes to its OCI registry from the chart asset the acceptance matrix installed.

The derivation is a function of the asset's bytes and of the identities the release manifest records, and it reads no clock, so anyone holding those can compute the published chart and its registry digest offline. The release records that digest in its manifest before the chart reaches a registry, and every later run computes it again.

Only Chart.yaml changes. The stamp is three annotations the chart's templates read beside the values, and every other entry keeps its bytes and its header, so the templates that run are the ones the matrix ran.

Index

Constants

View Source
const (
	// Repository is where a release publishes the chart.
	Repository = "ghcr.io/stokaro/charts/ptah-operator"

	// The annotations the chart's templates read. A chart from the source tree
	// carries none of them, which is what makes it refuse to install without
	// explicit values.
	AnnotationImage       = "operator.ptah.run/stamped-image"
	AnnotationExecutor    = "operator.ptah.run/stamped-executor-image"
	AnnotationPtahVersion = "operator.ptah.run/stamped-ptah-version"
	// AnnotationPrefix is what no chart from the source tree may carry.
	AnnotationPrefix = "operator.ptah.run/stamped-"
)

Variables

This section is empty.

Functions

func ReadBack

func ReadBack(ctx context.Context, target oras.ReadOnlyTarget, reference, digest string) error

ReadBack reads a chart through reference the way Helm does, and refuses anything but the digest it was told to expect. Fetching checks each digest it reads.

func Stage

func Stage(ctx context.Context, target oras.Target, artifact Artifact) error

Stage writes the artifact by digest, under no tag, and refuses to report success unless the registry resolves that digest. It can sign and attest there and be read by digest, and no name a reader installs by reaches it. Running it again changes nothing, and the bytes can always be computed again, so a resumed release transaction needs no retention tag to find them.

func Tag

func Tag(ctx context.Context, target oras.Target, digest, version string) error

Tag gives the chart at digest its version tag, the name `helm --version` reads. A version names one chart for good: a tag that already holds that digest is the done state, and a tag that holds another is refused rather than moved, since a reader who verified it would otherwise install something else.

Types

type Artifact

type Artifact struct {
	// Chart is the stamped package, which is the artifact's only layer.
	Chart []byte
	// Config is the chart's metadata as Helm stores it.
	Config []byte
	// Manifest is the bytes the registry serves under Digest.
	Manifest []byte
	// Digest is what the release manifest records and what is signed and attested.
	Digest string
	// Name and Version are the chart's own.
	Name, Version string
}

Artifact is the chart as an OCI registry holds it.

func Build

func Build(asset []byte, release Release) (Artifact, error)

Build derives the published artifact from a packaged chart.

func RecordInManifest

func RecordInManifest(document, asset []byte) ([]byte, Artifact, error)

RecordInManifest returns the document with the stamped chart's reference added, computed from the asset and the identities the document already names.

func (Artifact) Reference

func (a Artifact) Reference() string

Reference is where a published release serves the artifact.

type Manifest

type Manifest struct {
	Release
	Version, SourceRepository, SourceRef string
	// Chart is the chart-oci record, empty before the release records it.
	Chart string
}

Manifest is what the chart's path reads from a release manifest. releaseverify holds the whole document to its exact shape; this reads the records it names and refuses a document that lacks one.

func ParseManifest

func ParseManifest(document []byte) (Manifest, error)

ParseManifest reads a release manifest's key=value records.

func (Manifest) ChartDigest

func (m Manifest) ChartDigest() (string, error)

ChartDigest is the digest the chart-oci record names, which has to be a pinned reference into Repository.

type Release

type Release struct {
	// Image is the manager and runner image, pinned by digest.
	Image string
	// Executor is the Ptah image, pinned by digest.
	Executor string
	// PtahVersion is the version verified for Executor.
	PtahVersion string
	// Revision is the commit the chart asset was packaged from.
	Revision string
}

Release is what a release manifest says about the chart's defaults.

Directories

Path Synopsis
Package chartstamptest serves the part of the OCI distribution API that a push and a helm pull use, so a test can run both against the bytes they would write to a real registry, with no daemon and no network.
Package chartstamptest serves the part of the OCI distribution API that a push and a helm pull use, so a test can run both against the bytes they would write to a real registry, with no daemon and no network.

Jump to

Keyboard shortcuts

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