machineimage

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 28 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 machineimage publishes macOS machine images to hypeman's registry, from stopped Tart VMs or other ASIF disk chains.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MintToken

func MintToken(tokens *registrytoken.Generator, name string, base *Base, ttl time.Duration) (string, error)

MintToken returns a registry token that can publish the image name, over base when it is set, for ttl. A publisher given it needs no registry secret.

Types

type Base

type Base struct {
	Repo   string // builds/{id} repository holding the base manifest and layers
	Digest string // canonical sha256 digest of the base manifest
}

Base is a pinned base image in the publisher's registry. A machine published over it reuses its layers, so only the new overlay is uploaded.

func ParseBase

func ParseBase(registryURL, ref string) (*Base, error)

ParseBase returns ref, a digest-pinned image in the registry at registryURL, as a publication base.

type Publication

type Publication struct{ Reference, Digest string }

Publication is a verified publication: a digest-pinned reference.

type Publisher

type Publisher struct {
	RegistryURL string
	// Token is a registry token from MintToken. Without one, Tokens mints a token
	// for each publication.
	Token  string
	Tokens *registrytoken.Generator
	// NewMachineIdentifier returns a fresh VZ machine identifier. Every published
	// image gets its own identifier and MAC, so it never runs with its source's.
	NewMachineIdentifier func() ([]byte, error)
}

Publisher targets only the configured internal registry and a build-scoped repository. go-containerregistry hashes and compresses each layer from a reopenable tar stream, so nothing is written to disk, skips blobs the registry already holds, and commits the manifest last. The registry stores each upload on disk and commits it only if it matches its digest. No credentials, redirect destinations or arbitrary output repositories come from the source.

func (*Publisher) Publish

func (p *Publisher) Publish(ctx context.Context, id string, storage Storage, base *Base) (Publication, error)

Publish commits storage as a machine image in builds/{id}, with a fresh machine identifier and MAC. With a base, the storage's layers must be the base's, by the disk digests the base records, and the base's registry layers are reused; without one, every layer is uploaded.

type Storage

type Storage struct {
	Layers       []string
	LayerDigests []string
	Overlay      string
	Aux          string
	Platform     images.MacOSImage
}

Storage is a closed macOS boot disk and platform to publish: the read-only ASIF layers below its overlay, base first, the overlay, and its auxiliary storage. A standalone base disk is an Overlay with no Layers. LayerDigests, when known, are the sha256 of each layer file; otherwise the publisher hashes them.

func ReadTartVM

func ReadTartVM(dir string, guestAgent bool) (Storage, error)

ReadTartVM returns the storage of a stopped Tart macOS VM directory, for publishing as a machine image. A standalone VM's disk.img must be ASIF and becomes a one-layer image. A stacked VM's read-only layers, base first, come from Tart's content store, read from its manifest.json, with its writable overlay.asif on top; the content store is under TART_HOME, or two levels above the VM directory by default. The platform keeps Tart's identity; the publisher gives each image a fresh one.

Jump to

Keyboard shortcuts

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