plugin

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrepareCheckUpdate

func PrepareCheckUpdate(roundTripper *mhttp.MockRoundTripper, rootURL, user, password string)

PrepareCheckUpdate only for test

func PrepareDownloadPlugin

func PrepareDownloadPlugin(roundTripper *mhttp.MockRoundTripper) (response *http.Response)

PrepareDownloadPlugin only for test

func PrepareForChangeUpdateCenterSite

func PrepareForChangeUpdateCenterSite(roundTripper *mhttp.MockRoundTripper, rootURL, user, password, name, updateCenterURL string)

PrepareForChangeUpdateCenterSite only for test

func PrepareForOneInstalledPlugin

func PrepareForOneInstalledPlugin(roundTripper *mhttp.MockRoundTripper, rootURL string) (
	request *http.Request, response *http.Response)

PrepareForOneInstalledPlugin only for test

func PrepareForOneInstalledPluginWithPluginName

func PrepareForOneInstalledPluginWithPluginName(roundTripper *mhttp.MockRoundTripper, rootURL, pluginName string) (
	request *http.Request, response *http.Response)

PrepareForOneInstalledPluginWithPluginName only for test

func PrepareForOneInstalledPluginWithPluginNameAndVer

func PrepareForOneInstalledPluginWithPluginNameAndVer(roundTripper *mhttp.MockRoundTripper, rootURL,
	pluginName, version string) (
	request *http.Request, response *http.Response)

PrepareForOneInstalledPluginWithPluginNameAndVer only for test

func PrepareForSetMirrorCertificate

func PrepareForSetMirrorCertificate(roundTripper *mhttp.MockRoundTripper, rootURL, user, password string, enable bool)

PrepareForSetMirrorCertificate only for test

func PrepareOnePluginInfo

func PrepareOnePluginInfo(roundTripper *mhttp.MockRoundTripper, pluginName string)

PrepareOnePluginInfo only for test

func PrepareOnePluginWithDep

func PrepareOnePluginWithDep(roundTripper *mhttp.MockRoundTripper, pluginName string)

PrepareOnePluginWithDep only for test

func PrepareOnePluginWithOptionalDep

func PrepareOnePluginWithOptionalDep(roundTripper *mhttp.MockRoundTripper, pluginName string)

PrepareOnePluginWithOptionalDep only for test

func PrepareShowPlugins

func PrepareShowPlugins(roundTripper *mhttp.MockRoundTripper, keyword string) (
	response *http.Response)

PrepareShowPlugins only for test

func PrepareShowTrend

func PrepareShowTrend(roundTripper *mhttp.MockRoundTripper, keyword string) (
	response *http.Response)

PrepareShowTrend only for test

Types

type API

type API struct {
	SkipDependency bool
	SkipOptional   bool
	UseMirror      bool
	ShowProgress   bool
	MirrorURL      string
	DownloadDir    string

	RoundTripper http.RoundTripper
	// contains filtered or unexported fields
}

API represents a plugin API

func (*API) BatchSearchPlugins

func (d *API) BatchSearchPlugins(pluginNames string) (plugins []Info, err error)

BatchSearchPlugins will batch search plugins

func (*API) DownloadPlugins

func (d *API) DownloadPlugins(names []string) (err error)

DownloadPlugins will download those plugins from update center

func (*API) GetPlugin

func (d *API) GetPlugin(name string) (plugin *Info, err error)

GetPlugin will get the plugin information

func (*API) ShowTrend

func (d *API) ShowTrend(name string) (trend string, err error)

ShowTrend show the trend of plugins

type AvailablePlugin

type AvailablePlugin struct {
	Plugin

	// for the available list
	Name      string
	Installed bool
	Website   string
	Title     string
}

AvailablePlugin represetns a available plugin

type AvailablePluginList

type AvailablePluginList struct {
	Data   []AvailablePlugin
	Status string
}

AvailablePluginList represents a list of available plugins

type CenterPlugin

type CenterPlugin struct {
	CompatibleWithInstalledVersion bool
	Excerpt                        string
	Installed                      InstalledPlugin
	MinimumJavaVersion             string
	Name                           string
	RequiredCore                   string
	SourceID                       string
	Title                          string
	URL                            string
	Version                        string
	Wiki                           string
}

CenterPlugin represents the all plugin from UpdateCenter

type CenterSite

type CenterSite struct {
	AvailablesPlugins  []CenterPlugin `json:"availables"`
	ConnectionCheckURL string         `json:"connectionCheckUrl"`
	DataTimestamp      int64          `json:"dataTimestamp"`
	HasUpdates         bool           `json:"hasUpdates"`
	ID                 string         `json:"id"`
	UpdatePlugins      []CenterPlugin `json:"updates"`
	URL                string         `json:"url"`
}

CenterSite represents the site of update center

type Dependency

type Dependency struct {
	Name      string `json:"name"`
	Implied   bool   `json:"implied"`
	Optional  bool   `json:"optional"`
	Title     string `json:"title"`
	Version   string `json:"version"`
	ShortName string `json:"shortName"`
}

Dependency represents a plugin dependency

type Info

type Info struct {
	BuildDate         string            `json:"buildDate"`
	Dependencies      []Dependency      `json:"dependencies"`
	Excerpt           string            `json:"excerpt"`
	FirstRelease      string            `json:"firstRelease"`
	Gav               string            `json:"gav"`
	Name              string            `json:"name"`
	PreviousTimestamp string            `json:"previousTimestamp"`
	PreviousVersion   string            `json:"previousVersion"`
	ReleaseTimestamp  string            `json:"releaseTimestamp"`
	RequireCore       string            `json:"RequireCore"`
	Title             string            `json:"title"`
	URL               string            `json:"url"`
	Version           string            `json:"version"`
	SecurityWarnings  []SecurityWarning `json:"securityWarnings"`
	Stats             InfoStats
}

Info hold the info of a plugin

type InfoStats

type InfoStats struct {
	CurrentInstalls                   int
	Installations                     []InstallationInfo
	InstallationsPerVersion           []InstallationInfo
	InstallationsPercentage           []InstallationInfo
	InstallationsPercentagePerVersion []InstallationInfo
	Trend                             int
}

InfoStats is the plugin info stats

type InstallStates

type InstallStates struct {
	Data   InstallStatesData
	Status string
}

InstallStates is the installation states

type InstallStatesData

type InstallStatesData struct {
	Jobs  InstallStatesJob
	State string
}

InstallStatesData is the installation state data

type InstallStatesJob

type InstallStatesJob struct {
	InstallStatus   string
	Name            string
	RequiresRestart string
	Title           string
	Version         string
}

InstallStatesJob is the installation state job

type InstallationInfo

type InstallationInfo struct {
	Timestamp  int64
	Total      int
	Version    string
	Percentage float64
}

InstallationInfo represents the plugin installation info

type InstallationJob

type InstallationJob struct {
	UpdateCenterJob

	Name   string
	Status InstallationJobStatus
}

InstallationJob represents the installation job

type InstallationJobStatus

type InstallationJobStatus struct {
	Success bool
	Type    string
}

InstallationJobStatus represents the installation job status

type InstalledPlugin

type InstalledPlugin struct {
	Plugin

	Enable             bool
	ShortName          string
	LongName           string
	Version            string
	URL                string
	HasUpdate          bool
	Pinned             bool
	RequiredCoreVesion string
	MinimumJavaVersion string
	SupportDynamicLoad string
	BackVersion        string
	Dependencies       []Dependency
}

InstalledPlugin represent the installed plugin from Jenkins

type InstalledPluginList

type InstalledPluginList struct {
	Plugins []InstalledPlugin
}

InstalledPluginList represent a list of plugins

type Manager

type Manager struct {
	core.JenkinsCore

	UseMirror    bool
	MirrorURL    string
	ShowProgress bool
}

Manager is the client of plugin manager

func (*Manager) CheckUpdate

func (p *Manager) CheckUpdate(handle func(*http.Response)) (err error)

CheckUpdate fetch the latest plugins from update center site

func (*Manager) DownloadPluginWithVersion

func (p *Manager) DownloadPluginWithVersion(nameWithVer string) error

DownloadPluginWithVersion downloads a plugin with name and version

func (*Manager) FindInstalledPlugin

func (p *Manager) FindInstalledPlugin(name string) (targetPlugin *InstalledPlugin, err error)

FindInstalledPlugin find the exist plugin by name

func (*Manager) GetAvailablePlugins

func (p *Manager) GetAvailablePlugins() (pluginList *AvailablePluginList, err error)

GetAvailablePlugins get the aviable plugins from Jenkins

func (*Manager) GetPlugins

func (p *Manager) GetPlugins(depth int) (pluginList *InstalledPluginList, err error)

GetPlugins get installed plugins

func (*Manager) GetPluginsFormula

func (p *Manager) GetPluginsFormula(data interface{}) (err error)

GetPluginsFormula get the plugin list with Jenkins formula format

func (*Manager) InstallPlugin

func (p *Manager) InstallPlugin(names []string) (err error)

InstallPlugin install a plugin by name

func (*Manager) UninstallPlugin

func (p *Manager) UninstallPlugin(name string) (err error)

UninstallPlugin uninstall a plugin by name

func (*Manager) Upload

func (p *Manager) Upload(pluginFile string) (err error)

Upload will upload a file from local filesystem into Jenkins

type Plugin

type Plugin struct {
	Active       bool
	Enabled      bool
	Bundled      bool
	Downgradable bool
	Deleted      bool
}

Plugin represents a plugin of Jenkins

type Plugins

type Plugins struct {
	Limit   int    `json:"limit"`
	Page    int    `json:"page"`
	Pages   int    `json:"pages"`
	Total   int    `json:"total"`
	Plugins []Info `json:"plugins"`
}

Plugins represents multi PluginInfo

type SecurityWarning

type SecurityWarning struct {
	Active   bool
	ID       string
	Message  string
	URL      string
	Versions []Version
}

SecurityWarning represents the plugin security-warining info

type UpdateCenter

type UpdateCenter struct {
	Availables                   []Plugin
	Jobs                         []InstallationJob
	RestartRequiredForCompletion bool
	Sites                        []CenterSite
}

UpdateCenter represents the update center of Jenkins

type UpdateCenterJob

type UpdateCenterJob struct {
	ErrorMessage string
	ID           int `json:"id"`
	Type         string
}

UpdateCenterJob represents the job for updateCenter which execute a task

type UpdateCenterManager

type UpdateCenterManager struct {
	core.JenkinsCore

	MirrorSite string

	LTS     bool
	Version string
	Output  string

	Formula string

	Thread       int
	ShowProgress bool
}

UpdateCenterManager manages the UpdateCenter

func (*UpdateCenterManager) ChangeUpdateCenterSite

func (u *UpdateCenterManager) ChangeUpdateCenterSite(name, updateCenterURL string) (err error)

ChangeUpdateCenterSite updates the update center address

func (*UpdateCenterManager) DownloadJenkins

func (u *UpdateCenterManager) DownloadJenkins() (err error)

DownloadJenkins download Jenkins

func (*UpdateCenterManager) GetJenkinsWarURL

func (u *UpdateCenterManager) GetJenkinsWarURL() (warURL string)

GetJenkinsWarURL returns a URL of Jenkins war file

func (*UpdateCenterManager) GetSite

func (u *UpdateCenterManager) GetSite() (site *CenterSite, err error)

GetSite is get Available Plugins and Updated Plugins from UpdateCenter

func (*UpdateCenterManager) SetMirrorCertificate

func (u *UpdateCenterManager) SetMirrorCertificate(enable bool) (err error)

SetMirrorCertificate take the mirror certificate file or not

func (*UpdateCenterManager) Status

func (u *UpdateCenterManager) Status() (status *UpdateCenter, err error)

Status returns the status of Jenkins

func (*UpdateCenterManager) Upgrade

func (u *UpdateCenterManager) Upgrade() (err error)

Upgrade the Jenkins core

type Version

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

Version represents the SecurityWarning cover version

Jump to

Keyboard shortcuts

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