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

plugins

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0, MIT Imports: 31 Imported by: 0

Documentation

Overview

Package plugins selects local executables and pinned OCI bundles and installs them in the cache.

Index

Constants

View Source
const ArtifactType = "application/vnd.stemma.plugin.v1"
View Source
const BundleType = "application/vnd.stemma.plugin.bundle.v1.tar+zstd"

Variables

This section is empty.

Functions

func Fingerprint added in v0.4.0

func Fingerprint(declaration config.Plugin) string

Fingerprint identifies the declaration a lock entry answers.

func GoReleaserAnnotations added in v0.4.0

func GoReleaserAnnotations(dist string) (map[string]string, error)

GoReleaserAnnotations labels a release with the version and commit GoReleaser recorded in dist/metadata.json, as the standard OCI version and revision annotations.

func Pin added in v0.4.0

func Pin(declaration config.Plugin, entry Entry) string

Pin names the code a declaration selects: the digest an image names, or the digest of the lock entry that answers the declaration. It is empty when the declaration is not locked.

func Publish added in v0.3.0

func Publish(ctx context.Context, image string, bundles []PlatformBundle, annotations map[string]string) (string, error)

Publish pushes a manifest for each bundle and tags their platform index as image, which must name a tag; annotations apply to the index. It checks every bundle against the loader's rules before pushing and tags the index last, so a failed publication names no partial release. A published tag keeps its release: publishing the same bundles and annotations again changes nothing, and changes need a new tag. Registry credentials come from the Docker credential store. It returns the digest of the tagged index.

Types

type Bundle

type Bundle struct {
	Manifest   string
	Executable string
	Platforms  []string
}

Bundle is a selected package as the cache installed it. Manifest identifies the entire package, including executable resources. Platforms lists the runners an image has bundles for.

type Entry

type Entry struct {
	Declaration string `json:"declaration" yaml:"declaration"`
	Digest      string `json:"digest" yaml:"digest"`
}

Entry records what locking a plugin learned beyond its declaration: the platform index digest a tag named, or the content digest of local files. Declaration fingerprints the declaration the entry answers, so an edited declaration is never matched with an old answer. An image that names its digest needs no entry.

type PlatformBundle added in v0.3.0

type PlatformBundle struct {
	Platform ocispec.Platform
	Path     string
}

PlatformBundle is the tar.zst bundle built for one runner platform.

func GoReleaserBundles added in v0.3.0

func GoReleaserBundles(dist, id string) ([]PlatformBundle, error)

GoReleaserBundles reads the plugin bundles GoReleaser recorded in dist/artifacts.json: the archives of one archive id, which must all be tar.zst. id names the archive id; when it is empty, the only archive id that builds tar.zst is used. GoReleaser records paths from the directory it ran in, so relative paths resolve from the current directory.

type Store

type Store struct {
	// Verify stages every plugin again from its pinned files and requires an
	// existing installation to match, where a load otherwise trusts it.
	Verify bool
	// contains filtered or unexported fields
}

Store keeps registry content and plugin installations in the shared disposable cache. Callers hold a lease.

func New

func New(cache *cas.Store, offline bool) *Store

func (*Store) Acquire

func (s *Store) Acquire(ctx context.Context, image, indexDigest string) (Bundle, error)

Acquire installs this runner's bundle from the platform index indexDigest names, even if the image's tag has moved. A complete installation is used as it is. Otherwise only the runner's manifest, config and bundle are fetched, and cached bytes are verified first.

func (*Store) Load

func (s *Store) Load(ctx context.Context, root string, declaration config.Plugin, previous Entry, resolve bool) (Bundle, Entry, error)

Load selects a plugin's code, installs it when the cache has not, and returns the lock entry that selects it. An image that names its digest needs no entry. A tag or local path uses the previous entry for its declaration; with resolve, a missing or stale entry is resolved instead: the tag from the registry, the path from its current files. Local files are hashed on every load, before any plugin code runs.

func (*Store) Resolve

func (s *Store) Resolve(ctx context.Context, image string) (string, error)

Resolve names the platform index an image's tag selects now. Only updates contact the registry for it.

Jump to

Keyboard shortcuts

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