Documentation
¶
Overview ¶
Package plugin provides errors for evaluation-pipeline plugin management.
Index ¶
- func NewDiscoveryFailedError(cause error) error
- func NewEvaluationCINotFoundError(path string) error
- func NewInstallFailedError(cause error) error
- func NewInstallResultError(count int, details []string) error
- func NewInvalidOptionsError() error
- func NewInvalidPluginRefError() error
- func NewInvalidPluginRefMessageError(message string) error
- func NewInvalidProjectPathError() error
- func NewInvalidSourceError(message string) error
- func NewMaterializationFailedError(message string, cause error) error
- func NewPluginVariableMissingError(envVar, path string) error
- func NewReadFileError(path string, cause error) error
- func NewSourceExistsError(name string) error
- func NewSourceNotFoundError(name string) error
- func NewTemplateOutdatedError(message string) error
- func NewUnsupportedPluginError(raw string) error
- func NewWriteFileError(path string, cause error) error
- type Descriptor
- type DiscoverResult
- type DiscoveredPlugin
- type Error
- type ErrorType
- type Handler
- func (h *Handler) AddSource(_ context.Context, source Source) error
- func (h *Handler) CheckUpdates(ctx context.Context) (UpdateCheckResult, error)
- func (h *Handler) Discover(ctx context.Context, sourceFilter string) (DiscoverResult, error)
- func (h *Handler) Install(ctx context.Context, force bool) error
- func (h *Handler) LatestRef(ctx context.Context, hostAlias, projectPath string) (string, error)
- func (h *Handler) List(_ context.Context) ([]State, error)
- func (h *Handler) ListSources(_ context.Context) ([]Source, error)
- func (h *Handler) RemoveSource(_ context.Context, name string) error
- func (h *Handler) SetAllEnabled(ctx context.Context, enabled bool) error
- func (h *Handler) SetEnabled(ctx context.Context, rawPluginID string, enabled bool) error
- func (h *Handler) SetProject(ctx context.Context, rawPluginID, projectPath, host string) error
- func (h *Handler) SetRef(ctx context.Context, rawPluginID, ref string) error
- func (h *Handler) Update(ctx context.Context) error
- func (h *Handler) Upgrade(ctx context.Context, rawPluginID string) (UpdateStatus, error)
- func (h *Handler) UpgradeAll(ctx context.Context) (UpdateCheckResult, error)
- func (h *Handler) Use(ctx context.Context, rawPluginID, sourceName, ref string) error
- type HandlerOptions
- type ID
- type ManagedFilesChangedError
- type Source
- type SourceKind
- type State
- type UpdateCheckResult
- type UpdateStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDiscoveryFailedError ¶
NewDiscoveryFailedError wraps plugin discovery failures.
func NewEvaluationCINotFoundError ¶
NewEvaluationCINotFoundError indicates the injected evaluation CI file is missing.
func NewInstallFailedError ¶
NewInstallFailedError wraps install/sync failures.
func NewInstallResultError ¶
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 ¶
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 ¶
NewInvalidSourceError indicates source definition is invalid.
func NewMaterializationFailedError ¶
NewMaterializationFailedError wraps managed plugin materialization failures.
func NewPluginVariableMissingError ¶
NewPluginVariableMissingError indicates expected plugin variable is absent in template.
func NewReadFileError ¶
NewReadFileError wraps read failures.
func NewSourceExistsError ¶
NewSourceExistsError indicates source name already exists.
func NewSourceNotFoundError ¶
NewSourceNotFoundError indicates source was not found.
func NewTemplateOutdatedError ¶
NewTemplateOutdatedError indicates the installed evaluation CI template cannot express the requested plugin config.
func NewUnsupportedPluginError ¶
NewUnsupportedPluginError indicates plugin id is unknown.
func NewWriteFileError ¶
NewWriteFileError wraps write failures.
Types ¶
type Descriptor ¶
type Descriptor struct {
ID ID
DisplayName string
DefaultHost string
EnvVar string
ProjectEnvVar string
RefEnvVar string
ProjectPath 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
CurrentRef string
LatestRef string
UpdateAvailable bool
Visibility string
Trusted bool
}
DiscoveredPlugin contains one plugin candidate found in source discovery.
type Error ¶
type Error = apperror.CommandError[ErrorType]
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)
FetchLatestRef func(ctx context.Context, hostAlias, projectPath string) (string, 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) CheckUpdates ¶
func (h *Handler) CheckUpdates(ctx context.Context) (UpdateCheckResult, error)
CheckUpdates compares configured plugin refs with the latest stable SemVer tags.
func (*Handler) Discover ¶
Discover scans configured sources and returns plugin repositories exposing ci.yaml/plugin.json.
func (*Handler) ListSources ¶
ListSources returns configured plugin sources, including the default official source.
func (*Handler) RemoveSource ¶
RemoveSource removes one discovery source by name.
func (*Handler) SetAllEnabled ¶
SetAllEnabled toggles all configured plugins and applies the Eval CI.
func (*Handler) SetEnabled ¶
SetEnabled toggles one plugin activation flag and applies it to Eval CI.
func (*Handler) SetProject ¶
SetProject updates one plugin project path and applies it to Eval CI.
func (*Handler) SetRef ¶
SetRef updates one plugin ref (branch/tag/commit) and applies it to Eval CI.
func (*Handler) Upgrade ¶
Upgrade updates one plugin to the latest stable SemVer tag when an update is available.
func (*Handler) UpgradeAll ¶
func (h *Handler) UpgradeAll(ctx context.Context) (UpdateCheckResult, error)
UpgradeAll updates all configured plugins with newer stable SemVer tags.
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.
Supported managed plugins.
func NormalizePluginID ¶
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.
type UpdateCheckResult ¶
type UpdateCheckResult struct {
Statuses []UpdateStatus
Warnings []string
}
UpdateCheckResult contains plugin update statuses and non-fatal lookup warnings.
type UpdateStatus ¶
type UpdateStatus struct {
Plugin Descriptor
Enabled bool
Host string
ProjectPath string
CurrentRef string
LatestRef string
UpdateAvailable bool
}
UpdateStatus describes whether a configured plugin can be upgraded.