plugin

package
v0.0.0-...-29e6843 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2018 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AttachPluginName      = "attach"
	AttachResultsCmd      = "results"
	AttachXunitResultsCmd = "xunit_results"

	AttachResultsAPIEndpoint = "results"
	AttachLogsAPIEndpoint    = "test_logs"

	AttachResultsPostRetries   = 5
	AttachResultsRetrySleepSec = 10 * time.Second
)
View Source
const (
	// These PageScope constants determine which page a panel hooks into
	TaskPage    PageScope = "task"
	BuildPage   PageScope = "build"
	VersionPage PageScope = "version"

	// These pagePosition constants determine where on a page a panel is
	// injected. If no position is given, it defaults to PageCenter
	PageLeft   pagePosition = "Left"
	PageRight  pagePosition = "Right"
	PageCenter pagePosition = "Center"
)

Variables

This section is empty.

Functions

func Publish

func Publish(p Plugin)

Publish is called in a plugin's "init" func to announce that plugin's presence to the entire plugin package. This architecture is designed to make it easy to add new external plugin code to Evergreen by simply importing the new plugin's package in plugin/config/installed_plugins.go

Packages implementing the Plugin interface MUST call Publish in their init code in order for Evergreen to detect and use them. A plugin must also implement one of CommandPlugin or UIPlugin in order to be useable.

See the documentation of the 10gen.com/mci/plugin/config package for more

func TemplateRoot

func TemplateRoot(name string) string

Types

type AttachPlugin

type AttachPlugin struct{}

AttachPlugin has commands for uploading task results and links to files, for display and easy access in the UI.

func (*AttachPlugin) Configure

func (self *AttachPlugin) Configure(map[string]interface{}) error

func (*AttachPlugin) GetPanelConfig

func (self *AttachPlugin) GetPanelConfig() (*PanelConfig, error)

GetPanelConfig returns a plugin.PanelConfig struct representing panels that will be added to the Task and Build pages.

func (*AttachPlugin) Name

func (self *AttachPlugin) Name() string

Name returns the name of this plugin - it serves to satisfy the 'Plugin' interface

type BuildBaronPlugin

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

func (*BuildBaronPlugin) Configure

func (bbp *BuildBaronPlugin) Configure(conf map[string]interface{}) error

func (*BuildBaronPlugin) GetPanelConfig

func (bbp *BuildBaronPlugin) GetPanelConfig() (*PanelConfig, error)

func (*BuildBaronPlugin) Name

func (bbp *BuildBaronPlugin) Name() string

type ManifestPlugin

type ManifestPlugin struct{}

ManifestPlugin handles the creation of a Build Manifest associated with a version.

func (*ManifestPlugin) Configure

func (m *ManifestPlugin) Configure(map[string]interface{}) error

func (*ManifestPlugin) GetPanelConfig

func (m *ManifestPlugin) GetPanelConfig() (*PanelConfig, error)

GetPanelConfig returns a pointer to a plugin's UI configuration. or an error, if an error occur while trying to generate the config A nil pointer represents a plugin without a UI presence, and is not an error. GetPanelConfig returns a plugin.PanelConfig struct representing panels that will be added to the Version page.

func (*ManifestPlugin) Name

func (m *ManifestPlugin) Name() string

Name returns the name of this plugin - satisfies 'Plugin' interface

type PageScope

type PageScope string

PageScope is a type for setting the page a panel appears on

type PanelConfig

type PanelConfig struct {
	// Handler is an http.Handler which receives plugin-specific HTTP requests from the UI
	Handler http.Handler

	// Panels is an array of UIPanels to inject into task, version,
	// and build pages
	Panels []UIPanel
}

PanelConfig stores all UI-related plugin hooks

type PanelLayout

type PanelLayout struct {
	Left   []template.HTML
	Right  []template.HTML
	Center []template.HTML
}

PanelLayout tells the view renderer what panel HTML data to inject and where on the page to inject it.

type PanelManager

type PanelManager interface {
	RegisterPlugins([]Plugin) error
	Includes(PageScope) ([]template.HTML, error)
	Panels(PageScope) (PanelLayout, error)
	UIData(UIContext, PageScope) (map[string]interface{}, error)
}

PanelManager is the manager the UI server uses to register and load plugin UI information efficiently.

type PerfPlugin

type PerfPlugin struct {
	Projects []string `yaml:"string"`
}

PerfPlugin displays performance statistics in the UI.

func (*PerfPlugin) Configure

func (pp *PerfPlugin) Configure(params map[string]interface{}) error

func (*PerfPlugin) GetPanelConfig

func (pp *PerfPlugin) GetPanelConfig() (*PanelConfig, error)

func (*PerfPlugin) Name

func (pp *PerfPlugin) Name() string

Name implements Plugin Interface.

type Plugin

type Plugin interface {
	// Returns the name to identify this plugin when registered.
	Name() string

	// GetPanelConfig returns a pointer to a plugin's UI configuration.
	// or an error, if an error occur while trying to generate the config
	// A nil pointer represents a plugin without a UI presence, and is
	// not an error.
	GetPanelConfig() (*PanelConfig, error)

	// Configure reads in a settings map from the Evergreen config file.
	Configure(conf map[string]interface{}) error
}

Plugin defines the interface that all evergreen plugins must implement in order to register themselves with Evergreen. A plugin must also implement one of the PluginCommand or UIPlugin interfaces in order to do useful work.

The Plugin interface is deprecated.

func GetPublished

func GetPublished() []Plugin

type SimplePanelManager

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

SimplePanelManager is a basic implementation of a plugin panel manager.

func (*SimplePanelManager) Includes

func (self *SimplePanelManager) Includes(page PageScope) ([]template.HTML, error)

Includes returns a properly-ordered list of html tags to inject into the head of the view for the given page.

func (*SimplePanelManager) Panels

func (self *SimplePanelManager) Panels(page PageScope) (PanelLayout, error)

Panels returns a PanelLayout for the view renderer to inject panels into the given page.

func (*SimplePanelManager) RegisterPlugins

func (self *SimplePanelManager) RegisterPlugins(plugins []Plugin) error

RegisterPlugins takes an array of plugins and registers them with the manager. After this step is done, the other manager functions may be used.

func (*SimplePanelManager) UIData

func (self *SimplePanelManager) UIData(context UIContext, page PageScope) (map[string]interface{}, error)

UIData returns a map of plugin name -> data for inclusion in the view's javascript.

type UIContext

type UIContext struct {
	Settings   evergreen.Settings
	User       gimlet.User
	Task       *task.Task
	Build      *build.Build
	Version    *version.Version
	Patch      *patch.Patch
	ProjectRef *model.ProjectRef
	Request    *http.Request
}

UIContext stores all relevant models for a plugin page.

type UIDataFunction

type UIDataFunction func(context UIContext) (interface{}, error)

UIDataFunction is a function which is called to populate panels which are injected into Task/Build/Version pages at runtime.

type UIDataFunctionError

type UIDataFunctionError []error

UIDataFunctionError is a special error type for data function processing which can record and aggregate multiple error messages.

func (*UIDataFunctionError) AppendError

func (errs *UIDataFunctionError) AppendError(name string, err error)

AppendError adds an error onto the array of data function errors.

func (*UIDataFunctionError) Error

func (errs *UIDataFunctionError) Error() string

Error returns a string aggregating the stored error messages. Implements the error interface.

func (*UIDataFunctionError) HasErrors

func (errs *UIDataFunctionError) HasErrors() bool

HasErrors returns a boolean representing if the UIDataFunctionError contains any errors.

type UIPage

type UIPage struct {
	TemplatePath string
	DataFunc     UIDataFunction
}

UIPage represents the information to be sent over to the ui server in order to render a page for an app level plugin. TemplatePath is the relative path to the template from the template root of the plugin. Data represents the data to send over.

type UIPanel

type UIPanel struct {
	// Page is which page the panel appears on
	Page PageScope

	// Includes is a list of HTML tags to inject into the head of
	// the page. These are meant to be links to css and js code hosted
	// in the plugin's static web root
	Includes []template.HTML

	// PanelHTML is the HTML definition of the panel. Best practices dictate
	// using AngularJS to load up the html as a partial hosted by the plugin
	PanelHTML template.HTML

	// DataFunc is a function to populate plugin data injected into the js
	// of the page the panel is on. The function takes the page request as
	// an argument, and returns data (must be json-serializeable!) or an error
	DataFunc UIDataFunction
	// Position is the side of the page the panel appears in
	Position pagePosition
}

UIPanel is a type for storing all the configuration to properly display one panel in one page of the UI.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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