apimodels

package
v0.0.0-...-a9abf63 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderEC2                     = "ec2"
	ProviderDocker                  = "docker"
	ScopeTask                       = "task"
	ScopeBuild                      = "build"
	DefaultSetupTimeoutSecs         = 600
	DefaultTeardownTimeoutSecs      = 21600
	DefaultContainerWaitTimeoutSecs = 600
	DefaultPollFrequency            = 30
)
View Source
const (
	SystemLogPrefix = "S"
	AgentLogPrefix  = "E"
	TaskLogPrefix   = "T"

	LogErrorPrefix = "E"
	LogWarnPrefix  = "W"
	LogDebugPrefix = "D"
	LogInfoPrefix  = "I"
)

for the different types of remote logging

Variables

This section is empty.

Functions

func GetBuildloggerLogs

func GetBuildloggerLogs(ctx context.Context, opts GetBuildloggerLogsOptions) (io.ReadCloser, error)

GetBuildloggerLogs makes request to cedar for a specifc log and returns a ReadCloser

func GetSeverityMapping

func GetSeverityMapping(s int) string

func ReadBuildloggerToChan

func ReadBuildloggerToChan(ctx context.Context, taskID string, r io.ReadCloser, lines chan<- LogMessage)

ReadBuildloggerToChan parses cedar log lines by message and severity and reads into channel

Types

type APIBuild

type APIBuild struct {
	Tasks []string `json:"tasks"`
}

APIBuild represents part of a build from the REST API for use in the smoke test.

type APITask

type APITask struct {
	Status string            `json:"status"`
	Logs   map[string]string `json:"logs"`
}

APITask represents part of a task from the REST API for use in the smoke test.

type AgentSetupData

type AgentSetupData struct {
	SumoLogicEndpoint string                  `json:"sumo_logic_endpoint"`
	SplunkServerURL   string                  `json:"splunk_server_url"`
	SplunkClientToken string                  `json:"splunk_client_token"`
	SplunkChannel     string                  `json:"splunk_channel"`
	S3Base            string                  `json:"s3_base"`
	S3Key             string                  `json:"s3_key"`
	S3Secret          string                  `json:"s3_secret"`
	S3Bucket          string                  `json:"s3_bucket"`
	TaskSync          evergreen.S3Credentials `json:"task_sync"`
	LogkeeperURL      string                  `json:"logkeeper_url"`
}

type BuildloggerInfo

type BuildloggerInfo struct {
	BaseURL  string `json:"base_url"`
	RPCPort  string `json:"rpc_port"`
	Username string `json:"username"`
	Password string `json:"password,omitempty"`
	APIKey   string `json:"api_key,omitempty"`
}

type CreateHost

type CreateHost struct {
	// agent-controlled settings
	CloudProvider       string `mapstructure:"provider" json:"provider" yaml:"provider" plugin:"expand"`
	NumHosts            string `mapstructure:"num_hosts" json:"num_hosts" yaml:"num_hosts" plugin:"expand"`
	Scope               string `mapstructure:"scope" json:"scope" yaml:"scope" plugin:"expand"`
	SetupTimeoutSecs    int    `mapstructure:"timeout_setup_secs" json:"timeout_setup_secs" yaml:"timeout_setup_secs"`
	TeardownTimeoutSecs int    `mapstructure:"timeout_teardown_secs" json:"timeout_teardown_secs" yaml:"timeout_teardown_secs"`
	Retries             int    `mapstructure:"retries" json:"retries" yaml:"retries"`

	// EC2-related settings
	AMI             string      `mapstructure:"ami" json:"ami" yaml:"ami" plugin:"expand"`
	Distro          string      `mapstructure:"distro" json:"distro" yaml:"distro" plugin:"expand"`
	EBSDevices      []EbsDevice `mapstructure:"ebs_block_device" json:"ebs_block_device" yaml:"ebs_block_device" plugin:"expand"`
	InstanceType    string      `mapstructure:"instance_type" json:"instance_type" yaml:"instance_type" plugin:"expand"`
	IPv6            bool        `mapstructure:"ipv6" json:"ipv6" yaml:"ipv6"`
	Region          string      `mapstructure:"region" json:"region" yaml:"region" plugin:"expand"`
	SecurityGroups  []string    `mapstructure:"security_group_ids" json:"security_group_ids" yaml:"security_group_ids" plugin:"expand"`
	Spot            bool        `mapstructure:"spot" json:"spot" yaml:"spot"`
	Subnet          string      `mapstructure:"subnet_id" json:"subnet_id" yaml:"subnet_id" plugin:"expand"`
	UserdataFile    string      `mapstructure:"userdata_file" json:"userdata_file" yaml:"userdata_file" plugin:"expand"`
	UserdataCommand string      `json:"userdata_command" yaml:"userdata_command" plugin:"expand"`
	AWSKeyID        string      `mapstructure:"aws_access_key_id" json:"aws_access_key_id" yaml:"aws_access_key_id" plugin:"expand"`
	AWSSecret       string      `mapstructure:"aws_secret_access_key" json:"aws_secret_access_key" yaml:"aws_secret_access_key" plugin:"expand"`
	KeyName         string      `mapstructure:"key_name" json:"key_name" yaml:"key_name" plugin:"expand"`

	// docker-related settings
	Image                    string            `mapstructure:"image" json:"image" yaml:"image" plugin:"expand"`
	Command                  string            `mapstructure:"command" json:"command" yaml:"command" plugin:"expand"`
	PublishPorts             bool              `mapstructure:"publish_ports" json:"publish_ports" yaml:"publish_ports"`
	Registry                 RegistrySettings  `mapstructure:"registry" json:"registry" yaml:"registry" plugin:"expand"`
	Background               bool              `mapstructure:"background" json:"background" yaml:"background"` // default is true
	ContainerWaitTimeoutSecs int               `mapstructure:"container_wait_timeout_secs" json:"container_wait_timeout_secs" yaml:"container_wait_timeout_secs"`
	PollFrequency            int               `mapstructure:"poll_frequency_secs" json:"poll_frequency_secs" yaml:"poll_frequency_secs"` // poll frequency in seconds
	StdoutFile               string            `mapstructure:"stdout_file_name" json:"stdout_file_name" yaml:"stdout_file_name" plugin:"expand"`
	StderrFile               string            `mapstructure:"stderr_file_name" json:"stderr_file_name" yaml:"stderr_file_name" plugin:"expand"`
	EnvironmentVars          map[string]string `mapstructure:"environment_vars" json:"environment_vars" yaml:"environment_vars" plugin:"environment_vars"`
}

func (*CreateHost) Expand

func (ch *CreateHost) Expand(exp *util.Expansions) error

func (*CreateHost) Validate

func (ch *CreateHost) Validate() error

func (*CreateHost) ValidateDocker

func (ch *CreateHost) ValidateDocker() error

func (*CreateHost) ValidateEC2

func (ch *CreateHost) ValidateEC2() error

type EbsDevice

type EbsDevice struct {
	DeviceName string `mapstructure:"device_name" json:"device_name" yaml:"device_name"`
	IOPS       int    `mapstructure:"ebs_iops" json:"ebs_iops" yaml:"ebs_iops"`
	SizeGiB    int    `mapstructure:"ebs_size" json:"ebs_size" yaml:"ebs_size"`
	SnapshotID string `mapstructure:"ebs_snapshot_id" json:"ebs_snapshot_id" yaml:"ebs_snapshot_id"`
}

type EndTaskResponse

type EndTaskResponse struct {
	ShouldExit bool `json:"should_exit,omitempty"`
}

EndTaskResponse is what is returned when the task ends

type ExpansionVars

type ExpansionVars struct {
	Vars        map[string]string `json:"vars"`
	PrivateVars map[string]bool   `json:"private_vars"`
}

ExpansionVars is a map of expansion variables for a project.

type GeneratePollResponse

type GeneratePollResponse struct {
	Finished bool     `json:"finished"`
	Errors   []string `json:"errors"`
}

type GetBuildloggerLogsOptions

type GetBuildloggerLogsOptions struct {
	BaseURL       string
	TaskID        string
	Execution     int
	PrintPriority bool
	Tail          int
	LogType       string
}

GetBuildloggerLogsOptions represents the arguments passed into GetBuildloggerLogs function.

type GetNextTaskDetails

type GetNextTaskDetails struct {
	TaskGroup     string `json:"task_group"`
	AgentRevision string `json:"agent_revision"`
}

type HeartbeatResponse

type HeartbeatResponse struct {
	Abort bool `json:"abort,omitempty"`
}

HeartbeatResponse is sent by the API server in response to the agent's heartbeat message.

type LogInfo

type LogInfo struct {
	Command string `bson:"command" json:"command"`
	URL     string `bson:"url" json:"url"`
}

type LogMessage

type LogMessage struct {
	Type      string    `bson:"t" json:"t"`
	Severity  string    `bson:"s" json:"s"`
	Message   string    `bson:"m" json:"m"`
	Timestamp time.Time `bson:"ts" json:"ts"`
	Version   int       `bson:"v" json:"v"`
}

Also used in the task_logg collection in the database. The LogMessage type is used by the models package and is stored in the database (inside in the model.TaskLog structure.)

func ReadBuildloggerToSlice

func ReadBuildloggerToSlice(ctx context.Context, taskID string, r io.ReadCloser) []LogMessage

ReadBuildloggerToSlice returns a slice of LogMessages from a ReadCloser

type NextTaskResponse

type NextTaskResponse struct {
	TaskId              string `json:"task_id,omitempty"`
	TaskSecret          string `json:"task_secret,omitempty"`
	TaskGroup           string `json:"task_group,omitempty"`
	Version             string `json:"version,omitempty"`
	Build               string `json:"build,omitempty"`
	ShouldExit          bool   `json:"should_exit,omitempty"`
	ShouldTeardownGroup bool   `json:"should_teardown_group,omitempty"`
}

NextTaskResponse represents the response sent back when an agent asks for a next task

type OOMTrackerInfo

type OOMTrackerInfo struct {
	Detected bool  `bson:"detected" json:"detected"`
	Pids     []int `bson:"pids" json:"pids"`
}

type ProcessTimeoutResponse

type ProcessTimeoutResponse struct {
	Status        string      `json:"status"`
	LateProcesses interface{} `json:"late_mci_processes,omitempty"`
}

Struct for reporting process timeouts

type RegistrySettings

type RegistrySettings struct {
	Name     string `mapstructure:"registry_name" json:"registry_name" yaml:"registry_name"`
	Username string `mapstructure:"registry_username" json:"registry_username" yaml:"registry_username"`
	Password string `mapstructure:"registry_password" json:"registry_password" yaml:"registry_password"`
}

type S3CopyRequest

type S3CopyRequest struct {
	AwsKey              string `json:"aws_key"`
	AwsSecret           string `json:"aws_secret"`
	S3SourceRegion      string `json:"s3_source_region"`
	S3SourceBucket      string `json:"s3_source_bucket"`
	S3SourcePath        string `json:"s3_source_path"`
	S3DestinationRegion string `json:"s3_destination_region"`
	S3DestinationBucket string `json:"s3_destination_bucket"`
	S3DestinationPath   string `json:"s3_destination_path"`
	S3DisplayName       string `json:"display_name"`
	S3Permissions       string `json:"s3_permissions"`
}

S3CopyRequest holds information necessary for the API server to complete an S3 copy request; namely, an S3 key/secret, a source and a destination path

type TaskEndDetail

type TaskEndDetail struct {
	Status          string         `bson:"status,omitempty" json:"status,omitempty"`
	Type            string         `bson:"type,omitempty" json:"type,omitempty"`
	Description     string         `bson:"desc,omitempty" json:"desc,omitempty"`
	TimedOut        bool           `bson:"timed_out,omitempty" json:"timed_out,omitempty"`
	TimeoutType     string         `bson:"timeout_type,omitempty" json:"timeout_type,omitempty"`
	TimeoutDuration time.Duration  `bson:"timeout_duration,omitempty" json:"timeout_duration,omitempty"`
	OOMTracker      OOMTrackerInfo `bson:"oom_killer,omitempty" json:"oom_killer,omitempty"`
	Logs            *TaskLogs      `bson:"-" json:"logs,omitempty"`
}

TaskEndDetail contains data sent from the agent to the API server after each task run.

type TaskEndDetails

type TaskEndDetails struct {
	TimeoutStage string `bson:"timeout_stage,omitempty" json:"timeout_stage,omitempty"`
	TimedOut     bool   `bson:"timed_out,omitempty" json:"timed_out,omitempty"`
}

type TaskLog

type TaskLog struct {
	TaskId       string       `json:"t_id"`
	Execution    int          `json:"e"`
	Timestamp    time.Time    `json:"ts"`
	MessageCount int          `json:"c"`
	Messages     []LogMessage `json:"m"`
}

TaskLog is a group of LogMessages, and mirrors the model.TaskLog type, sans the ObjectID field.

type TaskLogs

type TaskLogs struct {
	AgentLogURLs  []LogInfo `bson:"agent" json:"agent"`
	SystemLogURLs []LogInfo `bson:"system" json:"system"`
	TaskLogURLs   []LogInfo `bson:"task" json:"task"`
}

type TaskStartRequest

type TaskStartRequest struct {
	Pid string `json:"pid"`
}

TaskStartRequest holds information sent by the agent to the API server at the beginning of each task run.

type WorkstationSetupCommandOptions

type WorkstationSetupCommandOptions struct {
	Directory string
	Quiet     bool
	DryRun    bool
}

Jump to

Keyboard shortcuts

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