Documentation ¶
Index ¶
- Constants
- Variables
- func AbortBuild(buildId string) error
- func AbortTask(taskId string) error
- func AbortVersion(versionId string) error
- func AddNewBuildsForPatch(p *patch.Patch, patchVersion *version.Version, buildVariants []string) (*version.Version, error)
- func AddNewTasksForPatch(p *patch.Patch, patchVersion *version.Version, taskNames []string) error
- func AddTasksToBuild(b *build.Build, project *Project, v *version.Version, taskNames []string) (*build.Build, error)
- func AddUserPublicKey(userId, name, value string) error
- func AverageTaskTimeDifference(field1 string, field2 string, groupByField string, cutoff time.Time) (map[string]time.Duration, error)
- func CancelPatch(p *patch.Patch) error
- func CreateBuildFromVersion(project *Project, v *version.Version, tt TaskIdTable, buildName string, ...) (string, error)
- func DeleteBuild(id string) error
- func ExpectedTaskDuration(project, buildvariant string, window time.Duration) (map[string]time.Duration, error)
- func FinalizePatch(p *patch.Patch, settings *evergreen.Settings) (patchVersion *version.Version, err error)
- func FindLastPassingVersionForBuildVariants(project Project, buildVariantNames []string) (*version.Version, error)
- func GetNewRevisionOrderNumber(projectId string) (int, error)
- func GetOrCreateUser(userId, displayName, email string) (*user.DBUser, error)
- func GetRawTaskLogChannel(taskId string, execution int, severities []string, msgTypes []string) (chan LogMessage, error)
- func GetTaskExpectedDuration(task Task, allDurations ProjectTaskDurations) time.Duration
- func InsertNotificationRecord(...) error
- func LastNotificationsEventTime(projectName string) (time.Time, error)
- func LoadProjectInto(data []byte, identifier string, project *Project) error
- func MarkVersionCompleted(versionId string, finishTime time.Time) error
- func MarkVersionStarted(versionId string, startTime time.Time) error
- func RefreshTasksCache(buildId string) error
- func RemoveAllTasks(query interface{}) error
- func RestartBuild(buildId string, abortInProgress bool) error
- func SaveUserSettings(userId string, settings user.UserSettings) error
- func SetBuildActivation(buildId string, active bool) error
- func SetBuildPriority(buildId string, priority int) error
- func SetLastNotificationsEventTime(projectName string, timeOfEvent time.Time) error
- func SetProcessRuntimeCompleted(processName string, runtime time.Duration) error
- func SetTaskActivated(taskId string, caller string, active bool) error
- func SetTaskActivation(taskId string, active bool) error
- func SetTasksScheduledTime(tasks []Task, scheduledTime time.Time) error
- func SetUserAPIKey(userId, newKey string) error
- func SetVersionActivation(versionId string, active bool) error
- func SetVersionPriority(versionId string, priority int) error
- func TryMarkPatchBuildFinished(b *build.Build, finishTime time.Time) error
- func UntrackStaleProjectRefs(activeProjects []string) error
- func UpdateAllTasks(query interface{}, update interface{}) (*mgo.ChangeInfo, error)
- func UpdateLastRevision(projectId, revision string) error
- func UpdateMinQueuePos(taskIdToMinQueuePos map[string]int) error
- func UpdateOneNotification(query interface{}, update interface{}) error
- func UpdateOneTask(query interface{}, update interface{}) error
- func UpdateStaticHosts(e *evergreen.Settings) error
- func UpdateTaskQueue(distro string, taskQueue []TaskQueueItem) error
- func UpsertOneProcessRuntime(query interface{}, update interface{}) error
- type AlertConfig
- type ArtifactInstructions
- type BuildStatusDiff
- type BuildVariant
- type BuildVariantHistoryIterator
- type BuildVariantMatrix
- type BuildVariantTask
- type BuildVariantTaskDurations
- type Dependency
- type EmailAlertData
- type ExhaustedIterator
- type LogMessage
- type MatrixParameter
- type MatrixParameterValue
- type Module
- type NotificationHistory
- type PluginCommandConf
- type ProcessRuntime
- func FindAllLateProcessRuntimes(cutoff time.Time) ([]ProcessRuntime, error)
- func FindAllProcessRuntimes(query interface{}, projection interface{}) ([]ProcessRuntime, error)
- func FindEveryProcessRuntime() ([]ProcessRuntime, error)
- func FindOneProcessRuntime(query interface{}, projection interface{}) (*ProcessRuntime, error)
- func FindProcessRuntime(id string) (*ProcessRuntime, error)
- type Project
- func (p *Project) FindBuildVariant(build string) *BuildVariant
- func (p *Project) FindProjectTask(name string) *ProjectTask
- func (p *Project) FindTestSuite(name string) *ProjectTask
- func (p *Project) GetModuleByName(name string) (*Module, error)
- func (self *Project) GetVariantMappings() map[string]string
- func (self *Project) GetVariantsWithTask(taskName string) []string
- type ProjectNotificationTime
- type ProjectRef
- type ProjectTask
- type ProjectTaskDurations
- type ProjectVars
- type PushLog
- type Repository
- type Revision
- type StatusDetailsDiff
- type StatusDiff
- type TVPair
- type Task
- func FindAllTasks(query interface{}, projection interface{}, sort []string, skip int, limit int) ([]Task, error)
- func FindCompletedTasksByVariantAndName(project string, buildVariant string, taskName string, limit int, ...) ([]Task, error)
- func FindInProgressTasks() ([]Task, error)
- func FindOneOldTask(query interface{}, projection interface{}, sort []string) (*Task, error)
- func FindOneTask(query interface{}, projection interface{}, sort []string) (*Task, error)
- func FindTask(id string) (*Task, error)
- func FindTasks(query db.Q) ([]Task, error)
- func FindTasksByIds(ids []string) (tasks []Task, err error)
- func FindTasksForBuild(b *build.Build) ([]Task, error)
- func FindTasksForHostIds(ids []string) ([]Task, error)
- func FindTasksRunningSince(threshold time.Time) ([]Task, error)
- func FindTasksWithNoHeartbeatSince(threshold time.Time) ([]Task, error)
- func FindUndispatchedTasks() ([]Task, error)
- func NextTaskForHost(h *host.Host) (*Task, error)
- func PreviousCompletedTask(task *Task, project string, statuses []string) (*Task, error)
- func RecentlyFinishedTasks(finishTime time.Time, project string, requester string) ([]Task, error)
- func (t *Task) Abort(caller string, aborted bool) error
- func (t *Task) Abortable() bool
- func (t *Task) ActivatePreviousTask(caller string) (err error)
- func (t *Task) Archive() error
- func (t *Task) ClearResults() error
- func (task *Task) CountSimilarFailingTasks() (int, error)
- func (t *Task) DeactivatePreviousTasks(caller string) (err error)
- func (t *Task) DependenciesMet(depCaches map[string]Task) (bool, error)
- func (task *Task) FetchPatch() (*patch.Patch, error)
- func (current *Task) FindIntermediateTasks(previous *Task) ([]Task, error)
- func (task *Task) FindPreviousTasks(limit int) ([]Task, error)
- func (t *Task) FindTaskOnBaseCommit() (*Task, error)
- func (t *Task) Insert() error
- func (task Task) IsFinished() bool
- func (task Task) IsStarted() bool
- func (t *Task) MarkAsDispatched(host *host.Host, dispatchTime time.Time) error
- func (task *Task) MarkAsUndispatched(host *host.Host) error
- func (t *Task) MarkEnd(caller string, finishTime time.Time, detail *apimodels.TaskEndDetail, ...) error
- func (t *Task) MarkStart() error
- func (t *Task) MarkUnscheduled() error
- func (task *Task) SetExpectedDuration(duration time.Duration) error
- func (t *Task) SetPriority(priority int) error
- func (t *Task) SetResults(results []TestResult) error
- func (t *Task) String() (taskStruct string)
- func (t *Task) TryReset(user, origin string, p *Project, detail *apimodels.TaskEndDetail) (err error)
- func (t *Task) UpdateBuildStatus() error
- func (t *Task) UpdateHeartbeat() error
- type TaskConfig
- type TaskDependency
- type TaskDurations
- type TaskHistory
- type TaskHistoryChunk
- type TaskHistoryIterator
- type TaskIdTable
- type TaskLog
- type TaskQueue
- type TaskQueueItem
- type TaskStatusDiff
- type TestLog
- type TestResult
- type TestResults
- type TestStatusDiff
- type TestSuite
- type YAMLCommandSet
Constants ¶
const ( // if we have no data on a given task, we want to default to 1 second so we // have some new hosts spawned DefaultTaskDuration = time.Duration(1) * time.Second // for the UI, if we have no data on a given task, we want to default to // 0 time UnknownTaskDuration = time.Duration(0) // indicates the window of completed tasks we want to use in computing // average task duration. By default we use tasks that have // completed within the last 7 days TaskCompletionEstimateWindow = time.Duration(24*7) * time.Hour )
const ( AllDependencies = "*" AllVariants = "*" AllStatuses = "*" )
const ( TestCommandType = "test" SystemCommandType = "system" )
const ( PushlogCollection = "pushes" PushLogSuccess = "success" PushLogFailed = "failed" )
const ( TasksCollection = "tasks" OldTasksCollection = "old_tasks" TestLogPath = "/test_log/" )
const ( TaskLogDB = "logs" TaskLogCollection = "task_logg" MessagesPerLog = 10 )
const ( SystemLogPrefix = "S" AgentLogPrefix = "E" TaskLogPrefix = "T" LogErrorPrefix = "E" LogWarnPrefix = "W" LogDebugPrefix = "D" LogInfoPrefix = "I" )
for the different types of remote logging
const ( // DefaultCommandType is a system configuration option that is used to // differentiate between setup related commands and actual testing commands. DefaultCommandType = TestCommandType )
const (
GithubRepoType = "github"
)
const (
NotifyHistoryCollection = "notify_history"
)
const (
NotifyTimesCollection = "notify_times"
)
const (
ProjectRefCollection = "project_ref"
)
const (
ProjectVarsCollection = "project_vars"
)
const (
RepositoriesCollection = "repo_revisions"
)
const (
RuntimesCollection = "process_runtimes"
)
const (
StaleVersionCutoff = 100
)
Maximum number of versions to consider for last_green, more than 100 revisions back considered "stale"
const (
TaskQueuesCollection = "task_queues"
)
const TestLogCollection = "test_logs"
Variables ¶
var ( // bson fields for the notification history struct NHIdKey = bsonutil.MustHaveTag(NotificationHistory{}, "Id") NHPrevIdKey = bsonutil.MustHaveTag(NotificationHistory{}, "PrevNotificationId") NHCurrIdKey = bsonutil.MustHaveTag(NotificationHistory{}, "CurrNotificationId") NHNameKey = bsonutil.MustHaveTag(NotificationHistory{}, "NotificationName") NHTypeKey = bsonutil.MustHaveTag(NotificationHistory{}, "NotificationType") NHTimeKey = bsonutil.MustHaveTag(NotificationHistory{}, "NotificationTime") NHProjectKey = bsonutil.MustHaveTag(NotificationHistory{}, "NotificationProject") NHRequesterKey = bsonutil.MustHaveTag(NotificationHistory{}, "NotificationRequester") )
var ( PntProjectNameKey = bsonutil.MustHaveTag(ProjectNotificationTime{}, "ProjectName") PntLastEventTime = bsonutil.MustHaveTag(ProjectNotificationTime{}, "LastNotificationEventTime") )
var ( ProcRuntimeIdKey = bsonutil.MustHaveTag(ProcessRuntime{}, "Id") ProcRuntimeFinishedAtKey = bsonutil.MustHaveTag(ProcessRuntime{}, "FinishedAt") ProcRuntimeRuntimeKey = bsonutil.MustHaveTag(ProcessRuntime{}, "Runtime") )
var ( // bson fields for the project struct ProjectIdentifierKey = bsonutil.MustHaveTag(Project{}, "Identifier") ProjectPreKey = bsonutil.MustHaveTag(Project{}, "Pre") ProjectPostKey = bsonutil.MustHaveTag(Project{}, "Post") ProjectModulesKey = bsonutil.MustHaveTag(Project{}, "Modules") ProjectBuildVariantsKey = bsonutil.MustHaveTag(Project{}, "BuildVariants") ProjectFunctionsKey = bsonutil.MustHaveTag(Project{}, "Functions") ProjectStepbackKey = bsonutil.MustHaveTag(Project{}, "Stepback") ProjectTasksKey = bsonutil.MustHaveTag(Project{}, "Tasks") ProjectBVMatrixKey = bsonutil.MustHaveTag(Project{}, "BuildVariantMatrix") )
var ( // bson fields for the ProjectRef struct ProjectRefOwnerKey = bsonutil.MustHaveTag(ProjectRef{}, "Owner") ProjectRefRepoKey = bsonutil.MustHaveTag(ProjectRef{}, "Repo") ProjectRefBranchKey = bsonutil.MustHaveTag(ProjectRef{}, "Branch") ProjectRefRepoKindKey = bsonutil.MustHaveTag(ProjectRef{}, "RepoKind") ProjectRefEnabledKey = bsonutil.MustHaveTag(ProjectRef{}, "Enabled") ProjectRefPrivateKey = bsonutil.MustHaveTag(ProjectRef{}, "Private") ProjectRefBatchTimeKey = bsonutil.MustHaveTag(ProjectRef{}, "BatchTime") ProjectRefIdentifierKey = bsonutil.MustHaveTag(ProjectRef{}, "Identifier") ProjectRefDisplayNameKey = bsonutil.MustHaveTag(ProjectRef{}, "DisplayName") ProjectRefDeactivatePreviousKey = bsonutil.MustHaveTag(ProjectRef{}, "DeactivatePrevious") ProjectRefRemotePathKey = bsonutil.MustHaveTag(ProjectRef{}, "RemotePath") ProjectRefTrackedKey = bsonutil.MustHaveTag(ProjectRef{}, "Tracked") ProjectRefLocalConfig = bsonutil.MustHaveTag(ProjectRef{}, "LocalConfig") ProjectRefAlertsKey = bsonutil.MustHaveTag(ProjectRef{}, "Alerts") )
var ( ProjectVarIdKey = bsonutil.MustHaveTag(ProjectVars{}, "Id") ProjectVarsMapKey = bsonutil.MustHaveTag(ProjectVars{}, "Vars") )
var ( // bson fields for the push log struct PushLogIdKey = bsonutil.MustHaveTag(PushLog{}, "Id") PushLogLocationKey = bsonutil.MustHaveTag(PushLog{}, "Location") PushLogTaskIdKey = bsonutil.MustHaveTag(PushLog{}, "TaskId") PushLogCreateTimeKey = bsonutil.MustHaveTag(PushLog{}, "CreateTime") PushLogRevisionKey = bsonutil.MustHaveTag(PushLog{}, "Revision") PushLogStatusKey = bsonutil.MustHaveTag(PushLog{}, "Status") PushLogRonKey = bsonutil.MustHaveTag(PushLog{}, "RevisionOrderNumber") )
var ( // BSON fields for the Repository struct RepoProjectKey = bsonutil.MustHaveTag(Repository{}, "Project") RepoLastRevisionKey = bsonutil.MustHaveTag(Repository{}, "LastRevision") RepositoryOrderNumberKey = bsonutil.MustHaveTag(Repository{}, "RevisionOrderNumber") )
var ( ZeroTime = time.Unix(0, 0) AgentHeartbeat = "heartbeat" )
var ( // BSON fields for the task struct TaskIdKey = bsonutil.MustHaveTag(Task{}, "Id") TaskSecretKey = bsonutil.MustHaveTag(Task{}, "Secret") TaskCreateTimeKey = bsonutil.MustHaveTag(Task{}, "CreateTime") TaskDispatchTimeKey = bsonutil.MustHaveTag(Task{}, "DispatchTime") TaskPushTimeKey = bsonutil.MustHaveTag(Task{}, "PushTime") TaskScheduledTimeKey = bsonutil.MustHaveTag(Task{}, "ScheduledTime") TaskStartTimeKey = bsonutil.MustHaveTag(Task{}, "StartTime") TaskFinishTimeKey = bsonutil.MustHaveTag(Task{}, "FinishTime") TaskVersionKey = bsonutil.MustHaveTag(Task{}, "Version") TaskProjectKey = bsonutil.MustHaveTag(Task{}, "Project") TaskRevisionKey = bsonutil.MustHaveTag(Task{}, "Revision") TaskLastHeartbeatKey = bsonutil.MustHaveTag(Task{}, "LastHeartbeat") TaskActivatedKey = bsonutil.MustHaveTag(Task{}, "Activated") TaskBuildIdKey = bsonutil.MustHaveTag(Task{}, "BuildId") TaskDistroIdKey = bsonutil.MustHaveTag(Task{}, "DistroId") TaskBuildVariantKey = bsonutil.MustHaveTag(Task{}, "BuildVariant") TaskDependsOnKey = bsonutil.MustHaveTag(Task{}, "DependsOn") TaskDisplayNameKey = bsonutil.MustHaveTag(Task{}, "DisplayName") TaskHostIdKey = bsonutil.MustHaveTag(Task{}, "HostId") TaskExecutionKey = bsonutil.MustHaveTag(Task{}, "Execution") TaskRestartsKey = bsonutil.MustHaveTag(Task{}, "Restarts") TaskOldTaskIdKey = bsonutil.MustHaveTag(Task{}, "OldTaskId") TaskArchivedKey = bsonutil.MustHaveTag(Task{}, "Archived") TaskRevisionOrderNumberKey = bsonutil.MustHaveTag(Task{}, "RevisionOrderNumber") TaskRequesterKey = bsonutil.MustHaveTag(Task{}, "Requester") TaskStatusKey = bsonutil.MustHaveTag(Task{}, "Status") TaskDetailsKey = bsonutil.MustHaveTag(Task{}, "Details") TaskAbortedKey = bsonutil.MustHaveTag(Task{}, "Aborted") TaskTimeTakenKey = bsonutil.MustHaveTag(Task{}, "TimeTaken") TaskExpectedDurationKey = bsonutil.MustHaveTag(Task{}, "ExpectedDuration") TaskTestResultsKey = bsonutil.MustHaveTag(Task{}, "TestResults") TaskPriorityKey = bsonutil.MustHaveTag(Task{}, "Priority") TaskMinQueuePosKey = bsonutil.MustHaveTag(Task{}, "MinQueuePos") // BSON fields for the test result struct TestResultStatusKey = bsonutil.MustHaveTag(TestResult{}, "Status") TestResultTestFileKey = bsonutil.MustHaveTag(TestResult{}, "TestFile") TestResultURLKey = bsonutil.MustHaveTag(TestResult{}, "URL") TestResultExitCodeKey = bsonutil.MustHaveTag(TestResult{}, "ExitCode") TestResultStartTimeKey = bsonutil.MustHaveTag(TestResult{}, "StartTime") TestResultEndTimeKey = bsonutil.MustHaveTag(TestResult{}, "EndTime") )
var ( // BSON fields for task status details struct TaskEndDetailStatus = bsonutil.MustHaveTag(apimodels.TaskEndDetail{}, "Status") TaskEndDetailTimedOut = bsonutil.MustHaveTag(apimodels.TaskEndDetail{}, "TimedOut") TaskEndDetailType = bsonutil.MustHaveTag(apimodels.TaskEndDetail{}, "Type") TaskEndDetailDescription = bsonutil.MustHaveTag(apimodels.TaskEndDetail{}, "Description") )
var ( // bson fields for the task log struct TaskLogIdKey = bsonutil.MustHaveTag(TaskLog{}, "Id") TaskLogTaskIdKey = bsonutil.MustHaveTag(TaskLog{}, "TaskId") TaskLogExecutionKey = bsonutil.MustHaveTag(TaskLog{}, "Execution") TaskLogTimestampKey = bsonutil.MustHaveTag(TaskLog{}, "Timestamp") TaskLogMessageCountKey = bsonutil.MustHaveTag(TaskLog{}, "MessageCount") TaskLogMessagesKey = bsonutil.MustHaveTag(TaskLog{}, "Messages") // bson fields for the log message struct LogMessageTypeKey = bsonutil.MustHaveTag(LogMessage{}, "Type") LogMessageSeverityKey = bsonutil.MustHaveTag(LogMessage{}, "Severity") LogMessageMessageKey = bsonutil.MustHaveTag(LogMessage{}, "Message") LogMessageTimestampKey = bsonutil.MustHaveTag(LogMessage{}, "Timestamp") )
var ( // bson fields for the task queue struct TaskQueueIdKey = bsonutil.MustHaveTag(TaskQueue{}, "Id") TaskQueueDistroKey = bsonutil.MustHaveTag(TaskQueue{}, "Distro") TaskQueueQueueKey = bsonutil.MustHaveTag(TaskQueue{}, "Queue") // bson fields for the individual task queue items TaskQueueItemIdKey = bsonutil.MustHaveTag(TaskQueueItem{}, "Id") TaskQueueItemDisplayNameKey = bsonutil.MustHaveTag(TaskQueueItem{}, "DisplayName") TaskQueueItemBuildVariantKey = bsonutil.MustHaveTag(TaskQueueItem{}, "BuildVariant") TaskQueueItemConKey = bsonutil.MustHaveTag(TaskQueueItem{}, "RevisionOrderNumber") TaskQueueItemRequesterKey = bsonutil.MustHaveTag(TaskQueueItem{}, "Requester") TaskQueueItemRevisionKey = bsonutil.MustHaveTag(TaskQueueItem{}, "Revision") TaskQueueItemProjectKey = bsonutil.MustHaveTag(TaskQueueItem{}, "Project") TaskQueueItemExpDurationKey = bsonutil.MustHaveTag(TaskQueueItem{}, "ExpectedDuration") )
var ( TestLogIdKey = bsonutil.MustHaveTag(TestLog{}, "Id") TestLogNameKey = bsonutil.MustHaveTag(TestLog{}, "Name") TestLogTaskKey = bsonutil.MustHaveTag(TestLog{}, "Task") TestLogTaskExecutionKey = bsonutil.MustHaveTag(TestLog{}, "TaskExecution") TestLogLinesKey = bsonutil.MustHaveTag(TestLog{}, "Lines") )
var EarliestDateToConsider time.Time
var ( SelectorTaskInProgress = bson.M{ "$in": []string{evergreen.TaskStarted, evergreen.TaskDispatched}, } )
var (
ValidRepoTypes = []string{GithubRepoType}
)
valid repositories - currently only github supported
Functions ¶
func AbortBuild ¶
AbortBuild sets the abort flag on all tasks associated with the build which are in an abortable state, and marks the build as deactivated.
func AbortTask ¶
AbortTask sets the "abort" flag on a given task ID, if it is currently in a state which allows abort to be triggered.
func AbortVersion ¶
AbortVersion sets the abort flag on all tasks associated with the version which are in an abortable state
func AddNewBuildsForPatch ¶
func AddNewBuildsForPatch(p *patch.Patch, patchVersion *version.Version, buildVariants []string) (*version.Version, error)
Given the patch version and a list of build variants, creates new builds with the patch's tasks.
func AddNewTasksForPatch ¶
Given a patch version and a list of task names, creates a new task with the given name for each variant, if applicable.
func AddTasksToBuild ¶
func AddTasksToBuild(b *build.Build, project *Project, v *version.Version, taskNames []string) (*build.Build, error)
AddTasksToBuild creates the tasks for the given build of a project
func AddUserPublicKey ¶
AddUserPublicKey adds a public key to a user's saved key list
func AverageTaskTimeDifference ¶
func AverageTaskTimeDifference(field1 string, field2 string, groupByField string, cutoff time.Time) (map[string]time.Duration, error)
AverageTaskTimeDifference takes two field names (such that field2 happened after field1), a field to group on, and a cutoff time. It returns the average duration between fields 1 and 2, grouped by the groupBy field, including only task documents where both time fields happened after the given cutoff time. This information is returned as a map from groupBy_field -> avg_time_difference
NOTE: THIS FUNCTION DOES NOT SANITIZE INPUT! BAD THINGS CAN HAPPEN IF NON-TIME FIELDNAMES ARE PASSED IN OR IF A FIELD OF NON-STRING TYPE IS SUPPLIED FOR groupBy!
func CancelPatch ¶
func CreateBuildFromVersion ¶
func CreateBuildFromVersion(project *Project, v *version.Version, tt TaskIdTable, buildName string, activated bool, taskNames []string) (string, error)
CreateBuildFromVersion creates a build given all of the necessary information from the corresponding version and project and a list of tasks.
func DeleteBuild ¶
DeleteBuild removes any record of the build by removing it and all of the tasks that are a part of it from the database.
func ExpectedTaskDuration ¶
func ExpectedTaskDuration(project, buildvariant string, window time.Duration) (map[string]time.Duration, error)
ExpectedTaskDuration takes a given project and buildvariant and computes the average duration - grouped by task display name - for tasks that have completed within a given threshold as determined by the window
func FinalizePatch ¶
func FinalizePatch(p *patch.Patch, settings *evergreen.Settings) ( patchVersion *version.Version, err error)
Finalizes a patch: Patches a remote project's configuration file if needed. Creates a version for this patch and links it. Creates builds based on the version.
func FindLastPassingVersionForBuildVariants ¶
func FindLastPassingVersionForBuildVariants(project Project, buildVariantNames []string) (*version.Version, error)
Given a project name and a list of build variants, return the latest version on which all the given build variants succeeded. Gives up after 100 versions.
func GetNewRevisionOrderNumber ¶
GetNewRevisionOrderNumber gets a new revision order number for a project.
func GetOrCreateUser ¶
GetOrCreateUser fetches a user with the given userId and returns it. If no document exists for that userId, inserts it along with the provided display name and email.
func GetRawTaskLogChannel ¶
func GetTaskExpectedDuration ¶
func GetTaskExpectedDuration(task Task, allDurations ProjectTaskDurations) time.Duration
GetTaskExpectedDuration returns the expected duration for a given task if the task does not exist, it returns model.DefaultTaskDuration
func LoadProjectInto ¶
LoadProjectInto loads the raw data from the config file into project and sets the project's identifier field to identifier
func MarkVersionCompleted ¶
MarkVersionCompleted updates the status of a completed version to reflect its correct state by checking the status of its individual builds.
func RefreshTasksCache ¶
RefreshTasksCache updates a build document so that the tasks cache reflects the correct current state of the tasks it represents.
func RemoveAllTasks ¶
func RemoveAllTasks(query interface{}) error
func RestartBuild ¶
RestartBuild restarts completed tasks associated with a given buildId. If abortInProgress is true, it also sets the abort flag on any in-progress tasks.
func SaveUserSettings ¶
func SaveUserSettings(userId string, settings user.UserSettings) error
SaveUserSettings updates the settings stored for the given user id.
func SetBuildActivation ¶
SetBuildActivation updates the "active" state of this build and all associated tasks. It also updates the task cache for the build document.
func SetBuildPriority ¶
SetBuildPriority updates the priority field of all tasks associated with the given build id.
func SetLastNotificationsEventTime ¶
Record the last-notification time for a given project.
func SetProcessRuntimeCompleted ¶
Updates a process runtime to set recent_success to the current time. If no process with the given name exists, create it. Parameter "processName" should be a constant "mci package" name from globals.go
func SetTaskActivation ¶
SetTaskActivation updates the task's active state to the given value. Does not update the task cache for the associated build, so this may need to be done separately after this function is called.
func SetTasksScheduledTime ¶
SetTasksScheduledTime takes a list of tasks and a time, and then sets the scheduled time in the database for the tasks if it is currently unset
func SetUserAPIKey ¶
SetUserAPIKey updates the API key stored with a user.
func SetVersionActivation ¶
SetVersionActivation updates the "active" state of all builds and tasks associated with a version to the given setting. It also updates the task cache for all builds affected.
func SetVersionPriority ¶
SetVersionPriority updates the priority field of all tasks associated with the given build id.
func TryMarkPatchBuildFinished ¶
TryMarkPatchBuildFinished attempts to mark a patch as finished if all the builds for the patch are finished as well
func UntrackStaleProjectRefs ¶
UntrackStaleProjectRefs sets all project_refs in the db not in the array of project identifiers to "untracked."
func UpdateAllTasks ¶
func UpdateAllTasks(query interface{}, update interface{}) (*mgo.ChangeInfo, error)
func UpdateLastRevision ¶
UpdateLastRevision updates the last created revision of a project.
func UpdateMinQueuePos ¶
UpdateMinQueuePos takes a taskId-to-MinQueuePosition map and updates the min_queue_pos field in each specified task to the specified MinQueuePos
func UpdateOneNotification ¶
func UpdateOneNotification(query interface{}, update interface{}) error
func UpdateOneTask ¶
func UpdateOneTask(query interface{}, update interface{}) error
func UpdateStaticHosts ¶
func UpdateTaskQueue ¶
func UpdateTaskQueue(distro string, taskQueue []TaskQueueItem) error
func UpsertOneProcessRuntime ¶
func UpsertOneProcessRuntime(query interface{}, update interface{}) error
Types ¶
type AlertConfig ¶
type AlertConfig struct { Provider string `bson:"provider" json:"provider"` //e.g. e-mail, flowdock, SMS // Data contains provider-specific on how a notification should be delivered. // Typed as bson.M so that the appropriate provider can parse out necessary details Settings bson.M `bson:"settings" json:"settings"` }
type ArtifactInstructions ¶
type BuildStatusDiff ¶
type BuildStatusDiff struct { Name string `json:"name"` Diff StatusDiff `json:"diff"` Tasks []TaskStatusDiff `json:"tasks"` }
BuildStatusDiff stores a diff of two build statuses.
func StatusDiffBuilds ¶
func StatusDiffBuilds(original, patch *build.Build) BuildStatusDiff
StatusDiffBuilds takes two builds and returns a diff of their results for easy comparison and analysis.
type BuildVariant ¶
type BuildVariant struct { Name string `yaml:"name" bson:"name"` DisplayName string `yaml:"display_name" bson:"display_name"` Expansions map[string]string `yaml:"expansions" bson:"expansions"` Modules []string `yaml:"modules" bson:"modules"` Disabled bool `yaml:"disabled" bson:"disabled"` Push bool `yaml:"push" bson:"push"` // Use a *int for 2 possible states // nil - not overriding the project setting // non-nil - overriding the project setting with this BatchTime BatchTime *int `yaml:"batchtime,omitempty" bson:"batchtime,omitempty"` // Use a *bool so that there are 3 possible states: // 1. nil = not overriding the project setting (default) // 2. true = overriding the project setting with true // 3. false = overriding the project setting with false Stepback *bool `yaml:"stepback,omitempty" bson:"stepback,omitempty"` // the default distros. will be used to run a task if no distro field is // provided for the task RunOn []string `yaml:"run_on" bson:"run_on"` // all of the tasks to be run on the build variant, compile through tests. Tasks []BuildVariantTask `yaml:"tasks" bson:"tasks"` MatrixParameterValues map[string]string `yaml:"matrix_parameter_values" bson:"matrix_parameter_values"` }
type BuildVariantHistoryIterator ¶
type BuildVariantHistoryIterator interface {
GetItems(beforeCommit *version.Version, numCommits int) ([]bson.M, []version.Version, error)
}
Interface around getting task and version history for a given build variant in a given project.
func NewBuildVariantHistoryIterator ¶
func NewBuildVariantHistoryIterator(buildVariantInTask string, buildVariantInVersion string, projectName string) BuildVariantHistoryIterator
Since version currently uses build variant display name and task uses build variant name, we need both.
type BuildVariantMatrix ¶
type BuildVariantMatrix struct { MatrixParameters []MatrixParameter `yaml:"matrix_parameters" bson:"matrix_parameters"` Template BuildVariant `yaml:"template" bson:"template"` }
type BuildVariantTask ¶
type BuildVariantTask struct { // this name HAS to match the name field of one of the tasks specified at // the project level, or an error will be thrown Name string `yaml:"name" bson:"name"` // the distros that the task can be run on Distros []string `yaml:"distros" bson:"distros"` }
Unmarshalled from the "tasks" list in an individual build variant
type BuildVariantTaskDurations ¶
type BuildVariantTaskDurations struct {
TaskDurationByBuildVariant map[string]*TaskDurations
}
BuildVariantTaskDurations maintains a mapping between a buildvariant and its accompanying TaskDurations
type Dependency ¶
type Dependency struct { TaskId string `bson:"_id" json:"id"` Status string `bson:"status" json:"status"` }
Dependency represents a task that must be completed before the owning task can be scheduled.
type EmailAlertData ¶
type EmailAlertData struct {
Recipients []string `bson:"recipients"`
}
type ExhaustedIterator ¶
type ExhaustedIterator struct {
Before, After bool
}
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"` }
func FindMostRecentLogMessages ¶
func FindMostRecentLogMessages(taskId string, execution int, numMsgs int, severities []string, msgTypes []string) ([]LogMessage, error)
note: to ignore severity or type filtering, pass in empty slices
type MatrixParameter ¶
type MatrixParameter struct { Name string `yaml:"name" bson:"name"` Values []MatrixParameterValue `yaml:"values" bson:"values"` }
type MatrixParameterValue ¶
type Module ¶
type Module struct { Name string `yaml:"name" bson:"name"` Branch string `yaml:"branch" bson:"branch"` Repo string `yaml:"repo" bson:"repo"` Prefix string `yaml:"prefix" bson:"prefix"` }
func (*Module) GetRepoOwnerAndName ¶
type NotificationHistory ¶
type NotificationHistory struct { Id bson.ObjectId `bson:"_id,omitempty"` PrevNotificationId string `bson:"p_nid"` CurrNotificationId string `bson:"c_nid"` NotificationName string `bson:"n_name"` NotificationType string `bson:"n_type"` NotificationTime time.Time `bson:"n_time"` NotificationProject string `bson:"n_branch"` NotificationRequester string `bson:"n_requester"` }
func FindNotificationRecord ¶
func FindNotificationRecord(notificationId, notificationName, notificationType, notificationProject, notificationRequester string) (*NotificationHistory, error)
func FindOneNotification ¶
func FindOneNotification(query interface{}, projection interface{}) (*NotificationHistory, error)
func (*NotificationHistory) Insert ¶
func (self *NotificationHistory) Insert() error
type PluginCommandConf ¶
type PluginCommandConf struct { Function string `yaml:"func" bson:"func"` // Type is used to differentiate between setup related commands and actual // testing commands. Type string `yaml:"type" bson:"type"` // DisplayName is a human readable description of the function of a given // command. DisplayName string `yaml:"display_name" bson:"display_name"` // Command is a unique identifier for the command configuration. It consists of a // plugin name and a command name. Command string `yaml:"command" bson:"command"` // Variants is used to enumerate the particular sets of buildvariants to run // this command configuration on. If it is empty, it is run on all defined // variants. Variants []string `yaml:"variants" bson:"variants"` // TimeoutSecs indicates the maximum duration the command is allowed to run // for. If undefined, it is unbounded. TimeoutSecs int `yaml:"timeout_secs" bson:"timeout_secs"` // Params are used to supply configuratiion specific information. Params map[string]interface{} `yaml:"params" bson:"params"` // Vars defines variables that can be used within commands. Vars map[string]string `yaml:"vars" bson:"vars"` }
func (PluginCommandConf) GetDisplayName ¶
func (p PluginCommandConf) GetDisplayName() string
GetDisplayName returns the display name of the plugin command. If none is defined, it returns the command's identifier.
func (PluginCommandConf) GetType ¶
func (p PluginCommandConf) GetType(prj *Project) string
GetType returns the type of this command if one is explicitly specified. If no type is specified, it checks the default command type of the project. If one is specified, it returns that, if not, it returns the DefaultCommandType.
func (PluginCommandConf) RunOnVariant ¶
func (p PluginCommandConf) RunOnVariant(variant string) bool
RunOnVariant returns true if the plugin command should run on variant; returns false otherwise
type ProcessRuntime ¶
type ProcessRuntime struct { Id string `bson:"_id" json:"id"` FinishedAt time.Time `bson:"finished_at" json:"finished_at"` Runtime time.Duration `bson:"runtime" json:"runtime"` }
ProcessRuntime tracks the most recent success ping by a given MCI process by storing it in mongodb. Id is a package name (see globals.go), FinishedAt is a time representing the most recent completion of that process, and Runtime is the duration of time the process took to run
func FindAllLateProcessRuntimes ¶
func FindAllLateProcessRuntimes(cutoff time.Time) ([]ProcessRuntime, error)
Finds all runtimes that were updated before (less than) given time.
func FindAllProcessRuntimes ¶
func FindAllProcessRuntimes(query interface{}, projection interface{}) ([]ProcessRuntime, error)
func FindEveryProcessRuntime ¶
func FindEveryProcessRuntime() ([]ProcessRuntime, error)
Returns list of all process runtime entries
func FindOneProcessRuntime ¶
func FindOneProcessRuntime(query interface{}, projection interface{}) (*ProcessRuntime, error)
func FindProcessRuntime ¶
func FindProcessRuntime(id string) (*ProcessRuntime, error)
Finds a process runtime by Id
type Project ¶
type Project struct { Enabled bool `yaml:"enabled" bson:"enabled"` Stepback bool `yaml:"stepback" bson:"stepback"` BatchTime int `yaml:"batchtime" bson:"batch_time"` Owner string `yaml:"owner" bson:"owner_name"` Repo string `yaml:"repo" bson:"repo_name"` RemotePath string `yaml:"remote_path" bson:"remote_path"` RepoKind string `yaml:"repokind" bson:"repo_kind"` Branch string `yaml:"branch" bson:"branch_name"` Identifier string `yaml:"identifier" bson:"identifier"` DisplayName string `yaml:"display_name" bson:"display_name"` CommandType string `yaml:"command_type" bson:"command_type"` Pre *YAMLCommandSet `yaml:"pre" bson:"pre"` Post *YAMLCommandSet `yaml:"post" bson:"post"` Timeout *YAMLCommandSet `yaml:"timeout" bson:"timeout"` Modules []Module `yaml:"modules" bson:"modules"` BuildVariants []BuildVariant `yaml:"buildvariants" bson:"build_variants"` Functions map[string]*YAMLCommandSet `yaml:"functions" bson:"functions"` Tasks []ProjectTask `yaml:"tasks" bson:"tasks"` BuildVariantMatrix BuildVariantMatrix `yaml:"build_variant_matrix" bson:"build_variant_matrix"` // Flag that indicates a project as requiring user authentication Private bool `yaml:"private" bson:"private"` }
func FindProject ¶
func FindProject(revision string, projectRef *ProjectRef) (*Project, error)
func MakePatchedConfig ¶
MakePatchedConfig takes in the path to a remote configuration a stringified version of the current project and returns an unmarshalled version of the project with the patch applied
func (*Project) FindBuildVariant ¶
func (p *Project) FindBuildVariant(build string) *BuildVariant
func (*Project) FindProjectTask ¶
func (p *Project) FindProjectTask(name string) *ProjectTask
func (*Project) FindTestSuite ¶
func (p *Project) FindTestSuite(name string) *ProjectTask
func (*Project) GetVariantMappings ¶
func (*Project) GetVariantsWithTask ¶
type ProjectNotificationTime ¶
type ProjectRef ¶
type ProjectRef struct { Owner string `bson:"owner_name" json:"owner_name" yaml:"owner"` Repo string `bson:"repo_name" json:"repo_name" yaml:"repo"` Branch string `bson:"branch_name" json:"branch_name" yaml:"branch"` RepoKind string `bson:"repo_kind" json:"repo_kind" yaml:"repokind"` Enabled bool `bson:"enabled" json:"enabled" yaml:"enabled"` Private bool `bson:"private" json:"private" yaml:"private"` BatchTime int `bson:"batch_time" json:"batch_time" yaml:"batchtime"` RemotePath string `bson:"remote_path" json:"remote_path" yaml:"remote_path"` Identifier string `bson:"identifier" json:"identifier" yaml:"identifier"` DisplayName string `bson:"display_name" json:"display_name" yaml:"display_name"` LocalConfig string `bson:"local_config" json:"local_config" yaml:"local_config"` DeactivatePrevious bool `bson:"deactivate_previous" json:"deactivate_previous" yaml:"deactivate_previous"` //Tracked determines whether or not the project is discoverable in the UI Tracked bool `bson:"tracked" json:"tracked"` // The "Alerts" field is a map of trigger (e.g. 'task-failed') to // the set of alert deliveries to be processed for that trigger. Alerts map[string][]AlertConfig `bson:"alert_settings" json:"alert_config"` }
The ProjectRef struct contains general information, independent of any revision control system, needed to track a given project
func FindAllProjectRefs ¶
func FindAllProjectRefs() ([]ProjectRef, error)
FindAllProjectRefs returns all project refs in the db
func FindAllTrackedProjectRefs ¶
func FindAllTrackedProjectRefs() ([]ProjectRef, error)
FindAllTrackedProjectRefs returns all project refs in the db that are currently being tracked (i.e. their project files still exist)
func FindOneProjectRef ¶
func FindOneProjectRef(identifier string) (*ProjectRef, error)
FindOneProjectRef gets a project ref given the owner name, the repo name and the project name
func (*ProjectRef) GetBatchTime ¶
func (p *ProjectRef) GetBatchTime(variant *BuildVariant) int
GetBatchTime returns the Batch Time of the ProjectRef
func (*ProjectRef) Insert ¶
func (projectRef *ProjectRef) Insert() error
func (*ProjectRef) Location ¶
func (projectRef *ProjectRef) Location() (string, error)
Location generates and returns the ssh hostname and path to the repo.
func (*ProjectRef) String ¶
func (projectRef *ProjectRef) String() string
ProjectRef returns a string representation of a ProjectRef
func (*ProjectRef) Upsert ¶
func (projectRef *ProjectRef) Upsert() error
Upsert updates the project ref in the db if an entry already exists, overwriting the existing ref. If no project ref exists, one is created
type ProjectTask ¶
type ProjectTask struct { Name string `yaml:"name" bson:"name"` ExecTimeout int `yaml:"exec_timeout" bson:"exec_timeout"` DependsOn []TaskDependency `yaml:"depends_on" bson:"depends_on"` Commands []PluginCommandConf `yaml:"commands" bson:"commands"` // Use a *bool so that there are 3 possible states: // 1. nil = not overriding the project setting (default) // 2. true = overriding the project setting with true // 3. false = overriding the project setting with false Stepback *bool `yaml:"stepback,omitempty" bson:"stepback,omitempty"` }
Unmarshalled from the "tasks" list in the project file
type ProjectTaskDurations ¶
type ProjectTaskDurations struct {
TaskDurationByProject map[string]*BuildVariantTaskDurations
}
ProjectTaskDurations maintans a mapping of a given project's name and its accompanying BuildVariantTaskDurations
type ProjectVars ¶
type ProjectVars struct { //Should match the _id in the project it refers to Id string `bson:"_id" json:"_id"` //The actual mapping of variables for this project Vars map[string]string `bson:"vars" json:"vars"` }
ProjectVars holds a map of variables specific to a given project. They can be fetched at run time by the agent, so that settings which are sensitive or subject to frequent change don't need to be hard-coded into yml files.
func FindOneProjectVars ¶
func FindOneProjectVars(projectId string) (*ProjectVars, error)
func (*ProjectVars) Upsert ¶
func (projectVars *ProjectVars) Upsert() (*mgo.ChangeInfo, error)
type PushLog ¶
type PushLog struct { Id bson.ObjectId `bson:"_id,omitempty"` //the permanent location of the pushed file. Location string `bson:"location"` //the task id of the push stage TaskId string `bson:"task_id"` CreateTime time.Time `bson:"create_time"` Revision string `bson:"githash"` Status string `bson:"status"` //copied from version for the task RevisionOrderNumber int `bson:"order"` }
func FindOnePushLog ¶
func FindPushLogAfter ¶
FindNewerPushLog returns a PushLog item if there is a file pushed from this version or a newer one, or one already in progress.
func (*PushLog) UpdateStatus ¶
type Repository ¶
type Repository struct { Project string `bson:"_id"` LastRevision string `bson:"last_revision"` RevisionOrderNumber int `bson:"last_commit_number"` }
Repository contains fields used to track projects.
func FindRepository ¶
func FindRepository(projectId string) (*Repository, error)
FindRepository gets the repository object of a project.
type StatusDetailsDiff ¶
type StatusDetailsDiff struct { Original apimodels.TaskEndDetail `json:"original"` Patch apimodels.TaskEndDetail `json:"patch"` }
StatusDetailsDiff stores a pairing of status details for easy visualization/aggregation later.
type StatusDiff ¶
StatusDiff stores a pairing of status strings for easy visualization/aggregation later.
type Task ¶
type Task struct { Id string `bson:"_id" json:"id"` Secret string `bson:"secret" json:"secret"` // time information for task // create - the time we created this task in our database // dispatch - it has been run to start on a remote host // push - the time the commit generating this build was pushed to the remote // start - the time the remote host it was scheduled on responded as // successfully started // finish - the time the task was completed on the remote host CreateTime time.Time `bson:"create_time" json:"create_time"` DispatchTime time.Time `bson:"dispatch_time" json:"dispatch_time"` PushTime time.Time `bson:"push_time" json:"push_time"` ScheduledTime time.Time `bson:"scheduled_time" json:"scheduled_time"` StartTime time.Time `bson:"start_time" json:"start_time"` FinishTime time.Time `bson:"finish_time" json:"finish_time"` Version string `bson:"version" json:"version,omitempty"` Project string `bson:"branch" json:"branch,omitempty"` Revision string `bson:"gitspec" json:"gitspec"` Priority int `bson:"priority" json:"priority"` // only relevant if the task is running. the time of the last heartbeat // sent back by the agent LastHeartbeat time.Time `bson:"last_heartbeat"` // used to indicate whether task should be scheduled to run Activated bool `bson:"activated" json:"activated"` BuildId string `bson:"build_id" json:"build_id"` DistroId string `bson:"distro" json:"distro"` BuildVariant string `bson:"build_variant" json:"build_variant"` DependsOn []Dependency `bson:"depends_on" json:"depends_on"` // Human-readable name DisplayName string `bson:"display_name" json:"display_name"` // The host the task was run on HostId string `bson:"host_id" json:"host_id"` // the number of times this task has been restarted Restarts int `bson:"restarts" json:"restarts",omitempty` Execution int `bson:"execution" json:"execution"` OldTaskId string `bson:"old_task_id,omitempty" json:"old_task_id",omitempty` Archived bool `bson:"archived,omitempty" json:"archived",omitempty` RevisionOrderNumber int `bson:"order,omitempty" json:"order,omitempty"` // task requester - this is used to help tell the // reason this task was created. e.g. it could be // because the repotracker requested it (via tracking the // repository) or it was triggered by a developer // patch request Requester string `bson:"r" json:"r"` // this represents the various stages the task could be in Status string `bson:"status" json:"status"` Details apimodels.TaskEndDetail `bson:"details" json:"task_end_details"` Aborted bool `bson:"abort,omitempty" json:"abort"` // how long the task took to execute. meaningless if the task is not finished TimeTaken time.Duration `bson:"time_taken" json:"time_taken"` // how long we expect the task to take from start to finish ExpectedDuration time.Duration `bson:"expected_duration,omitempty" json:"expected_duration,omitempty"` // test results captured and sent back by agent TestResults []TestResult `bson:"test_results" json:"test_results"` // position in queue for the queue where it's closest to the top MinQueuePos int `bson:"min_queue_pos" json:"min_queue_pos,omitempty"` }
func FindAllTasks ¶
func FindCompletedTasksByVariantAndName ¶
func FindCompletedTasksByVariantAndName(project string, buildVariant string, taskName string, limit int, beforeTaskId string) ([]Task, error)
Get history of tasks for a given build variant, project, and display name.
func FindInProgressTasks ¶
func FindOneOldTask ¶
func FindOneTask ¶
func FindTasksByIds ¶
func FindTasksForHostIds ¶
Given a list of host ids, return the tasks that finished running on these hosts. For memory usage, projection only returns each task's host id
func FindTasksRunningSince ¶
find any tasks that are currently in progress and have been running since at least the specified threshold
func FindTasksWithNoHeartbeatSince ¶
find any running tasks whose last heartbeat was at least the specified threshold ago
func FindUndispatchedTasks ¶
func NextTaskForHost ¶
NextTaskForHost the next task that should be run on the host.
func PreviousCompletedTask ¶
Find the previously completed task for the same requester + project + build variant + display name combination as the specified task
func RecentlyFinishedTasks ¶
func (*Task) ActivatePreviousTask ¶
func (*Task) ClearResults ¶
func (*Task) CountSimilarFailingTasks ¶
CountSimilarFailingTasks returns a count of all tasks with the same project, same display name, and in other buildvariants, that have failed in the same revision
func (*Task) DeactivatePreviousTasks ¶
Deactivate any previously activated but undispatched tasks for the same build variant + display name + project combination as the task.
func (*Task) DependenciesMet ¶
Checks whether the dependencies for the task have all completed successfully. If any of the dependencies exist in the map that is passed in, they are used to check rather than fetching from the database. All queries are cached back into the map for later use.
func (*Task) FindIntermediateTasks ¶
func (*Task) FindTaskOnBaseCommit ¶
func (*Task) Insert ¶
Inserts the task into the tasks collection, and logs an event that the task was created.
func (Task) IsFinished ¶
func (*Task) MarkAsDispatched ¶
Mark that the task has been dispatched onto a particular host. Sets the running task field on the host and the host id field on the task, as well as updating the cache for the task in its build document in the db. Returns an error if any of the database updates fail.
func (*Task) MarkAsUndispatched ¶
MarkAsUndispatched marks that the task has been undispatched from a particular host. Unsets the running task field on the host and the host id field on the task, as well as updating the cache for the task in its build document in the db. Returns an error if any of the database updates fail.
func (*Task) MarkUnscheduled ¶
func (*Task) SetExpectedDuration ¶
SetExpectedDuration updates the expected duration field for the task
func (*Task) SetPriority ¶
func (*Task) SetResults ¶
func (t *Task) SetResults(results []TestResult) error
func (*Task) UpdateBuildStatus ¶
func (*Task) UpdateHeartbeat ¶
type TaskConfig ¶
type TaskConfig struct { Distro *distro.Distro ProjectRef *ProjectRef Project *Project Task *Task BuildVariant *BuildVariant Expansions *command.Expansions WorkDir string }
func NewTaskConfig ¶
func NewTaskConfig(d *distro.Distro, p *Project, t *Task, r *ProjectRef) (*TaskConfig, error)
type TaskDependency ¶
type TaskDependency struct { Name string `yaml:"name" bson:"name"` Variant string `yaml:"variant" bson:"variant,omitempty"` Status string `yaml:"status" bson:"status,omitempty"` }
The information about a task's dependency
type TaskDurations ¶
TaskDurations maintains a mapping between a given task (by display name) and its accompanying aggregate expected duration
type TaskHistory ¶
type TaskHistoryChunk ¶
type TaskHistoryChunk struct { Tasks []bson.M Versions []version.Version FailedTests map[string][]TestResult Exhausted ExhaustedIterator }
type TaskHistoryIterator ¶
type TaskHistoryIterator interface { GetChunk(version *version.Version, numBefore, numAfter int, include bool) (TaskHistoryChunk, error) GetDistinctTestNames(numCommits int) ([]string, error) }
func NewTaskHistoryIterator ¶
func NewTaskHistoryIterator(name string, buildVariants []string, projectName string) TaskHistoryIterator
type TaskIdTable ¶
TaskIdTable is a map of [variant, task display name]->[task id].
func BuildTaskIdTable ¶
func BuildTaskIdTable(p *Project, v *version.Version) TaskIdTable
TaskIdTable builds a TaskIdTable for the given version and project
func (TaskIdTable) AddId ¶
func (tt TaskIdTable) AddId(variant, taskName, id string)
AddId adds the Id for the task/variant combination to the table.
func (TaskIdTable) GetId ¶
func (tt TaskIdTable) GetId(variant, taskName string) string
GetId returns the Id for the given task on the given variant. Returns the empty string if the task/variant does not exist.
func (TaskIdTable) GetIdsForAllTasks ¶
func (tt TaskIdTable) GetIdsForAllTasks(currentVariant, taskName string) []string
GetIdsForTasks returns all task Ids for tasks on all variants != the current task. The current variant and task must be passed in to avoid cycle generation.
func (TaskIdTable) GetIdsForAllVariants ¶
func (tt TaskIdTable) GetIdsForAllVariants(currentVariant, taskName string) []string
GetIdsForAllVariants returns all task Ids for taskName on all variants != currentVariant. The current variant must be passed in to avoid cycle generation.
type TaskLog ¶
type TaskLog struct { Id bson.ObjectId `bson:"_id,omitempty" json:"_id,omitempty"` TaskId string `bson:"t_id" json:"t_id"` Execution int `bson:"e" json:"e"` Timestamp time.Time `bson:"ts" json:"ts"` MessageCount int `bson:"c" json:"c"` Messages []LogMessage `bson:"m" json:"m"` }
a single chunk of a task log
func FindMostRecentTaskLogs ¶
func FindTaskLogsBeforeTime ¶
func (*TaskLog) AddLogMessage ¶
func (self *TaskLog) AddLogMessage(msg LogMessage) error
type TaskQueue ¶
type TaskQueue struct { Id bson.ObjectId `bson:"_id,omitempty" json:"_id"` Distro string `bson:"distro" json:"distro"` Queue []TaskQueueItem `bson:"queue" json:"queue"` }
represents the next n tasks to be run on hosts of the distro
func FindAllTaskQueues ¶
func FindTaskQueueForDistro ¶
func (*TaskQueue) DequeueTask ¶
pull out the task with the specified id from both the in-memory and db versions of the task queue
func (*TaskQueue) NextTask ¶
func (self *TaskQueue) NextTask() TaskQueueItem
type TaskQueueItem ¶
type TaskQueueItem struct { Id string `bson:"_id" json:"_id"` DisplayName string `bson:"display_name" json:"display_name"` BuildVariant string `bson:"build_variant" json:"build_variant"` RevisionOrderNumber int `bson:"order" json:"order"` Requester string `bson:"requester" json:"requester"` Revision string `bson:"gitspec" json:"gitspec"` Project string `bson:"project" json:"project"` ExpectedDuration time.Duration `bson:"exp_dur" json:"exp_dur"` }
type TaskStatusDiff ¶
type TaskStatusDiff struct { Name string `json:"name"` Diff StatusDetailsDiff `json:"diff"` Tests []TestStatusDiff `json:"tests"` Original string `json:"original"` Patch string `json:"patch"` BuildVariant string `json:"build_variant"` }
TaskStatusDiff stores a diff of two task statuses.
func StatusDiffTasks ¶
func StatusDiffTasks(original *Task, patch *Task) TaskStatusDiff
StatusDiffTasks takes two tasks and returns a diff of their results for easy comparison and analysis.
type TestLog ¶
type TestLog struct { Id string `bson:"_id" json:"_id"` Name string `json:"name" bson:"name"` Task string `json:"task" bson:"task"` TaskExecution int `json:"execution" bson:"execution"` Lines []string `json:"lines" bson:"lines"` }
func FindOneTestLog ¶
FindOneTestLog returns a TestLog, given the test's name, task id, and execution.
func FindOneTestLogById ¶
type TestResult ¶
type TestResult struct { Status string `json:"status" bson:"status"` TestFile string `json:"test_file" bson:"test_file"` URL string `json:"url" bson:"url,omitempty"` LogId string `json:"log_id,omitempty" bson:"log_id,omitempty"` LineNum int `json:"line_num,omitempty" bson:"line_num,omitempty"` ExitCode int `json:"exit_code" bson:"exit_code"` StartTime float64 `json:"start" bson:"start"` EndTime float64 `json:"end" bson:"end"` }
type TestResults ¶
type TestResults struct {
Results []TestResult `json:"results"`
}
TestResults is only used when transferring data from agent to api.
type TestStatusDiff ¶
type TestStatusDiff struct { Name string `json:"name"` Diff StatusDiff `json:"diff"` Original string `json:"original"` Patch string `json:"patch"` }
TestStatusDiff stores a diff of two test results.
type YAMLCommandSet ¶
type YAMLCommandSet struct { SingleCommand *PluginCommandConf MultiCommand []PluginCommandConf }
func (*YAMLCommandSet) List ¶
func (c *YAMLCommandSet) List() []PluginCommandConf
func (*YAMLCommandSet) MarshalYAML ¶
func (c *YAMLCommandSet) MarshalYAML() (interface{}, error)
func (*YAMLCommandSet) UnmarshalYAML ¶
func (c *YAMLCommandSet) UnmarshalYAML(unmarshal func(interface{}) error) error
Source Files ¶
- build_variant_history.go
- expected_task_durations.go
- host_manipulation.go
- lifecycle.go
- notify_history.go
- notify_times.go
- patch_lifecycle.go
- process_runtime.go
- project.go
- project_ref.go
- project_vars.go
- push.go
- repository.go
- status_diff.go
- task.go
- task_history.go
- task_log.go
- task_queue.go
- test_log.go
- user_lifecycle.go
- version_history.go