plugin

package
v0.0.0-...-e67fd50 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package plugin provides errors for evaluation-pipeline plugin management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDiscoveryFailedError

func NewDiscoveryFailedError(cause error) error

NewDiscoveryFailedError wraps plugin discovery failures.

func NewEvaluationCINotFoundError

func NewEvaluationCINotFoundError(path string) error

NewEvaluationCINotFoundError indicates the injected evaluation CI file is missing.

func NewInstallFailedError

func NewInstallFailedError(cause error) error

NewInstallFailedError wraps install/sync failures.

func NewInstallResultError

func NewInstallResultError(count int, details []string) error

NewInstallResultError wraps structured install result failures.

func NewInvalidOptionsError

func NewInvalidOptionsError() error

NewInvalidOptionsError indicates handler options are invalid.

func NewInvalidPluginRefError

func NewInvalidPluginRefError() error

NewInvalidPluginRefError indicates a plugin ref is invalid.

func NewInvalidPluginRefMessageError

func NewInvalidPluginRefMessageError(message string) error

NewInvalidPluginRefMessageError indicates a plugin ref is invalid with a more specific message.

func NewInvalidProjectPathError

func NewInvalidProjectPathError() error

NewInvalidProjectPathError indicates a project path argument is invalid.

func NewInvalidSourceError

func NewInvalidSourceError(message string) error

NewInvalidSourceError indicates source definition is invalid.

func NewMaterializationFailedError

func NewMaterializationFailedError(message string, cause error) error

NewMaterializationFailedError wraps managed plugin materialization failures.

func NewPluginVariableMissingError

func NewPluginVariableMissingError(envVar, path string) error

NewPluginVariableMissingError indicates expected plugin variable is absent in template.

func NewReadFileError

func NewReadFileError(path string, cause error) error

NewReadFileError wraps read failures.

func NewSourceExistsError

func NewSourceExistsError(name string) error

NewSourceExistsError indicates source name already exists.

func NewSourceNotFoundError

func NewSourceNotFoundError(name string) error

NewSourceNotFoundError indicates source was not found.

func NewTemplateOutdatedError

func NewTemplateOutdatedError(message string) error

NewTemplateOutdatedError indicates the installed evaluation CI template cannot express the requested plugin config.

func NewUnsupportedPluginError

func NewUnsupportedPluginError(raw string) error

NewUnsupportedPluginError indicates plugin id is unknown.

func NewWriteFileError

func NewWriteFileError(path string, cause error) error

NewWriteFileError wraps write failures.

Types

type Descriptor

type Descriptor struct {
	ID             ID
	DisplayName    string
	DefaultHost    string
	EnvVar         string
	ProjectEnvVar  string
	RefEnvVar      string
	ProjectPath    string
	DefaultRef     string
	DefaultEnabled bool
}

Descriptor describes one supported plugin.

func AvailablePlugins

func AvailablePlugins() []Descriptor

AvailablePlugins returns the built-in managed plugin descriptors.

func DescriptorForID

func DescriptorForID(id ID) Descriptor

DescriptorForID returns a descriptor for a canonical plugin id.

func ResolvePlugin

func ResolvePlugin(raw string) (Descriptor, bool)

ResolvePlugin maps a user-provided id/alias to a built-in plugin descriptor.

type DiscoverResult

type DiscoverResult struct {
	Plugins  []DiscoveredPlugin
	Warnings []string
}

DiscoverResult contains discovered plugins and non-fatal source warnings.

type DiscoveredPlugin

type DiscoveredPlugin struct {
	SourceName    string
	SourceHost    string
	ProjectPath   string
	PluginID      string
	Name          string
	Description   string
	DocsURL       string
	Maintainer    string
	DefaultBranch string
	Visibility    string
	Trusted       bool
}

DiscoveredPlugin contains one plugin candidate found in source discovery.

type Error

Error is a type alias for typed command errors.

type ErrorType

type ErrorType string

ErrorType defines plugin command error variants.

const (
	ErrInvalidOptions        ErrorType = "InvalidOptions"
	ErrInvalidProjectPath    ErrorType = "InvalidProjectPath"
	ErrInvalidPluginRef      ErrorType = "InvalidPluginRef"
	ErrInvalidSource         ErrorType = "InvalidSource"
	ErrSourceNotFound        ErrorType = "SourceNotFound"
	ErrSourceExists          ErrorType = "SourceExists"
	ErrUnsupportedPlugin     ErrorType = "UnsupportedPlugin"
	ErrEvaluationCINotFound  ErrorType = "EvaluationCINotFound"
	ErrPluginVariableMissed  ErrorType = "PluginVariableMissing"
	ErrReadFile              ErrorType = "ReadFile"
	ErrWriteFile             ErrorType = "WriteFile"
	ErrInstallFailed         ErrorType = "InstallFailed"
	ErrDiscoveryFailed       ErrorType = "DiscoveryFailed"
	ErrTemplateOutdated      ErrorType = "TemplateOutdated"
	ErrMaterializationFailed ErrorType = "MaterializationFailed"
)

Plugin command error variants.

type Handler

type Handler struct {
	InjectionService  svc.InjectionService
	FetchPipelineFile func(ctx context.Context, hostAlias, projectPath, ref string) ([]byte, error)
	// contains filtered or unexported fields
}

Handler manages evaluation-pipeline plugin installation and activation flags.

func NewHandler

func NewHandler(opts *HandlerOptions) (*Handler, error)

NewHandler creates a plugin handler.

func (*Handler) AddSource

func (h *Handler) AddSource(_ context.Context, source Source) error

AddSource adds a trusted discovery source.

func (*Handler) Discover

func (h *Handler) Discover(ctx context.Context, sourceFilter string) (DiscoverResult, error)

Discover scans configured sources and returns plugin repositories exposing ci.yaml/plugin.json.

func (*Handler) Install

func (h *Handler) Install(ctx context.Context, force bool) error

Install injects (or refreshes) evaluation pipeline files.

func (*Handler) List

func (h *Handler) List(_ context.Context) ([]State, error)

List returns managed plugin states for the current target.

func (*Handler) ListSources

func (h *Handler) ListSources(_ context.Context) ([]Source, error)

ListSources returns configured plugin sources, including the default official source.

func (*Handler) RemoveSource

func (h *Handler) RemoveSource(_ context.Context, name string) error

RemoveSource removes one discovery source by name.

func (*Handler) SetEnabled

func (h *Handler) SetEnabled(ctx context.Context, rawPluginID string, enabled bool) error

SetEnabled toggles one plugin activation flag in eval-plugins.json and applies it to Eval CI.

func (*Handler) SetProject

func (h *Handler) SetProject(ctx context.Context, rawPluginID, projectPath, host string) error

SetProject updates one plugin project path in eval-plugins.json and applies it to Eval CI.

func (*Handler) SetRef

func (h *Handler) SetRef(ctx context.Context, rawPluginID, ref string) error

SetRef updates one plugin ref (branch/tag/commit) in eval-plugins.json and applies it to Eval CI.

func (*Handler) Update

func (h *Handler) Update(ctx context.Context) error

Update refreshes injected CI assets and preserves plugin configuration from eval-plugins.json.

func (*Handler) Use

func (h *Handler) Use(ctx context.Context, rawPluginID, sourceName, ref string) error

Use switches one plugin to a configured discovery source and optional ref.

type HandlerOptions

type HandlerOptions struct {
	WorkingDir       string
	DistributionName string
	DivekitHome      string
	ForceManaged     bool
}

HandlerOptions defines configuration for plugin command operations.

type ID

type ID string

ID identifies a managed evaluation-pipeline plugin.

const (
	PluginPMD       ID = "pmd"
	PluginSurefire  ID = "surefire"
	PluginJacocoPIT ID = "jacoco-pit"
)

Supported managed plugins.

func NormalizePluginID

func NormalizePluginID(raw string) (ID, bool)

NormalizePluginID maps user input and aliases to a canonical plugin id.

type ManagedFilesChangedError

type ManagedFilesChangedError struct {
	Paths []string
}

ManagedFilesChangedError indicates managed plugin files were modified locally and require confirmation before overwrite.

func (*ManagedFilesChangedError) Error

func (e *ManagedFilesChangedError) Error() string

type Source

type Source struct {
	Name    string     `json:"name"`
	Host    string     `json:"host"`
	Kind    SourceKind `json:"kind"`
	Path    string     `json:"path"`
	Trusted bool       `json:"trusted"`
	Enabled bool       `json:"enabled"`
}

Source declares one trusted plugin source.

type SourceKind

type SourceKind string

SourceKind describes where plugins should be discovered.

const (
	SourceKindGitLabGroup   SourceKind = "gitlab-group"
	SourceKindGitLabProject SourceKind = "gitlab-project"
)

Supported plugin source kinds.

type State

type State struct {
	Plugin      Descriptor
	Enabled     bool
	Installed   bool
	Host        string
	ProjectPath string
	Ref         string
}

State represents install/enabled status for one plugin.

Jump to

Keyboard shortcuts

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