plugin

package
v0.0.0-...-741e03e Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Walk

func Walk(dir string, f func(plugin *Plugin) error) error

Walk loads every buf.plugin.yaml found in the specified root directory and calls the callback function with each plugin. The callback is called in dependency order (all plugin dependencies are printed before the plugin).

Types

type Dependency

type Dependency struct {
	Plugin string `yaml:"plugin"`
}

Dependency represents a dependency one plugin has on another.

type IncludePlugin

type IncludePlugin struct {
	// contains filtered or unexported fields
}

func ParsePluginsEnvVar

func ParsePluginsEnvVar(pluginsEnv string) ([]IncludePlugin, error)

func (IncludePlugin) Matches

func (p IncludePlugin) Matches(pluginName, pluginVersion, latestVersion string) bool

type Plugin

type Plugin struct {
	Path    string `yaml:"-"`
	Relpath string `yaml:"-"`
	// Parsed external yaml config
	bufpluginconfig.ExternalConfig `yaml:"-"`
	// Plugin identity (parsed from ExternalConfig.Name).
	Identity bufpluginref.PluginIdentity `yaml:"-"`
	// contains filtered or unexported fields
}

Plugin represents metadata (and filesystem path) information about a plugin.

func FilterByChangedFiles

func FilterByChangedFiles(plugins []*Plugin, lookuper envconfig.Lookuper) ([]*Plugin, error)

FilterByChangedFiles works with https://github.com/tj-actions/changed-files#outputs to filter out unchanged plugins. This allows PR builds to only build the plugins which changed instead of all plugins.

func FilterByPluginsEnv

func FilterByPluginsEnv(plugins []*Plugin, pluginsEnv string) ([]*Plugin, error)

FilterByPluginsEnv returns matching plugins based on a space separated list of plugins (and optional versions) to include.

func FindAll

func FindAll(dir string) ([]*Plugin, error)

FindAll returns every plugin found in the specified root directory.

func Load

func Load(path string, basedir string) (*Plugin, error)

Load loads the buf.plugin.yaml at the specified path and returns a structure containing metadata for the plugin.

func (*Plugin) GitCommit

func (p *Plugin) GitCommit(ctx context.Context) string

GitCommit calculates the last git commit for the plugin's directory. This will return an empty string if there are uncommitted changes to the plugin's directory. This is used to label the built Docker image and also avoid unnecessary Docker builds.

func (*Plugin) String

func (p *Plugin) String() string

Jump to

Keyboard shortcuts

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