{"modulePath":"github.com/kernel/hypeman","version":"v0.4.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package machineimage\n\nPackage machineimage publishes macOS machine images to hypeman's registry, from stopped Tart VMs or other ASIF disk chains.\n\n## Functions\n\n```go\nfunc MintToken(tokens *registrytoken.Generator, name string, base *Base, ttl time.Duration) (string, error)\n```\nMintToken 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.\n\n## Types\n\n```go\ntype Base struct {\n\tRepo   string // builds/{id} repository holding the base manifest and layers\n\tDigest string // canonical sha256 digest of the base manifest\n}\n```\nBase 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.\n\n```go\nfunc ParseBase(registryURL, ref string) (*Base, error)\n```\nParseBase returns ref, a digest-pinned image in the registry at registryURL, as a publication base.\n\n```go\ntype Publication struct{ Reference, Digest string }\n```\nPublication is a verified publication: a digest-pinned reference.\n\n```go\ntype Publisher struct {\n\tRegistryURL string\n\t// Token is a registry token from MintToken. Without one, Tokens mints a token\n\t// for each publication.\n\tToken  string\n\tTokens *registrytoken.Generator\n\t// NewMachineIdentifier returns a fresh VZ machine identifier. Every published\n\t// image gets its own identifier and MAC, so it never runs with its source's.\n\tNewMachineIdentifier func() ([]byte, error)\n}\n```\nPublisher 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.\n\n```go\nfunc (p *Publisher) Publish(ctx context.Context, id string, storage Storage, base *Base) (Publication, error)\n```\nPublish 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.\n\n```go\ntype Storage struct {\n\tLayers       []string\n\tLayerDigests []string\n\tOverlay      string\n\tAux          string\n\tPlatform     images.MacOSImage\n}\n```\nStorage 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.\n\n```go\nfunc ReadTartVM(dir string, guestAgent bool) (Storage, error)\n```\nReadTartVM 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.\n\n","path":"github.com/kernel/hypeman/lib/machineimage","name":"machineimage","synopsis":"Package machineimage publishes macOS machine images to hypeman's registry, from stopped Tart VMs or other ASIF disk chains.","isRedistributable":true}
