install

package
v0.10.0-preview4 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package install downloads external Marmot plugins from an OCI registry and caches them on disk, where the plugin loader picks them up alongside locally installed plugins.

Index

Constants

View Source
const (
	// ArtifactType identifies a Marmot plugin artifact.
	ArtifactType = "application/vnd.marmot.plugin.v1"
	// LayerMediaType is the media type of the gzipped plugin binary layer.
	LayerMediaType = "application/vnd.marmot.plugin.v1+gzip"
)

Media types for Marmot plugin OCI artifacts.

Variables

This section is empty.

Functions

func CachedPath

func CachedPath(cacheDir, registry, name, version string) string

CachedPath returns the path a plugin binary is cached at: <cacheDir>/<registry>/<name>/<version>/<os>_<arch>/marmot-plugin-<name>.

func EnsureCore

func EnsureCore(ctx context.Context, opts Options) error

EnsureCore installs every core plugin that is not already cached or shadowed by a locally installed plugin. Failures are logged per plugin and returned aggregated, so an unreachable registry does not have to prevent startup.

func EnsurePlugin

func EnsurePlugin(ctx context.Context, opts Options, name string) (string, error)

EnsurePlugin installs the named core plugin if it is not already cached, and returns the path to its binary.

func Install

func Install(ctx context.Context, opts Options, registry, name, version, digest, dest string) error

Install pulls a plugin from <registry>/<name> at the given version tag (or digest, when set) and writes its binary for the current platform to dest.

func LoadPlugins

func LoadPlugins(opts Options) error

LoadPlugins registers locally installed plugin binaries, then the manifest-pinned version of each core plugin found in the cache. Locally installed plugins load first, so they shadow cached ones.

Cached versions other than the pin are ignored: several Marmot binaries with different embedded manifests can share one cache and each still loads exactly the versions it pins.

Types

type Manifest

type Manifest struct {
	// Registry is the OCI registry namespace plugins live under,
	// e.g. ghcr.io/marmotdata/plugins. A plugin's repository is
	// <registry>/<name>.
	Registry string                    `json:"registry"`
	Plugins  map[string]ManifestPlugin `json:"plugins"`
}

Manifest describes a set of plugins and the registry they are distributed from.

func CoreManifest

func CoreManifest() (*Manifest, error)

CoreManifest returns the core plugin manifest embedded in this build.

type ManifestPlugin

type ManifestPlugin struct {
	Version string `json:"version"`
	// Digest is the digest of the plugin's OCI image index for this
	// version (sha256:...). When set, the plugin is resolved by digest
	// so a re-tagged registry artifact cannot change what runs. When
	// empty, the version tag is resolved instead and a warning is
	// logged.
	Digest string `json:"digest"`
}

ManifestPlugin pins a single plugin.

type Options

type Options struct {
	// Registry overrides the manifest's registry namespace, e.g. to
	// point at an internal mirror.
	Registry string
	// CacheDir overrides the plugin cache directory.
	CacheDir string
	// PlainHTTP allows non-TLS registries (local registries in tests).
	PlainHTTP bool
}

Options configures plugin installation.

Jump to

Keyboard shortcuts

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