Documentation
¶
Index ¶
- Constants
- Variables
- func FindEvergreenHome() string
- func IsSystemActivator(caller string) bool
- func SetLegacyLogger()
- type APIConfig
- type AWSConfig
- type AlertsConfig
- type AuthConfig
- type AuthUser
- type ClientBinary
- type ClientConfig
- type CloudProviders
- type ConfigValidator
- type CrowdConfig
- type DBSettings
- type DigitalOceanConfig
- type GithubAuthConfig
- type HostInitConfig
- type JiraConfig
- type LoggingWriter
- type MonitorConfig
- type NaiveAuthConfig
- type NotifyConfig
- type PluginConfig
- type RepoTrackerConfig
- type RunnerConfig
- type SMTPConfig
- type SchedulerConfig
- type Settings
- type TaskRunnerConfig
- type UIConfig
- type WriteConcern
Constants ¶
const ( User = "mci" HostRunning = "running" HostTerminated = "terminated" HostUninitialized = "starting" HostInitializing = "provisioning" HostProvisionFailed = "provision failed" HostUnreachable = "unreachable" HostQuarantined = "quarantined" HostDecommissioned = "decommissioned" HostStatusSuccess = "success" HostStatusFailed = "failed" TaskStarted = "started" TaskUndispatched = "undispatched" TaskDispatched = "dispatched" TaskFailed = "failed" TaskSucceeded = "success" TaskInactive = "inactive" TaskSystemFailed = "system-failed" TaskTimedOut = "task-timed-out" TaskSystemUnresponse = "system-unresponsive" TaskSystemTimedOut = "system-timed-out" TaskTestTimedOut = "test-timed-out" TestFailedStatus = "fail" TestSilentlyFailedStatus = "silentfail" TestSkippedStatus = "skip" TestSucceededStatus = "pass" BuildStarted = "started" BuildCreated = "created" BuildFailed = "failed" BuildSucceeded = "success" VersionStarted = "started" VersionCreated = "created" VersionFailed = "failed" VersionSucceeded = "success" PatchCreated = "created" PatchStarted = "started" PatchSucceeded = "succeeded" PatchFailed = "failed" PushLogPushing = "pushing" PushLogSuccess = "success" HostTypeStatic = "static" CompileStage = "compile" PushStage = "push" // maximum task (zero based) execution number MaxTaskExecution = 3 // maximum task priority MaxTaskPriority = 100 // LogMessage struct versions LogmessageFormatTimestamp = 1 LogmessageCurrentVersion = LogmessageFormatTimestamp EvergreenHome = "EVGHOME" DefaultTaskActivator = "" StepbackTaskActivator = "stepback" APIServerTaskActivator = "apiserver" RestRoutePrefix = "rest" AgentAPIVersion = 2 )
const ( UIPackage = "EVERGREEN_UI" RESTV2Package = "EVERGREEN_REST_V2" )
evergreen package names
const ( AuthTokenCookie = "mci-token" TaskSecretHeader = "Task-Secret" HostHeader = "Host-Id" HostSecretHeader = "Host-Secret" )
const ( MethodGet = "GET" MethodHead = "HEAD" MethodPost = "POST" MethodPut = "PUT" MethodPatch = "PATCH" // RFC 5789 MethodDelete = "DELETE" MethodConnect = "CONNECT" MethodOptions = "OPTIONS" MethodTrace = "TRACE" )
HTTP constants. Added after Go1.4. Here for compatibility with GCCGO compatibility. Copied from: https://golang.org/pkg/net/http/#pkg-constants
const (
// DefaultConfFile is the default config file path for Evergreen.
DefaultConfFile = "/etc/mci_settings.yml"
)
Variables ¶
var ( // Should be specified with -ldflags at build time BuildRevision = "" // Commandline Version String; used to control auto-updating. // in the future this should probably be a date, but this is the legacy value ClientVersion = "da802240058e2b8bc99546c5195b38273a7bd5b0" )
var ( // UphostStatus is a list of all host statuses that are considered "up." // This is used for query building. UphostStatus = []string{ HostRunning, HostUninitialized, HostInitializing, HostProvisionFailed, } // Logger is our global logger. It can be changed for testing. Logger slogger.Logger // database and config directory, set to the testing version by default for safety NotificationsFile = "mci-notifications.yml" ClientDirectory = "clients" // version requester types PatchVersionRequester = "patch_request" RepotrackerVersionRequester = "gitter_request" // constant arrays for db update logic AbortableStatuses = []string{TaskStarted, TaskDispatched} CompletedStatuses = []string{TaskSucceeded, TaskFailed} )
var ConfigValidationRules = []ConfigValidator{ func(settings *Settings) error { if settings.Database.Url == "" || settings.Database.DB == "" { return errors.New("DBUrl and DB must not be empty") } return nil }, func(settings *Settings) error { if settings.ApiUrl == "" { return errors.New("API hostname must not be empty") } return nil }, func(settings *Settings) error { if settings.Ui.Secret == "" { return errors.New("UI Secret must not be empty") } return nil }, func(settings *Settings) error { if settings.ConfigDir == "" { return errors.New("Config directory must not be empty") } return nil }, func(settings *Settings) error { if settings.Ui.DefaultProject == "" { return errors.New("You must specify a default project in UI") } return nil }, func(settings *Settings) error { if settings.Ui.Url == "" { return errors.New("You must specify a default UI url") } return nil }, func(settings *Settings) error { notifyConfig := settings.Notify.SMTP if notifyConfig == nil { return nil } if notifyConfig.Server == "" || notifyConfig.Port == 0 { return errors.New("You must specify a SMTP server and port") } if len(notifyConfig.AdminEmail) == 0 { return errors.New("You must specify at least one admin_email") } if notifyConfig.From == "" { return errors.New("You must specify a from address") } return nil }, func(settings *Settings) error { if settings.AuthConfig.Crowd == nil && settings.AuthConfig.Naive == nil && settings.AuthConfig.Github == nil { return errors.New("You must specify one form of authentication") } if settings.AuthConfig.Naive != nil { used := map[string]bool{} for _, x := range settings.AuthConfig.Naive.Users { if used[x.Username] { return errors.New("Duplicate user in list") } used[x.Username] = true } } if settings.AuthConfig.Github != nil { if settings.AuthConfig.Github.Users == nil && settings.AuthConfig.Github.Organization == "" { return errors.New("Must specify either a set of users or an organization for Github Authentication") } } return nil }, }
ConfigValidationRules is the set of all ConfigValidator functions.
Functions ¶
func FindEvergreenHome ¶
func FindEvergreenHome() string
FindEvergreenHome finds the directory of the EVGHOME environment variable.
func IsSystemActivator ¶
IsSystemActivator returns true when the task activator is Evergreen.
func SetLegacyLogger ¶
func SetLegacyLogger()
SetLegacyLogger sets the global (s)logger instance to wrap the current grip Logger.
Types ¶
type APIConfig ¶
type APIConfig struct {
LogFile string
HttpListenAddr string
HttpsListenAddr string
HttpsKey string
HttpsCert string
}
APIConfig holds relevant encryption and log settings for the API server.
type AlertsConfig ¶
type AlertsConfig struct {
LogFile string
SMTP *SMTPConfig `yaml:"smtp"`
}
type AuthConfig ¶
type AuthConfig struct {
Crowd *CrowdConfig `yaml:"crowd"`
Naive *NaiveAuthConfig `yaml:"naive"`
Github *GithubAuthConfig `yaml:"github"`
}
AuthConfig has a pointer to either a CrowConfig or a NaiveAuthConfig.
type AuthUser ¶
type AuthUser struct {
Username string `yaml:"username"`
DisplayName string `yaml:"display_name"`
Password string `yaml:"password"`
Email string `yaml:"email"`
}
AuthUser configures a user for our Naive authentication setup.
type ClientBinary ¶
type ClientConfig ¶
type ClientConfig struct {
ClientBinaries []ClientBinary `yaml:"client_binaries"`
LatestRevision string `yaml:"latest_revision"`
}
type CloudProviders ¶
type CloudProviders struct {
AWS AWSConfig `yaml:"aws"`
DigitalOcean DigitalOceanConfig `yaml:"digitalocean"`
}
CloudProviders stores configuration settings for the supported cloud host providers.
type ConfigValidator ¶
ConfigValidator is a type of function that checks the settings struct for any errors or missing required fields.
type CrowdConfig ¶
CrowdConfig holds settings for interacting with Atlassian Crowd.
type DBSettings ¶
type DBSettings struct {
Url string `yaml:"url"`
SSL bool `yaml:"ssl"`
DB string `yaml:"db"`
WriteConcernSettings WriteConcern `yaml:"write_concern"`
}
type DigitalOceanConfig ¶
DigitalOceanConfig stores auth info for Digital Ocean.
type GithubAuthConfig ¶
type GithubAuthConfig struct {
ClientId string `yaml:"client_id"`
ClientSecret string `yaml:"client_secret"`
Users []string `yaml:"users"`
Organization string `yaml:"organization"`
}
GithubAuthConfig holds settings for interacting with Github Authentication including the ClientID, ClientSecret and CallbackUri which are given when registering the application Furthermore,
type HostInitConfig ¶
HostInitConfig holds logging settings for the hostinit process.
type JiraConfig ¶
JiraConfig stores auth info for interacting with Atlassian Jira.
type LoggingWriter ¶
type LoggingWriter struct {
Logger *slogger.Logger
Severity level.Priority
// contains filtered or unexported fields
}
LoggingWriter is a struct - with an associated log level severity - that implements io.Writer
func NewErrorLoggingWriter ¶
func NewErrorLoggingWriter(logger *slogger.Logger) *LoggingWriter
NewErrorLoggingWriter is a helper function that returns a LoggingWriter for errors
func NewInfoLoggingWriter ¶
func NewInfoLoggingWriter(logger *slogger.Logger) *LoggingWriter
NewInfoLoggingWriter is a helper function that returns a LoggingWriter for information logs
type MonitorConfig ¶
type MonitorConfig struct {
LogFile string
}
MonitorConfig holds logging settings for the monitor process.
type NaiveAuthConfig ¶
type NaiveAuthConfig struct {
Users []*AuthUser
}
NaiveAuthConfig contains a list of AuthUsers from the settings file.
type NotifyConfig ¶
type NotifyConfig struct {
LogFile string
SMTP *SMTPConfig `yaml:"smtp"`
}
NotifyConfig hold logging and email settings for the notify package.
type PluginConfig ¶
PluginConfig holds plugin-specific settings, which are handled. manually by their respective plugins
type RepoTrackerConfig ¶
type RepoTrackerConfig struct {
NumNewRepoRevisionsToFetch int
MaxRepoRevisionsToSearch int
LogFile string
}
RepoTrackerConfig holds settings for polling project repositories.
type RunnerConfig ¶
RunnerConfig holds logging and timing settings for the runner process.
type SMTPConfig ¶
type SMTPConfig struct {
Server string `yaml:"server"`
Port int `yaml:"port"`
UseSSL bool `yaml:"use_ssl"`
Username string `yaml:"username"`
Password string `yaml:"password"`
From string `yaml:"from"`
AdminEmail []string `yaml:"admin_email"`
}
SMTPConfig holds SMTP email settings.
type SchedulerConfig ¶
SchedulerConfig holds relevant settings for the scheduler process.
type Settings ¶
type Settings struct {
Database DBSettings `yaml:"database"`
WriteConcern WriteConcern `yaml:"write_concern"`
ConfigDir string `yaml:"configdir"`
ApiUrl string `yaml:"api_url"`
AgentExecutablesDir string `yaml:"agentexecutablesdir"`
ClientBinariesDir string `yaml:"client_binaries_dir"`
SuperUsers []string `yaml:"superusers"`
Jira JiraConfig `yaml:"jira"`
Providers CloudProviders `yaml:"providers"`
Keys map[string]string `yaml:"keys"`
Credentials map[string]string `yaml:"credentials"`
AuthConfig AuthConfig `yaml:"auth"`
RepoTracker RepoTrackerConfig `yaml:"repotracker"`
Monitor MonitorConfig `yaml:"monitor"`
Api APIConfig `yaml:"api"`
Alerts AlertsConfig `yaml:"alerts"`
Ui UIConfig `yaml:"ui"`
HostInit HostInitConfig `yaml:"hostinit"`
Notify NotifyConfig `yaml:"notify"`
Runner RunnerConfig `yaml:"runner"`
Scheduler SchedulerConfig `yaml:"scheduler"`
TaskRunner TaskRunnerConfig `yaml:"taskrunner"`
Expansions map[string]string `yaml:"expansions"`
Plugins PluginConfig `yaml:"plugins"`
IsProd bool `yaml:"isprod"`
}
Settings contains all configuration settings for running Evergreen.
func GetSettings ¶
GetSettings returns Evergreen Settings or an error.
func GetSettingsOrExit ¶
func GetSettingsOrExit() *Settings
GetSettingsOrExit loads the evergreen settings file, or exits with a non-0 code if any errors occur.
func NewSettings ¶
NewSettings builds an in-memory representation of the given settings file.
func (*Settings) Validate ¶
func (settings *Settings) Validate(validators []ConfigValidator) error
Validate checks the settings and returns nil if the config is valid, or an error with a message explaining why otherwise.
type TaskRunnerConfig ¶
type TaskRunnerConfig struct {
LogFile string
}
TaskRunnerConfig holds logging settings for the scheduler process.
type UIConfig ¶
type UIConfig struct {
Url string
HelpUrl string
HttpListenAddr string
// Secret to encrypt session storage
Secret string
LogFile string
// Default project to assume when none specified, e.g. when using
// the /waterfall route use this project, while /waterfall/other-project
// then use `other-project`
DefaultProject string
// Cache results of template compilation, so you don't have to re-read files
// on every request. Note that if this is true, changes to HTML templates
// won't take effect until server restart.
CacheTemplates bool
// SecureCookies sets the "secure" flag on user tokens. Evergreen
// does not yet natively support SSL UI connections, but this option
// is available, for example, for deployments behind HTTPS load balancers.
SecureCookies bool
}
UIConfig holds relevant settings for the UI server.
Directories
¶
| Path | Synopsis |
|---|---|
|
main
command
|
|
|
main
command
|
|
|
config
The plugin/config package is used to manage which plugins are imported into MCI.
|
The plugin/config package is used to manage which plugins are imported into MCI. |
|
The REST API V2 has a series of central types that are useful to understand when adding new endpoints or increasing its functionality.
|
The REST API V2 has a series of central types that are useful to understand when adding new endpoints or increasing its functionality. |
|
data
Adding to the Connector The Connector is a very large interface that defines how to access the main state of the database and data central to Evergreen's function.
|
Adding to the Connector The Connector is a very large interface that defines how to access the main state of the database and data central to Evergreen's function. |
|
model
Adding Models Each model is kept in the model package of the REST v2 API in its own file.
|
Adding Models Each model is kept in the model package of the REST v2 API in its own file. |
|
route
Adding a Route Adding a new route to the REST v2 API requires creation of a few structs and implementation of a few new methods.
|
Adding a Route Adding a new route to the REST v2 API requires creation of a few structs and implementation of a few new methods. |
|
Package runner provides a basic interface to run various processes within Evergreen.
|
Package runner provides a basic interface to run various processes within Evergreen. |
|
main
command
Main package for the Evergreen runner.
|
Main package for the Evergreen runner. |
|
This program uses the Evergreen REST API to grab the most recent configuration for each project and write each configuration file to the file system for further analysis.
|
This program uses the Evergreen REST API to grab the most recent configuration for each project and write each configuration file to the file system for further analysis. |
|
vendoring
Package vendoring provides a several variables used in vendoring buildscripts and function that reports (without any external dependencies) if the current environment requires legacy-style vendoring, or if its safe to use new-style vendoring.
|
Package vendoring provides a several variables used in vendoring buildscripts and function that reports (without any external dependencies) if the current environment requires legacy-style vendoring, or if its safe to use new-style vendoring. |
|
api_main
command
|
|
|
ui_main
command
|
|