Documentation ¶
Overview ¶
Package apimodels provides models used across multiple packages by the REST API.
Index ¶
- Constants
- func GetBuildloggerLogs(ctx context.Context, opts GetBuildloggerLogsOptions) (log.LogIterator, error)
- func GetSeverityMapping(s level.Priority) string
- func StreamFromLogIterator(it log.LogIterator) chan LogMessage
- type AgentSetupData
- type AssumeRoleRequest
- type AssumeRoleResponse
- type CedarConfig
- type CedarPerfCount
- type CheckMergeRequest
- type CheckRunAnnotation
- type CheckRunOutput
- type CreateHost
- type DisableInfo
- type DisplayTaskInfo
- type DistroView
- type EbsDevice
- type EndTaskResponse
- type ExpansionsAndVars
- type FailingCommand
- type GeneratePollResponse
- type GetBuildloggerLogsOptions
- type GetCedarPerfCountOptions
- type GetNextTaskDetails
- type HeartbeatResponse
- type LogInfo
- type LogMessage
- type ModuleCloneInfo
- type NextTaskResponse
- type OOMTrackerInfo
- type ProcessTimeoutResponse
- type PullRequestInfo
- type RegistrySettings
- type S3CopyRequest
- type TaskEndDetail
- type TaskEndDetails
- type TaskStartRequest
- type TaskTestResultsInfo
- type Token
- type WorkstationSetupCommandOptions
Constants ¶
const ( ProviderEC2 = "ec2" ProviderDocker = "docker" ScopeTask = "task" ScopeBuild = "build" DefaultSetupTimeoutSecs = 600 DefaultTeardownTimeoutSecs = 21600 DefaultContainerWaitTimeoutSecs = 600 DefaultPollFrequency = 30 DefaultRetries = 2 )
const ( SystemLogPrefix = "S" AgentLogPrefix = "E" TaskLogPrefix = "T" LogErrorPrefix = "E" LogWarnPrefix = "W" LogDebugPrefix = "D" LogInfoPrefix = "I" )
Variables ¶
This section is empty.
Functions ¶
func GetBuildloggerLogs ¶
func GetBuildloggerLogs(ctx context.Context, opts GetBuildloggerLogsOptions) (log.LogIterator, error)
GetBuildloggerLogs makes request to Cedar for a specifc log and returns a log iterator. TODO (DEVPROD-1681): Remove this once Cedar logs have TTL'ed.
func GetSeverityMapping ¶
func StreamFromLogIterator ¶
func StreamFromLogIterator(it log.LogIterator) chan LogMessage
StreamFromLogIterator streams log lines from the given iterator to the returned log message channel. It is the responsibility of the caller to close the log iterator.
Types ¶
type AgentSetupData ¶
type AgentSetupData struct { SplunkServerURL string `json:"splunk_server_url"` SplunkClientToken string `json:"splunk_client_token"` SplunkChannel string `json:"splunk_channel"` TaskSync evergreen.S3Credentials `json:"task_sync"` TaskOutput evergreen.S3Credentials `json:"task_output"` EC2Keys []evergreen.EC2Key `json:"ec2_keys"` TraceCollectorEndpoint string `json:"trace_collector_endpoint"` MaxExecTimeoutSecs int `json:"max_exec_timeout_secs"` }
type AssumeRoleRequest ¶
type AssumeRoleRequest struct { // RoleARN is the Amazon Resource Name (ARN) of the role to assume. RoleARN string `json:"role_arn"` // Policy is an optional field that can be used to restrict the permissions. Policy *string `json:"policy"` // DurationSeconds is an optional field of the duration of the role session. // It defaults to 15 minutes. DurationSeconds *int32 `json:"duration_seconds"` }
AssumeRoleRequest is the details of what role to assume.
func (*AssumeRoleRequest) Validate ¶
func (ar *AssumeRoleRequest) Validate() error
Validate checks that the request has valid values.
type AssumeRoleResponse ¶
type AssumeRoleResponse struct { AccessKeyID string `json:"access_key_id"` SecretAccessKey string `json:"secret_access_key"` SessionToken string `json:"session_token"` Expiration string `json:"expiration"` }
AssumeRoleResponse the credentials from assuming a role.
type CedarConfig ¶
type CedarConfig struct { BaseURL string `json:"base_url"` GRPCBaseURL string `json:"grpc_base_url"` RPCPort string `json:"rpc_port"` Username string `json:"username"` APIKey string `json:"api_key,omitempty"` Insecure bool `json:"insecure"` SendToCedarDisabled bool `json:"send_to_cedar_disabled"` SPSURL string `json:"sps_url"` SendRatioSPS int `json:"send_ratio_sps"` }
type CedarPerfCount ¶
type CedarPerfCount struct {
NumberOfResults int `json:"number_of_results"`
}
CedarPerfCount holds one element, NumberOfResults, matching the json returned by Cedar's perf count rest route.
func CedarPerfResultsCount ¶
func CedarPerfResultsCount(ctx context.Context, opts GetCedarPerfCountOptions) (*CedarPerfCount, error)
CedarPerfResultsCount queries Cedar for the number of perf results attached to a task.
type CheckMergeRequest ¶
type CheckMergeRequest struct { PRNum int `json:"pr_num"` Owner string `json:"owner"` Repo string `json:"repo"` }
CheckMergeRequest holds information sent by the agent to get a PR and check mergeability.
type CheckRunAnnotation ¶
type CheckRunAnnotation struct { Path string `json:"path,omitempty" plugin:"expand"` StartLine *int `json:"start_line,omitempty" ` EndLine *int `json:"end_line,omitempty" ` StartColumn *int `json:"start_column,omitempty"` EndColumn *int `json:"end_column,omitempty" ` AnnotationLevel string `json:"annotation_level,omitempty" plugin:"expand"` Message string `json:"message,omitempty" plugin:"expand"` Title string `json:"title,omitempty" plugin:"expand"` RawDetails string `json:"raw_details,omitempty" plugin:"expand"` }
CheckRunAnnotation represents an annotation object for a CheckRun output.
type CheckRunOutput ¶
type CheckRunOutput struct { Title string `json:"title,omitempty" plugin:"expand"` Summary string `json:"summary,omitempty" plugin:"expand"` Text string `json:"text,omitempty" plugin:"expand"` AnnotationsCount *int `json:"annotations_count,omitempty"` AnnotationsURL string `json:"annotations_url,omitempty" plugin:"expand"` Annotations []*CheckRunAnnotation `json:"annotations,omitempty" plugin:"expand"` }
CheckRunOutput represents the output for a CheckRun.
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"` Subnet string `mapstructure:"subnet_id" json:"subnet_id" yaml:"subnet_id" plugin:"expand"` Tenancy evergreen.EC2Tenancy `mapstructure:"tenancy" json:"tenancy" yaml:"tenancy" plugin:"expand"` UserdataFile string `mapstructure:"userdata_file" json:"userdata_file" yaml:"userdata_file" plugin:"expand"` // UserdataCommand is the content of the userdata file. Users can't actually // set this directly, instead they pass in a userdata file. UserdataCommand string `json:"userdata_command" yaml:"userdata_command" 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 StdinFile string `mapstructure:"stdin_file_name" json:"stdin_file_name" yaml:"stdin_file_name" plugin:"expand"` // StdinFileContents is the full file content of the StdinFile on the host, // which is then sent to the app server. StdinFileContents []byte `mapstructure:"-" json:"stdin_file_contents" yaml:"-"` 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:"expand"` ExtraHosts []string `mapstructure:"extra_hosts" json:"extra_hosts" yaml:"extra_hosts" plugin:"expand"` }
func (*CreateHost) Expand ¶
func (ch *CreateHost) Expand(exp *util.Expansions) error
type DisableInfo ¶
type DisableInfo struct {
Reason string `bson:"reason" json:"reason"`
}
type DisplayTaskInfo ¶
DisplayTaskInfo represents information about a display task necessary for creating a cedar test result.
type DistroView ¶
type DistroView struct { DisableShallowClone bool `json:"disable_shallow_clone"` Mountpoints []string `json:"mountpoints"` ExecUser string `json:"exec_user"` }
DistroView represents the view of data that the agent uses from the distro it is running on.
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"` Throughput int `mapstructure:"ebs_throughput" json:"ebs_throughput" yaml:"ebs_throughput"` 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 ExpansionsAndVars ¶
type ExpansionsAndVars struct { // Expansions contain the expansions for a task. Expansions util.Expansions `json:"expansions"` // Parameters contain the parameters for a task. Parameters map[string]string `json:"parameters"` // Vars contain the project variables and parameters. Vars map[string]string `json:"vars"` // PrivateVars contain the project private variables. PrivateVars map[string]bool `json:"private_vars"` // Redact keys contain patterns to match against expansion keys for // redaction in logs. RedactKeys []string `json:"redact_keys"` }
ExpansionsAndVars represents expansions, project variables, and parameters used when running a task.
type FailingCommand ¶
type FailingCommand struct { FullDisplayName string `bson:"full_display_name,omitempty" json:"full_display_name,omitempty"` FailureMetadataTags []string `bson:"failure_metadata_tags,omitempty" json:"failure_metadata_tags,omitempty"` }
FailingCommand represents a command that failed in a task.
type GeneratePollResponse ¶
type GetBuildloggerLogsOptions ¶
type GetBuildloggerLogsOptions struct { BaseURL string `json:"_"` TaskID string `json:"-"` Execution *int `json:"-"` TestName string `json:"-"` Tags []string `json:"-"` Start int64 `json:"-"` End int64 `json:"-"` Limit int `json:"-"` Tail int `json:"-"` }
GetBuildloggerLogsOptions represents the arguments passed into the GetBuildloggerLogs function.
type GetCedarPerfCountOptions ¶
type GetCedarPerfCountOptions struct { BaseURL string `json:"-"` TaskID string `json:"-"` Execution int `json:"_"` }
GetCedarPerfCountOptions represents the arguments for getting a count of perf results for a given task id from Cedar.
type GetNextTaskDetails ¶
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 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"` }
The LogMessage type is used by the the GraphQL resolver and HTML logs.
func ReadLogToSlice ¶
func ReadLogToSlice(it log.LogIterator) ([]*LogMessage, error)
ReadLogToSlice returns a slice of log message pointers from a log iterator.
type ModuleCloneInfo ¶
type NextTaskResponse ¶
type NextTaskResponse struct { TaskId string `json:"task_id,omitempty"` TaskExecution int `json:"task_execution,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"` // EstimatedMaxIdleDuration is included in the response when there is no task to run. // It helps the host be smart about retries to request the next task. EstimatedMaxIdleDuration time.Duration `json:"estimated_max_idle_duration,omitempty"` }
NextTaskResponse represents the response sent back when an agent asks for a next task
type OOMTrackerInfo ¶
type ProcessTimeoutResponse ¶
type ProcessTimeoutResponse struct { Status string `json:"status"` LateProcesses interface{} `json:"late_mci_processes,omitempty"` }
Struct for reporting process timeouts
type PullRequestInfo ¶
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 { 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"` PostErrored bool `bson:"post_errored,omitempty" json:"post_errored,omitempty"` Description string `bson:"desc,omitempty" json:"desc,omitempty"` FailingCommand string `bson:"failing_command,omitempty" json:"failing_command,omitempty"` // FailureMetadataTags are user metadata tags associated with the // command that caused the task to fail. FailureMetadataTags []string `bson:"failure_metadata_tags,omitempty" json:"failure_metadata_tags,omitempty"` // OtherFailingCommands contains information about commands that failed // while the task was running but did not cause the task to fail. OtherFailingCommands []FailingCommand `bson:"other_failing_commands,omitempty" json:"other_failing_commands,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" swaggertype:"primitive,integer"` OOMTracker *OOMTrackerInfo `bson:"oom_killer,omitempty" json:"oom_killer,omitempty"` Modules ModuleCloneInfo `bson:"modules,omitempty" json:"modules,omitempty"` TraceID string `bson:"trace_id,omitempty" json:"trace_id,omitempty"` DiskDevices []string `bson:"disk_devices,omitempty" json:"disk_devices,omitempty"` }
TaskEndDetail contains data sent from the agent to the API server after each task run. This should be used to store data relating to what happened when the task ran
func (*TaskEndDetail) IsEmpty ¶
func (ted *TaskEndDetail) IsEmpty() bool
type TaskEndDetails ¶
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 TaskTestResultsInfo ¶
TaskTestResultsInfo contains metadata related to test results persisted for a given task.
type Token ¶
type Token struct {
Token string `json:"token"`
}
Token is a struct which wraps a GitHub generated token.