Documentation ¶
Index ¶
- type CommandCleanup
- type TaskConfig
- func (t *TaskConfig) AddCommandCleanup(cmd string, run func(context.Context) error)
- func (t *TaskConfig) GetAndClearCommandCleanups() []CommandCleanup
- func (t *TaskConfig) GetExecTimeout() int
- func (t *TaskConfig) GetIdleTimeout() int
- func (t *TaskConfig) SetExecTimeout(timeout int)
- func (t *TaskConfig) SetIdleTimeout(timeout int)
- func (tc *TaskConfig) TaskAttributeMap() map[string]string
- func (tc *TaskConfig) TaskAttributes() []attribute.KeyValue
- type Timeout
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandCleanup ¶
type CommandCleanup struct { // Command is the name of the command from (base).FullDisplayName(). Command string // Run is the function that is called when the task is finished. Run func(context.Context) error }
CommandCleanup is a cleanup function associated with a command. As a command block is executed, the cleanup function(s) are added to the TaskConfig. When the command block is finished, the cleanup function(s) are collected by the TaskContext and executed depending on what command block was executed. For every command cleanup, a span is created with the Command as the name.
type TaskConfig ¶
type TaskConfig struct { Distro *apimodels.DistroView ProjectRef model.ProjectRef Project model.Project Task task.Task BuildVariant model.BuildVariant // Expansions store the fundamental expansions set by Evergreen. // e.g. execution, project_id, task_id, etc. It also stores // expansions that are set by the user by expansion.update. Expansions util.Expansions // NewExpansions is a thread safe way to access Expansions. // It also exposes a way to redact expansions from logs. NewExpansions *agentutil.DynamicExpansions // DynamicExpansions holds expansions that were set from 'expansions.update' // and should persist throughout the task's execution. DynamicExpansions util.Expansions ProjectVars map[string]string Redacted []string RedactKeys []string WorkDir string TaskOutputDir *taskoutput.Directory GithubPatchData thirdparty.GithubPatch GithubMergeData thirdparty.GithubMergeGroup Timeout Timeout TaskOutput evergreen.S3Credentials TaskSync evergreen.S3Credentials EC2Keys []evergreen.EC2Key ModulePaths map[string]string CedarTestResultsID string TaskGroup *model.TaskGroup CommandCleanups []CommandCleanup MaxExecTimeoutSecs int // PatchOrVersionDescription holds the description of a patch or // message of a version to be used in the otel attributes. PatchOrVersionDescription string // contains filtered or unexported fields }
func NewTaskConfig ¶
func NewTaskConfig(workDir string, d *apimodels.DistroView, p *model.Project, t *task.Task, r *model.ProjectRef, patchDoc *patch.Patch, versionDoc *model.Version, e *apimodels.ExpansionsAndVars) (*TaskConfig, error)
NewTaskConfig validates that the required inputs are given and populates the information necessary for a task to run. It is generally preferred to use this function over initializing the TaskConfig struct manually. The patchDoc is optional and should be provided if the task is a PR or github merge queue task. It also propagates the patch description to the task config and otel attributes. If the patchDoc is nil, a versionDoc should be provided (optional as well) to get the version description for the otel attributes.
func (*TaskConfig) AddCommandCleanup ¶
func (t *TaskConfig) AddCommandCleanup(cmd string, run func(context.Context) error)
AddCommandCleanup adds a cleanup function to the TaskConfig.
func (*TaskConfig) GetAndClearCommandCleanups ¶
func (t *TaskConfig) GetAndClearCommandCleanups() []CommandCleanup
GetAndClearCommandCleanups returns the command cleanups that have been added to the TaskConfig and clears the list of command cleanups.
func (*TaskConfig) GetExecTimeout ¶
func (t *TaskConfig) GetExecTimeout() int
GetExecTimeout returns the dynamic execution timeout explicitly set by the user during task runtime (e.g. via timeout.update).
func (*TaskConfig) GetIdleTimeout ¶
func (t *TaskConfig) GetIdleTimeout() int
GetIdleTimeout returns the dynamic idle timeout explicitly set by the user during task runtime (e.g. via timeout.update).
func (*TaskConfig) SetExecTimeout ¶
func (t *TaskConfig) SetExecTimeout(timeout int)
SetIdleTimeout sets the dynamic idle timeout explicitly set by the user during task runtime (e.g. via timeout.update).
func (*TaskConfig) SetIdleTimeout ¶
func (t *TaskConfig) SetIdleTimeout(timeout int)
SetIdleTimeout sets the dynamic idle timeout explicitly set by the user during task runtime (e.g. via timeout.update).
func (*TaskConfig) TaskAttributeMap ¶
func (tc *TaskConfig) TaskAttributeMap() map[string]string
func (*TaskConfig) TaskAttributes ¶
func (tc *TaskConfig) TaskAttributes() []attribute.KeyValue
TaskAttributes returns a list of common otel attributes for tasks.