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 ¶
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.
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 ¶
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.