jengo_src

package
v1.3.12 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigFile = ".jenkins.yaml"
)

Variables

View Source
var (
	HeadersBuilds = []string{"ID", "Number", "Time", "Result", "URL", "E_Duration", "Duration", "Description"}
	HeadersBuild  = []string{"ID", "Number", "Timestamp", "Result", "URL", "EstimatedDuration",
		"Duration", "Description", "FullDisplayName", "Building", "DisplayName",
		"Executor", "KeepLog", "QueueID"}
)
View Source
var (
	Trace   *log.Logger
	Info    *log.Logger
	Warning *log.Logger
	Error   *log.Logger
)
View Source
var (
	HeadersPlugins = []string{"active", "enabled", "shortName", "version", "url"}
	HeadersPlugin  = []string{"active", "backupVersion", "bundled", "deleted", "detached", "downgradable", "enabled", "hasUpdate", "longName", "minimumJavaVersion", "pinned", "requiredCoreVersion", "shortName", "supportsDynamicLoad", "url", "version"}
)
View Source
var (
	HeadersAvailablePlugins = []string{"name", "current-version", "new-version", "compatible", "release-timestamp"}
)

Functions

func CreateRequest

func CreateRequest(METHOD string, URL string) *http.Request

func DoAddContext added in v1.3.11

func DoAddContext(configfile_location string, context_name string, token string, url string, username string)

////////////////////////////////////////////////////////////////////////////////////////////////////////////// Updaters //////////////////////////////////////////////////////////////////////////////////////////////////////////////

func DoRemoveContext added in v1.3.11

func DoRemoveContext(configfile_location string, context_name string)

func DoUpdateContext added in v1.3.11

func DoUpdateContext(configfile_location string, context_name string, new_context_name string, token string, url string, username string)

func DoUpdateCurrentContext added in v1.3.11

func DoUpdateCurrentContext(configfile_location string, new_context_name string)

func DoUpdateManualContext added in v1.3.11

func DoUpdateManualContext(configfile_location string, context_name string)

func ErrorLog added in v1.3.11

func ErrorLog(err error)

func GetAllAvailablePlugins added in v1.3.11

func GetAllAvailablePlugins(regex_filter string) (res [][]string)

func GetAllUpdateablePlugins added in v1.3.11

func GetAllUpdateablePlugins(regex_filter string) (res [][]string)

func GetBaseURL

func GetBaseURL(configfile_location string) string

func GetEndpoint

func GetEndpoint(Kwargs map[string]interface{}) string

func GetFileBytes added in v1.3.11

func GetFileBytes(fileName string) []byte

func GetName added in v1.3.11

func GetName(configfile_location string) string

func GetToken added in v1.3.11

func GetToken(configfile_location string) string

func GetUserName added in v1.3.11

func GetUserName(configfile_location string) string

func HandleRequest

func HandleRequest(METHOD string, Kwargs map[string]interface{}) ([]byte, error)

func InitLoggers added in v1.3.11

func InitLoggers(
	traceHandle io.Writer,
	infoHandle io.Writer,
	warningHandle io.Writer,
	errorHandle io.Writer)

func ListBuilds

func ListBuilds(job_name string) (res [][]string)

func ListJobs

func ListJobs() (res [][]string)

func ListPlugins added in v1.3.11

func ListPlugins(regex_filter string) (res [][]string)

func PrepareUrl

func PrepareUrl(url string) string

func Table added in v1.3.11

func Table(jobs [][]string, header []string)

func YAML added in v1.3.11

func YAML(obj interface{})

Types

type AssignedLabels added in v1.3.6

type AssignedLabels struct {
	Name string `yaml:"name"`
}

type AvailableNameSorter added in v1.3.11

type AvailableNameSorter []Availables

func (AvailableNameSorter) Len added in v1.3.11

func (a AvailableNameSorter) Len() int

func (AvailableNameSorter) Less added in v1.3.11

func (a AvailableNameSorter) Less(i, j int) bool

func (AvailableNameSorter) Swap added in v1.3.11

func (a AvailableNameSorter) Swap(i, j int)

type Availables added in v1.3.11

type Availables struct {
	Name                           string        `yaml:"name"`
	SourceID                       string        `yaml:"sourceId"`
	URL                            string        `yaml:"url"`
	Version                        string        `yaml:"version"`
	Categories                     []interface{} `yaml:"categories"`
	Compatible                     bool          `yaml:"compatible"`
	CompatibleSinceVersion         interface{}   `yaml:"compatibleSinceVersion"`
	CompatibleWithInstalledVersion bool          `yaml:"compatibleWithInstalledVersion"`
	Excerpt                        string        `yaml:"excerpt"`
	Installed                      interface{}   `yaml:"installed"`
	MinimumJavaVersion             string        `yaml:"minimumJavaVersion"`
	NeededDependencies             []interface{} `yaml:"neededDependencies"`
	ReleaseTimestamp               int64         `yaml:"releaseTimestamp"`
	RequiredCore                   string        `yaml:"requiredCore"`
	Title                          string        `yaml:"title"`
	Wiki                           string        `yaml:"wiki"`
}

func FilterRegexNames added in v1.3.11

func FilterRegexNames(availables []Availables, re *regexp.Regexp) (res []Availables)

type BuildL

type BuildL struct {
	ID                string `yaml:"id"`
	Number            int    `yaml:"number"`
	Timestamp         int64  `yaml:"timestamp"`
	Result            string `yaml:"result"`
	URL               string `yaml:"url"`
	EstimatedDuration int    `yaml:"estimatedDuration"`
	Duration          int    `yaml:"duration"`
	Description       string `yaml:"description"`
}

type BuildListResponse

type BuildListResponse struct {
	Builds []BuildL `yaml:"builds"`
}

type BuildResponse

type BuildResponse struct {
	ID                string      `yaml:"id"`
	Number            int         `yaml:"number"`
	Timestamp         int64       `yaml:"timestamp"`
	Result            string      `yaml:"result"`
	URL               string      `yaml:"url"`
	EstimatedDuration int         `yaml:"estimatedDuration"`
	Duration          int         `yaml:"duration"`
	Description       interface{} `yaml:"description"`
	FullDisplayName   string      `yaml:"fullDisplayName"`
	Building          bool        `yaml:"building"`
	DisplayName       string      `yaml:"displayName"`
	Executor          interface{} `yaml:"executor"`
	KeepLog           bool        `yaml:"keepLog"`
	QueueID           int         `yaml:"queueId"`
}

func GetBuild

func GetBuild(job_name string, build_name string) (obj BuildResponse)

type Computer added in v1.3.6

type Computer struct {
	Class               string           `yaml:"_class"`
	Actions             []interface{}    `yaml:"actions"`
	AssignedLabels      []AssignedLabels `yaml:"assignedLabels"`
	Description         string           `yaml:"description"`
	DisplayName         string           `yaml:"displayName"`
	Executors           []Executors      `yaml:"executors"`
	Icon                string           `yaml:"icon"`
	IconClassName       string           `yaml:"iconClassName"`
	Idle                bool             `yaml:"idle"`
	JnlpAgent           bool             `yaml:"jnlpAgent"`
	LaunchSupported     bool             `yaml:"launchSupported"`
	LoadStatistics      LoadStatistics   `yaml:"loadStatistics"`
	ManualLaunchAllowed bool             `yaml:"manualLaunchAllowed"`
	MonitorData         MonitorData      `yaml:"monitorData"`
	NumExecutors        int              `yaml:"numExecutors"`
	Offline             bool             `yaml:"offline"`
	OfflineCause        interface{}      `yaml:"offlineCause"`
	OfflineCauseReason  string           `yaml:"offlineCauseReason"`
	OneOffExecutors     []interface{}    `yaml:"oneOffExecutors"`
	TemporarilyOffline  bool             `yaml:"temporarilyOffline"`
}

func GetNode added in v1.3.6

func GetNode(node_name string) (obj Computer)

type Config added in v1.3.11

type Config struct {
	CurrentContext string    `yaml:"current_context"`
	Contexts       []Context `yaml:"contexts"`
}

func AddContext added in v1.3.11

func AddContext(config Config, context_name string, token string, url string, username string) Config

////////////////////////////////////////////////////////////////////////////////////////////////////////////// Config Handling //////////////////////////////////////////////////////////////////////////////////////////////////////////////

func GetAndShowConfig added in v1.3.11

func GetAndShowConfig(configfile_location string) (config Config)

////////////////////////////////////////////////////////////////////////////////////////////////////////////// Show-ers //////////////////////////////////////////////////////////////////////////////////////////////////////////////

func GetConfig added in v1.3.11

func GetConfig(configfile_location string) Config

////////////////////////////////////////////////////////////////////////////////////////////////////////////// Getters //////////////////////////////////////////////////////////////////////////////////////////////////////////////

func ManualUpdateContext added in v1.3.11

func ManualUpdateContext(config Config, context_name string) Config

func RemoveContext added in v1.3.11

func RemoveContext(config Config, context_name string) Config

func UpdateContext added in v1.3.11

func UpdateContext(config Config, context_name string, new_context_name string, token string, url string, username string) Config

func UpdateCurrentContext added in v1.3.11

func UpdateCurrentContext(config Config, new_context string) Config

func (Config) GetCurrent added in v1.3.11

func (config Config) GetCurrent() Context

type Context added in v1.3.11

type Context struct {
	Name     string `yaml:"name"`
	URL      string `yaml:"url"`
	Username string `yaml:"username"`
	Token    string `yaml:"token"`
}

func GetAndShowContext added in v1.3.11

func GetAndShowContext(configfile_location string, context_name string) Context

func GetAndShowContexts added in v1.3.11

func GetAndShowContexts(configfile_location string) (contexts []Context)

func GetAndShowCurrentContext added in v1.3.11

func GetAndShowCurrentContext(configfile_location string) (context Context)

func GetClient

func GetClient() Context

func GetCurrentContext added in v1.3.11

func GetCurrentContext(configfile_location string) (context Context)

func PerformCreateContext added in v1.3.11

func PerformCreateContext(context_name string, token string, url string, username string) Context

func PerformManualUpdateContext added in v1.3.11

func PerformManualUpdateContext(context Context) Context

func PerformUpdateContext added in v1.3.11

func PerformUpdateContext(context Context, context_name string, token string, url string, username string) Context

type CredentialResponse added in v1.3.11

type CredentialResponse struct {
	Credentials     []interface{} `yaml:"credentials"`
	Description     string        `yaml:"description"`
	DisplayName     string        `yaml:"displayName"`
	FullDisplayName string        `yaml:"fullDisplayName"`
	FullName        string        `yaml:"fullName"`
	Global          bool          `yaml:"global"`
	URLName         string        `yaml:"urlName"`
}

func ListCredentials added in v1.3.11

func ListCredentials() (obj CredentialResponse)

type Executors added in v1.3.6

type Executors struct {
}

type HudsonNodeMonitorsClockMonitor added in v1.3.6

type HudsonNodeMonitorsClockMonitor struct {
	Class string `yaml:"_class"`
	Diff  int    `yaml:"diff"`
}

type HudsonNodeMonitorsDiskSpaceMonitor added in v1.3.6

type HudsonNodeMonitorsDiskSpaceMonitor struct {
	Class     string `yaml:"_class"`
	Timestamp int64  `yaml:"timestamp"`
	Path      string `yaml:"path"`
	Size      int64  `yaml:"size"`
}

type HudsonNodeMonitorsResponseTimeMonitor added in v1.3.6

type HudsonNodeMonitorsResponseTimeMonitor struct {
	Class     string `yaml:"_class"`
	Timestamp int64  `yaml:"timestamp"`
	Average   int    `yaml:"average"`
}

type HudsonNodeMonitorsSwapSpaceMonitor added in v1.3.6

type HudsonNodeMonitorsSwapSpaceMonitor struct {
	Class                   string `yaml:"_class"`
	AvailablePhysicalMemory int    `yaml:"availablePhysicalMemory"`
	AvailableSwapSpace      int    `yaml:"availableSwapSpace"`
	TotalPhysicalMemory     int    `yaml:"totalPhysicalMemory"`
	TotalSwapSpace          int    `yaml:"totalSwapSpace"`
}

type HudsonNodeMonitorsTemporarySpaceMonitor added in v1.3.6

type HudsonNodeMonitorsTemporarySpaceMonitor struct {
	Class     string `yaml:"_class"`
	Timestamp int64  `yaml:"timestamp"`
	Path      string `yaml:"path"`
	Size      int64  `yaml:"size"`
}

type Installed added in v1.3.11

type Installed struct {
	Active              bool        `yaml:"active"`
	BackupVersion       interface{} `yaml:"backupVersion"`
	Bundled             bool        `yaml:"bundled"`
	Deleted             bool        `yaml:"deleted"`
	Detached            bool        `yaml:"detached"`
	Downgradable        bool        `yaml:"downgradable"`
	Enabled             bool        `yaml:"enabled"`
	HasUpdate           bool        `yaml:"hasUpdate"`
	LongName            string      `yaml:"longName"`
	MinimumJavaVersion  string      `yaml:"minimumJavaVersion"`
	Pinned              bool        `yaml:"pinned"`
	RequiredCoreVersion string      `yaml:"requiredCoreVersion"`
	ShortName           string      `yaml:"shortName"`
	SupportsDynamicLoad string      `yaml:"supportsDynamicLoad"`
	URL                 string      `yaml:"url"`
	Version             string      `yaml:"version"`
}

type JobL

type JobL struct {
	Name        string `yaml:"name"`
	Color       string `yaml:"color"`
	Buildable   bool   `yaml:"buildable"`
	URL         string `yaml:"url"`
	Description string `yaml:"description"`
}

type JobListResponse

type JobListResponse struct {
	Jobs []JobL `yaml:"jobs"`
}

type JobRawResponse

type JobRawResponse struct {
	Class       string `yaml:"_class"`
	Description string `yaml:"description"`
	FullName    string `yaml:"fullName"`
	Name        string `yaml:"name"`
	URL         string `yaml:"url"`
	Buildable   bool   `yaml:"buildable"`
	Builds      []struct {
		Class  string `yaml:"_class"`
		Number int    `yaml:"number"`
		URL    string `yaml:"url"`
	} `yaml:"builds"`
	Color        string `yaml:"color"`
	HealthReport []struct {
		Description string `yaml:"description"`
		Score       int    `yaml:"score"`
	} `yaml:"healthReport"`
	InQueue         bool `yaml:"inQueue"`
	NextBuildNumber int  `yaml:"nextBuildNumber"`
	ConcurrentBuild bool `yaml:"concurrentBuild"`
	ResumeBlocked   bool `yaml:"resumeBlocked"`
}

type JobResponse

type JobResponse struct {
	FullName         string `yaml:"fullName"`
	Name             string `yaml:"name"`
	Description      string `yaml:"description"`
	URL              string `yaml:"url"`
	Buildable        bool   `yaml:"buildable"`
	Color            string `yaml:"color"`
	Builds           int    `yaml:"builds"`
	LastHealthReport struct {
		Description string `yaml:"description"`
		Score       int    `yaml:"score"`
	} `yaml:"healthReport"`
	InQueue         bool `yaml:"inQueue"`
	NextBuildNumber int  `yaml:"nextBuildNumber"`
	ConcurrentBuild bool `yaml:"concurrentBuild"`
	ResumeBlocked   bool `yaml:"resumeBlocked"`
}

func GetJob

func GetJob(job_name string) (out_obj JobResponse)

type Kwargs

type Kwargs map[string]interface{}

type LoadStatistics added in v1.3.6

type LoadStatistics struct {
	Class string `yaml:"_class"`
}

type MonitorData added in v1.3.6

type MonitorData struct {
	HudsonNodeMonitorsSwapSpaceMonitor      HudsonNodeMonitorsSwapSpaceMonitor      `yaml:"hudson.node_monitors.SwapSpaceMonitor"`
	HudsonNodeMonitorsTemporarySpaceMonitor HudsonNodeMonitorsTemporarySpaceMonitor `yaml:"hudson.node_monitors.TemporarySpaceMonitor"`
	HudsonNodeMonitorsDiskSpaceMonitor      HudsonNodeMonitorsDiskSpaceMonitor      `yaml:"hudson.node_monitors.DiskSpaceMonitor"`
	HudsonNodeMonitorsArchitectureMonitor   string                                  `yaml:"hudson.node_monitors.ArchitectureMonitor"`
	HudsonNodeMonitorsResponseTimeMonitor   HudsonNodeMonitorsResponseTimeMonitor   `yaml:"hudson.node_monitors.ResponseTimeMonitor"`
	HudsonNodeMonitorsClockMonitor          HudsonNodeMonitorsClockMonitor          `yaml:"hudson.node_monitors.ClockMonitor"`
}

type NodesResponse added in v1.3.6

type NodesResponse struct {
	BusyExecutors  int        `yaml:"busyExecutors"`
	Computer       []Computer `yaml:"computer"`
	DisplayName    string     `yaml:"displayName"`
	TotalExecutors int        `yaml:"totalExecutors"`
}

func ListNodes added in v1.3.6

func ListNodes() (obj NodesResponse)

type Plugin added in v1.3.11

type Plugin struct {
	Active              bool        `yaml:"active"`
	BackupVersion       interface{} `yaml:"backupVersion"`
	Bundled             bool        `yaml:"bundled"`
	Deleted             bool        `yaml:"deleted"`
	Detached            bool        `yaml:"detached"`
	Downgradable        bool        `yaml:"downgradable"`
	Enabled             bool        `yaml:"enabled"`
	HasUpdate           bool        `yaml:"hasUpdate"`
	LongName            string      `yaml:"longName"`
	MinimumJavaVersion  string      `yaml:"minimumJavaVersion"`
	Pinned              bool        `yaml:"pinned"`
	RequiredCoreVersion string      `yaml:"requiredCoreVersion"`
	ShortName           string      `yaml:"shortName"`
	SupportsDynamicLoad string      `yaml:"supportsDynamicLoad"`
	URL                 string      `yaml:"url"`
	Version             string      `yaml:"version"`
}

func FilterPlugin added in v1.3.11

func FilterPlugin(plugins []Plugin, plugin_name string) (Plugin, error)

func FilterRegexPluginNames added in v1.3.11

func FilterRegexPluginNames(plugins []Plugin, re *regexp.Regexp) (res []Plugin)

func GetPlugin added in v1.3.11

func GetPlugin(plugin_names []string) (plugins []Plugin)

type PluginsResponse added in v1.3.11

type PluginsResponse struct {
	Plugins []Plugin `yaml:"plugins"`
}

func GetAllPlugins added in v1.3.11

func GetAllPlugins(regex_filter string) (obj PluginsResponse)

type Property added in v1.3.11

type Property struct {
	Class             string        `yaml:"_class"`
	Address           string        `yaml:"address,omitempty"`
	Triggers          []interface{} `yaml:"triggers,omitempty"`
	InsensitiveSearch bool          `yaml:"insensitiveSearch,omitempty"`
}

type ShortNameSorter added in v1.3.11

type ShortNameSorter []Plugin

func (ShortNameSorter) Len added in v1.3.11

func (s ShortNameSorter) Len() int

func (ShortNameSorter) Less added in v1.3.11

func (s ShortNameSorter) Less(i, j int) bool

func (ShortNameSorter) Swap added in v1.3.11

func (s ShortNameSorter) Swap(i, j int)

type UpdateCenterResponse added in v1.3.11

type UpdateCenterResponse struct {
	Class              string       `yaml:"_class"`
	Availables         []Availables `yaml:"availables"`
	ConnectionCheckURL string       `yaml:"connectionCheckUrl"`
	DataTimestamp      int64        `yaml:"dataTimestamp"`
	HasUpdates         bool         `yaml:"hasUpdates"`
	ID                 string       `yaml:"id"`
	Updates            []Updates    `yaml:"updates"`
	URL                string       `yaml:"url"`
}

func GetAllUpdateCenter added in v1.3.11

func GetAllUpdateCenter() (obj UpdateCenterResponse)

type UpdateNameSorter added in v1.3.11

type UpdateNameSorter []Updates

func (UpdateNameSorter) Len added in v1.3.11

func (u UpdateNameSorter) Len() int

func (UpdateNameSorter) Less added in v1.3.11

func (u UpdateNameSorter) Less(i, j int) bool

func (UpdateNameSorter) Swap added in v1.3.11

func (u UpdateNameSorter) Swap(i, j int)

type Updates added in v1.3.11

type Updates struct {
	Name                           string        `yaml:"name"`
	SourceID                       string        `yaml:"sourceId"`
	URL                            string        `yaml:"url"`
	Version                        string        `yaml:"version"`
	Categories                     []string      `yaml:"categories"`
	Compatible                     bool          `yaml:"compatible"`
	CompatibleSinceVersion         interface{}   `yaml:"compatibleSinceVersion"`
	CompatibleWithInstalledVersion bool          `yaml:"compatibleWithInstalledVersion"`
	Excerpt                        string        `yaml:"excerpt"`
	Installed                      Installed     `yaml:"installed"`
	MinimumJavaVersion             string        `yaml:"minimumJavaVersion"`
	NeededDependencies             []interface{} `yaml:"neededDependencies"`
	ReleaseTimestamp               int64         `yaml:"releaseTimestamp"`
	RequiredCore                   string        `yaml:"requiredCore"`
	Title                          string        `yaml:"title"`
	Wiki                           string        `yaml:"wiki"`
}

type User added in v1.3.11

type User struct {
	Class       string     `yaml:"_class"`
	AbsoluteURL string     `yaml:"absoluteUrl"`
	Description string     `yaml:"description"`
	FullName    string     `yaml:"fullName"`
	ID          string     `yaml:"id"`
	Property    []Property `yaml:"property"`
}

func GetUser added in v1.3.11

func GetUser(username string) (obj User)

Jump to

Keyboard shortcuts

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