Help us shape the future of Go! Take the 2026 Go Developer Survey

imagepreparation

package
v0.55.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package imagepreparation prepares neutral caches, never installed stacks.

Index

Constants

View Source
const BundleManifestName = "manifest.json"
View Source
const ManifestName = "neutral-image.json"

Variables

View Source
var ErrAdmissionMismatch = errors.New("neutral image admission mismatch")
View Source
var ErrNotNeutral = errors.New("image roots contain state that cannot be cloned")

Functions

func CleanTarget

func CleanTarget(target string) error

CleanTarget refuses every existing entry, including foreign custody nested beneath arbitrary directories. Preparation never scrubs an initialized host.

func FileDigest

func FileDigest(name string) (string, error)

func InspectOCIArchive added in v0.54.10

func InspectOCIArchive(name string, image Image, platform Platform) error

inspectOCIArchive authenticates the content graph BEFORE Docker reads an archive. The unsigned bundle's file checksum is a transport check only; authority is the exact catalog digest and every reachable OCI descriptor. Classic Docker exports without their original OCI graph are not admitted.

func ModelDirectory added in v0.54.10

func ModelDirectory(root string, model architecturev2renderer.OfflineModelPin) string

func OfflineBundleReference added in v0.54.10

func OfflineBundleReference(root string) (runtimeprofile.OfflineBundleRef, error)

func SafePath

func SafePath(name string) error

SafePath checks every existing ancestor, not just the final directory.

func StageOfflineModel added in v0.54.10

func StageOfflineModel(ctx context.Context, root string, pin architecturev2renderer.OfflineModelPin, modelCache string) error

StageOfflineModel copies only the reviewed model closure into a new neutral bundle. A pre-existing Ollama cache is a transport optimization, never trust.

func VerifyCandidateToolDirectory added in v0.54.10

func VerifyCandidateToolDirectory(candidate releaseindex.VerifiedPreviewCandidate, directory string) error

VerifyCandidateToolDirectory reuses this owner's complete authenticated tool closure for the existing historical-source extractor. It grants no fresh installation permission and makes no current-process or original-Apply claim.

func VerifyOfflineModelRef added in v0.54.10

func VerifyOfflineModelRef(ctx context.Context, ref runtimeprofile.OfflineBundleRef, component string) (string, error)

VerifyOfflineModelRef is the runtime read-only mount admission, not a new installer. Init has bound the whole authenticated bundle to the canonical ref; runtime additionally re-derives the model's immutable content pins from this binary before each use. It never trusts a manifest's own model hashes.

Types

type Authority added in v0.54.10

type Authority interface {
	NeutralImageProfile(string) ([]byte, error)
	ValidateNeutralImageManifest([]byte) error
}

Authority is implemented by the existing embedded CUE owner. Keeping the artifact transport independent lets native runtime owners reuse model verification without importing the service that constructs those owners.

type BundleFile added in v0.54.10

type BundleFile struct {
	SHA256 string `json:"sha256"`
	Size   int64  `json:"size"`
}

type BundleImage added in v0.54.10

type BundleImage struct {
	Image Image  `json:"image"`
	Path  string `json:"path"`
}

type BundleManifest added in v0.54.10

type BundleManifest struct {
	SchemaVersion string                                   `json:"schemaVersion"`
	Neutral       Manifest                                 `json:"neutral"`
	Images        []BundleImage                            `json:"images"`
	Models        []architecturev2renderer.OfflineModelPin `json:"models"`
	Files         map[string]BundleFile                    `json:"files"`
}

BundleManifest is unsigned transport metadata, never Apply or release authority. The running attested release, embedded catalog and reviewed model table independently authenticate every executable, image and model input.

func ImportOfflineBundle added in v0.54.10

func ImportOfflineBundle(ctx context.Context, options Options, root string) (result BundleManifest, err error)

ImportOfflineBundle only imports admitted neutral artifacts. Native init, generation and Apply retain their existing separate ownership and custody.

func PrepareOfflineBundle added in v0.54.10

func PrepareOfflineBundle(ctx context.Context, options Options, root, profileID, modelCache string) (BundleManifest, error)

PrepareOfflineBundle is the online preparation phase. It delegates release, tool, provider and image admission to the existing neutral-cache owner. It never initializes an Owner, starts a workload or copies a workspace.

func VerifyOfflineBundle added in v0.54.10

func VerifyOfflineBundle(ctx context.Context, options Options, root string) (BundleManifest, error)

VerifyOfflineBundle performs no Docker mutation, registry request or Apply. It also works after installation: runtime owners must recheck this exact immutable closure before mounting a local model, not re-run bake neutrality.

func VerifyOfflineBundleRef added in v0.54.10

func VerifyOfflineBundleRef(ctx context.Context, options Options, ref runtimeprofile.OfflineBundleRef) (BundleManifest, error)

VerifyOfflineBundleRef is routine lifecycle verification. An initialized workspace is legitimate here; fresh-target admission is never replayed.

type CandidateSelection added in v0.54.10

type CandidateSelection struct {
	Directory string
	Selector  releaseindex.PreviewSourceSelector
}

CandidateSelection is an explicit byte selection, never an installation grant. Directory is needed only when retaining new bytes during online preparation.

type CandidateSource added in v0.54.10

type CandidateSource struct {
	Identity  releaseindex.AttestedPreviewCandidateIdentity `json:"identity"`
	Kit       string                                        `json:"kit"`
	Version   string                                        `json:"version"`
	Platform  releaseindex.Platform                         `json:"platform"`
	CLISHA256 string                                        `json:"cliSha256"`
}

CandidateSource contains only identities authenticated by the signed index, payload and actual process equality. Actions locator IDs are deliberately absent.

type ContainerCache

type ContainerCache interface {
	Run(context.Context, ...string) ([]byte, error)
}

type FreshBundleAdmission added in v0.54.10

type FreshBundleAdmission struct {
	// contains filtered or unexported fields
}

FreshBundleAdmission is created only by this owner after full byte verification and fresh-target admission. It is neither a public release Receipt nor a conversion of a source-cache proof into installation authority.

func AdmitFreshOfflineBundle added in v0.54.10

func AdmitFreshOfflineBundle(ctx context.Context, options Options, root string) (*FreshBundleAdmission, error)

AdmitFreshOfflineBundle checks every signature, tool, provider, image and model before even observing Docker. Import retains the separate effect gate.

type Image

type Image struct {
	Component string `json:"component"`
	Ref       string `json:"ref"`
	Digest    string `json:"digest"`
}

type LocalDocker

type LocalDocker struct{ Config string }

LocalDocker always addresses the local Unix socket with an empty config. Contexts, DOCKER_HOST and user registry credentials cannot redirect a bake.

func (LocalDocker) Run

func (docker LocalDocker) Run(ctx context.Context, args ...string) ([]byte, error)

func (LocalDocker) RunInput added in v0.54.10

func (docker LocalDocker) RunInput(ctx context.Context, input *os.File, args ...string) ([]byte, error)

RunInput passes an already-open file directly to Docker's stdin. Import never gives Docker a transport or temporary pathname to reopen after verification.

type Manifest

type Manifest struct {
	SchemaVersion string            `json:"schemaVersion"`
	Profile       Profile           `json:"profile"`
	Platform      Platform          `json:"platform"`
	Release       Release           `json:"release,omitzero"`
	SourceKind    SourceKind        `json:"sourceKind,omitempty"`
	Candidate     *CandidateSource  `json:"candidate,omitempty"`
	Binaries      map[string]string `json:"binaries"`
	ProviderFiles map[string]string `json:"providerFiles"`
}

func Prepare

func Prepare(ctx context.Context, options Options, id string) (Manifest, error)

Prepare downloads the current exact attested release into the neutral cache, verifies the actual packaged tools, and only pulls immutable container images.

func ReadManifest

func ReadManifest(name string, authority Authority) (Manifest, error)

func Verify

func Verify(ctx context.Context, options Options, manifestPath string) (Manifest, error)

Verify re-observes the clone, release bytes and cache. An unsigned manifest's asserted digests or its writer's previous host evidence authorize nothing.

func VerifyCache added in v0.50.1

func VerifyCache(ctx context.Context, options Options, manifestPath string) (Manifest, error)

VerifyCache re-observes the host, attested release, packaged tools and exact neutral container cache. It does not admit deployment contents: init must separately require an empty target or an already-applied canonical intent.

func VerifyOfflineBundleInit added in v0.54.10

func VerifyOfflineBundleInit(ctx context.Context, options Options, ref runtimeprofile.OfflineBundleRef) (Manifest, error)

VerifyOfflineBundleInit authenticates the complete closure before any native intent or custody effect and re-observes the neutral Docker cache. A populated workspace is handled only by the caller's existing same-intent RequireAlreadyApplied path, never granted a fresh installation capability.

type ModelPack added in v0.54.10

type ModelPack struct {
	Component string `json:"component"`
	Size      string `json:"size"`
}

type Options

type Options struct {
	SourceKind SourceKind
	Candidate  *CandidateSelection
	Authority  Authority
	CacheRoot  string
	Target     string
	Executable string
	Version    string
	Installer  releaseindex.Installer
	Docker     ContainerCache
	// Host observation is injectable only for package tests. The CLI always
	// supplies ObserveHost and LocalDocker; manifests never supply these facts.
	ObserveHost func() (Platform, error)
}

type Platform

type Platform struct {
	OS           string `json:"os"`
	Arch         string `json:"arch"`
	Distribution string `json:"distribution"`
	Version      string `json:"version"`
}

func ObserveHost

func ObserveHost() (Platform, error)

type Profile

type Profile struct {
	ID              string      `json:"id"`
	Kit             string      `json:"kit"`
	Module          string      `json:"module"`
	DefaultOS       string      `json:"defaultOS"`
	CompatibleOS    []string    `json:"compatibleOS"`
	Architectures   []string    `json:"architectures"`
	Runtime         string      `json:"runtime"`
	ManagedTarget   string      `json:"managedTarget"`
	CacheScope      string      `json:"cacheScope"`
	NetworkRequired bool        `json:"networkRequired"`
	Images          []Image     `json:"images"`
	DataProfile     string      `json:"dataProfile,omitempty"`
	Modules         []string    `json:"modules,omitempty"`
	ModelPacks      []ModelPack `json:"modelPacks,omitempty"`
}

func Plan

func Plan(id string, authority Authority) (Profile, error)

type Release

type Release struct {
	Kit           string `json:"kit"`
	Version       string `json:"version"`
	ArchiveSHA256 string `json:"archiveSha256"`
	IndexSHA256   string `json:"indexSha256"`
}

type SourceKind added in v0.54.10

type SourceKind string
const (
	PublicReleaseSource    SourceKind = "public-release"
	PreviewCandidateSource SourceKind = "preview-candidate"
)

Jump to

Keyboard shortcuts

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