Documentation
¶
Overview ¶
Package plugins selects local executables and pinned OCI bundles and installs them in the cache.
Index ¶
- Constants
- func Fingerprint(declaration config.Plugin) string
- func GoReleaserAnnotations(dist string) (map[string]string, error)
- func Pin(declaration config.Plugin, entry Entry) string
- func Publish(ctx context.Context, image string, bundles []PlatformBundle, ...) (string, error)
- type Bundle
- type Entry
- type PlatformBundle
- type Store
Constants ¶
const ArtifactType = "application/vnd.stemma.plugin.v1"
const BundleType = "application/vnd.stemma.plugin.bundle.v1.tar+zstd"
Variables ¶
This section is empty.
Functions ¶
func Fingerprint ¶ added in v0.4.0
Fingerprint identifies the declaration a lock entry answers.
func GoReleaserAnnotations ¶ added in v0.4.0
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
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 ¶
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
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 (*Store) Acquire ¶
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.