model

package
v0.0.0-...-418c65a Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2019 License: Apache-2.0 Imports: 55 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AllDependencies = "*"
	AllVariants     = "*"
	AllStatuses     = "*"
)
View Source
const (
	EvergreenLogSender = "evergreen"
	FileLogSender      = "file"
	LogkeeperLogSender = "logkeeper"
	SplunkLogSender    = "splunk"
)
View Source
const (
	EventResourceTypeProject = "PROJECT"
	EventTypeProjectModified = "PROJECT_MODIFIED"
	EventTypeProjectAdded    = "PROJECT_ADDED"
)
View Source
const (
	ProjectRefCollection     = "project_ref"
	ProjectTriggerLevelTask  = "task"
	ProjectTriggerLevelBuild = "build"
)
View Source
const (
	SelectAll             = "*"
	InvalidCriterionRunes = "!."
)
View Source
const (
	ProjectVarsCollection = "project_vars"
	ProjectAWSSSHKeyName  = "__project_aws_ssh_key_name"
	ProjectAWSSSHKeyValue = "__project_aws_ssh_key_value"
)
View Source
const (
	PushlogCollection = "pushes"
	PushLogSuccess    = "success"
	PushLogFailed     = "failed"
)
View Source
const (
	TaskTimeout       = "timeout"
	TaskSystemFailure = "sysfail"
	TaskSetupFailure  = "setup-fail"
)
View Source
const (
	TaskLogDB         = "logs"
	TaskLogCollection = "task_logg"
	MessagesPerLog    = 10
)
View Source
const (
	TaskQueuesCollection      = "task_queues"
	TaskAliasQueuesCollection = "task_alias_queues"
)
View Source
const (
	ApiTaskKey       apiTaskKey       = 0
	ApiHostKey       apiHostKey       = 0
	ApiProjectKey    apiProjectKey    = 0
	ApiProjectRefKey apiProjectRefKey = 0
)
View Source
const (
	// DefaultCommandType is a system configuration option that is used to
	// differentiate between setup related commands and actual testing commands.
	DefaultCommandType = evergreen.CommandTypeTest
)
View Source
const FeedbackCollection = "feedback"
View Source
const (
	GithubHooksCollection = "github_hooks"
)
View Source
const (
	GithubRepoType = "github"
)
View Source
const KeyValCollection = "keyval_plugin"
View Source
const LoadProjectError = "load project error(s)"
View Source
const NotesCollection = "build_baron_notes"
View Source
const (
	NotifyHistoryCollection = "notify_history"
)
View Source
const (
	NotifyTimesCollection = "notify_times"
)
View Source
const (
	ProjectAliasCollection = "project_aliases"
)
View Source
const (
	RepositoriesCollection = "repo_revisions"
)
View Source
const (
	RuntimesCollection = "process_runtimes"
)
View Source
const (
	StaleVersionCutoff = 100
)

Maximum number of versions to consider for last_green, more than 100 revisions back considered "stale"

View Source
const (
	TaskJSONCollection = "json"
)
View Source
const TestLogCollection = "test_logs"
View Source
const (
	VersionCollection = "versions"
)

Variables

View Source
var (
	StuckHostKey            = bsonutil.MustHaveTag(StuckHostInconsistency{}, "Host")
	StuckHostRunningTaskKey = bsonutil.MustHaveTag(StuckHostInconsistency{}, "RunningTask")
	StuckHostTaskStatusKey  = bsonutil.MustHaveTag(StuckHostInconsistency{}, "TaskStatus")
	HostTaskKey             = "task"
)
View Source
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")
)
View Source
var (
	PntProjectNameKey = bsonutil.MustHaveTag(ProjectNotificationTime{},
		"ProjectName")
	PntLastEventTime = bsonutil.MustHaveTag(ProjectNotificationTime{},
		"LastNotificationEventTime")
)
View Source
var (
	ProcRuntimeIdKey         = bsonutil.MustHaveTag(ProcessRuntime{}, "Id")
	ProcRuntimeFinishedAtKey = bsonutil.MustHaveTag(ProcessRuntime{},
		"FinishedAt")
	ProcRuntimeRuntimeKey = bsonutil.MustHaveTag(ProcessRuntime{}, "Runtime")
)
View Source
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")
)
View Source
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")
	ProjectRefRepotrackerError      = bsonutil.MustHaveTag(ProjectRef{}, "RepotrackerError")
	ProjectRefFilesIgnoredFromCache = bsonutil.MustHaveTag(ProjectRef{}, "FilesIgnoredFromCache")
	ProjectRefDisabledStatsCache    = bsonutil.MustHaveTag(ProjectRef{}, "DisabledStatsCache")
	ProjectRefAdminsKey             = bsonutil.MustHaveTag(ProjectRef{}, "Admins")
)
View Source
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")
)
View Source
var (
	// BSON fields for the Repository struct
	RepoProjectKey = bsonutil.MustHaveTag(Repository{},
		"Project")
	RepoLastRevisionKey = bsonutil.MustHaveTag(Repository{},
		"LastRevision")
	RepositoryOrderNumberKey = bsonutil.MustHaveTag(Repository{},
		"RevisionOrderNumber")
)
View Source
var (
	TestFileKey        = bsonutil.MustHaveTag(TestHistoryResult{}, "TestFile")
	TaskNameKey        = bsonutil.MustHaveTag(TestHistoryResult{}, "TaskName")
	TaskStatusKey      = bsonutil.MustHaveTag(TestHistoryResult{}, "TaskStatus")
	TestStatusKey      = bsonutil.MustHaveTag(TestHistoryResult{}, "TestStatus")
	RevisionKey        = bsonutil.MustHaveTag(TestHistoryResult{}, "Revision")
	ProjectKey         = bsonutil.MustHaveTag(TestHistoryResult{}, "Project")
	TaskIdKey          = bsonutil.MustHaveTag(TestHistoryResult{}, "TaskId")
	BuildVariantKey    = bsonutil.MustHaveTag(TestHistoryResult{}, "BuildVariant")
	EndTimeKey         = bsonutil.MustHaveTag(TestHistoryResult{}, "EndTime")
	StartTimeKey       = bsonutil.MustHaveTag(TestHistoryResult{}, "StartTime")
	ExecutionKey       = bsonutil.MustHaveTag(TestHistoryResult{}, "Execution")
	OldTaskIdKey       = bsonutil.MustHaveTag(TestHistoryResult{}, "OldTaskId")
	UrlKey             = bsonutil.MustHaveTag(TestHistoryResult{}, "Url")
	UrlRawKey          = bsonutil.MustHaveTag(TestHistoryResult{}, "UrlRaw")
	TaskTimedOutKey    = bsonutil.MustHaveTag(TestHistoryResult{}, "TaskTimedOut")
	TaskDetailsTypeKey = bsonutil.MustHaveTag(TestHistoryResult{}, "TaskDetailsType")
	LogIdKey           = bsonutil.MustHaveTag(TestHistoryResult{}, "LogId")
)

TestHistoryResult bson tags

View Source
var (
	TaskJSONTagMetaCreatedKey   = bsonutil.MustHaveTag(TaskJSONTagMeta{}, "Created")
	TaskJSONTagMetaRevisionKey  = bsonutil.MustHaveTag(TaskJSONTagMeta{}, "Revision")
	TaskJSONTagMetaVersionIdKey = bsonutil.MustHaveTag(TaskJSONTagMeta{}, "VersionId")
)
View Source
var (
	TaskJSONTagNameKey = bsonutil.MustHaveTag(TaskJSONTag{}, "Name")
	TaskJSONTagObjKey  = bsonutil.MustHaveTag(TaskJSONTag{}, "Obj")
)
View Source
var (
	// BSON fields for the TaskJSON struct
	TaskJSONNameKey                = bsonutil.MustHaveTag(TaskJSON{}, "Name")
	TaskJSONTaskNameKey            = bsonutil.MustHaveTag(TaskJSON{}, "TaskName")
	TaskJSONProjectIdKey           = bsonutil.MustHaveTag(TaskJSON{}, "ProjectId")
	TaskJSONTaskIdKey              = bsonutil.MustHaveTag(TaskJSON{}, "TaskId")
	TaskJSONBuildIdKey             = bsonutil.MustHaveTag(TaskJSON{}, "BuildId")
	TaskJSONVariantKey             = bsonutil.MustHaveTag(TaskJSON{}, "Variant")
	TaskJSONVersionIdKey           = bsonutil.MustHaveTag(TaskJSON{}, "VersionId")
	TaskJSONCreateTimeKey          = bsonutil.MustHaveTag(TaskJSON{}, "CreateTime")
	TaskJSONIsPatchKey             = bsonutil.MustHaveTag(TaskJSON{}, "IsPatch")
	TaskJSONRevisionOrderNumberKey = bsonutil.MustHaveTag(TaskJSON{}, "RevisionOrderNumber")
	TaskJSONRevisionKey            = bsonutil.MustHaveTag(TaskJSON{}, "Revision")
	TaskJSONDataKey                = bsonutil.MustHaveTag(TaskJSON{}, "Data")
	TaskJSONTagKey                 = bsonutil.MustHaveTag(TaskJSON{}, "Tag")
)
View Source
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(apimodels.LogMessage{}, "Type")
	LogMessageSeverityKey  = bsonutil.MustHaveTag(apimodels.LogMessage{}, "Severity")
	LogMessageMessageKey   = bsonutil.MustHaveTag(apimodels.LogMessage{}, "Message")
	LogMessageTimestampKey = bsonutil.MustHaveTag(apimodels.LogMessage{}, "Timestamp")
)
View Source
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")
)
View Source
var (
	VersionBuildStatusVariantKey    = bsonutil.MustHaveTag(VersionBuildStatus{}, "BuildVariant")
	VersionBuildStatusActivatedKey  = bsonutil.MustHaveTag(VersionBuildStatus{}, "Activated")
	VersionBuildStatusActivateAtKey = bsonutil.MustHaveTag(VersionBuildStatus{}, "ActivateAt")
	VersionBuildStatusBuildIdKey    = bsonutil.MustHaveTag(VersionBuildStatus{}, "BuildId")
)
View Source
var (
	// bson fields for the version struct
	VersionIdKey                  = bsonutil.MustHaveTag(Version{}, "Id")
	VersionCreateTimeKey          = bsonutil.MustHaveTag(Version{}, "CreateTime")
	VersionStartTimeKey           = bsonutil.MustHaveTag(Version{}, "StartTime")
	VersionFinishTimeKey          = bsonutil.MustHaveTag(Version{}, "FinishTime")
	VersionRevisionKey            = bsonutil.MustHaveTag(Version{}, "Revision")
	VersionAuthorKey              = bsonutil.MustHaveTag(Version{}, "Author")
	VersionAuthorEmailKey         = bsonutil.MustHaveTag(Version{}, "AuthorEmail")
	VersionMessageKey             = bsonutil.MustHaveTag(Version{}, "Message")
	VersionStatusKey              = bsonutil.MustHaveTag(Version{}, "Status")
	VersionBuildIdsKey            = bsonutil.MustHaveTag(Version{}, "BuildIds")
	VersionBuildVariantsKey       = bsonutil.MustHaveTag(Version{}, "BuildVariants")
	VersionRevisionOrderNumberKey = bsonutil.MustHaveTag(Version{}, "RevisionOrderNumber")
	VersionRequesterKey           = bsonutil.MustHaveTag(Version{}, "Requester")
	VersionProjectKey             = bsonutil.MustHaveTag(Version{}, "ParserProject")
	VersionConfigKey              = bsonutil.MustHaveTag(Version{}, "Config")
	VersionConfigNumberKey        = bsonutil.MustHaveTag(Version{}, "ConfigUpdateNumber")
	VersionIgnoredKey             = bsonutil.MustHaveTag(Version{}, "Ignored")
	VersionOwnerNameKey           = bsonutil.MustHaveTag(Version{}, "Owner")
	VersionRepoKey                = bsonutil.MustHaveTag(Version{}, "Repo")
	VersionProjectNameKey         = bsonutil.MustHaveTag(Version{}, "Branch")
	VersionRepoKindKey            = bsonutil.MustHaveTag(Version{}, "RepoKind")
	VersionErrorsKey              = bsonutil.MustHaveTag(Version{}, "Errors")
	VersionWarningsKey            = bsonutil.MustHaveTag(Version{}, "Warnings")
	VersionIdentifierKey          = bsonutil.MustHaveTag(Version{}, "Identifier")
	VersionRemoteKey              = bsonutil.MustHaveTag(Version{}, "Remote")
	VersionRemoteURLKey           = bsonutil.MustHaveTag(Version{}, "RemotePath")
	VersionTriggerIDKey           = bsonutil.MustHaveTag(Version{}, "TriggerID")
	VersionTriggerTypeKey         = bsonutil.MustHaveTag(Version{}, "TriggerType")
	VersionSatisfiedTriggersKey   = bsonutil.MustHaveTag(Version{}, "SatisfiedTriggers")
	VersionPeriodicBuildIDKey     = bsonutil.MustHaveTag(Version{}, "PeriodicBuildID")
)
View Source
var EarliestDateToConsider time.Time
View Source
var (
	FeedbackTypeKey = bsonutil.MustHaveTag(FeedbackSubmission{}, "Type")
)
View Source
var NoteTaskIdKey = bsonutil.MustHaveTag(Note{}, "TaskId")
View Source
var (
	TestLogPath = "/test_log/"
)
View Source
var (
	ValidRepoTypes = []string{GithubRepoType}
)

valid repositories - currently only github supported

View Source
var VersionAll = db.Query(bson.D{})

All is a query for all versions.

Functions

func AbortBuild

func AbortBuild(buildId string, caller string) error

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 AbortPatchesWithGithubPatchData

func AbortPatchesWithGithubPatchData(createdBefore time.Time, owner, repo string, prNumber int) error

AbortPatchesWithGithubPatchData runs CancelPatch on patches created before the given time, with the same pr number, and base repository. Tasks which are abortable (see model/task.IsAbortable()) will be aborted, while dispatched/running/completed tasks will not be affected

func AbortTask

func AbortTask(taskId, caller string) error

func AbortVersion

func AbortVersion(versionId, caller string) error

AbortVersion sets the abort flag on all tasks associated with the version which are in an abortable state

func ActivateElapsedBuilds

func ActivateElapsedBuilds(v *Version) error

Activates any builds if their BatchTimes have elapsed.

func ActivatePreviousTask

func ActivatePreviousTask(taskId, caller string) error

ActivatePreviousTask will set the Active state for the first task with a revision order number less than the current task's revision order number.

func AddNewBuilds

func AddNewBuilds(activated bool, v *Version, p *Project, tasks TaskVariantPairs, generatedBy string) error

Given a patch version and a list of variant/task pairs, creates the set of new builds that do not exist yet out of the set of pairs. No tasks are added for builds which already exist (see AddNewTasksForPatch).

func AddNewBuildsForPatch

func AddNewBuildsForPatch(p *patch.Patch, patchVersion *Version, project *Project, tasks TaskVariantPairs) error

Given a patch version and a list of variant/task pairs, creates the set of new builds that do not exist yet out of the set of pairs. No tasks are added for builds which already exist (see AddNewTasksForPatch).

func AddNewTasks

func AddNewTasks(ctx context.Context, activated bool, v *Version, p *Project, pairs TaskVariantPairs, generatedBy string) error

Given a version and set of variant/task pairs, creates any tasks that don't exist yet, within the set of already existing builds.

func AddNewTasksForPatch

func AddNewTasksForPatch(ctx context.Context, p *patch.Patch, patchVersion *Version, project *Project, pairs TaskVariantPairs) error

Given a patch version and set of variant/task pairs, creates any tasks that don't exist yet, within the set of already existing builds.

func AddSatisfiedTrigger

func AddSatisfiedTrigger(versionID, definitionID string) error

func AddTasksToBuild

func AddTasksToBuild(ctx context.Context, b *build.Build, project *Project, v *Version, taskNames []string,
	displayNames []string, generatedBy string, tasksInBuild []task.Task, distroAliases map[string][]string) (*build.Build, error)

AddTasksToBuild creates the tasks for the given build of a project

func BlockTaskGroupTasks

func BlockTaskGroupTasks(taskID string) error

func CalculateActualMakespan

func CalculateActualMakespan(tasks []task.Task) time.Duration

CalculateActualMakespan finds the amount of time it took for the build to complete from the first task start to the last task finishing.

func CancelPatch

func CancelPatch(p *patch.Patch, caller string) error

func ClearAndResetStrandedTask

func ClearAndResetStrandedTask(h *host.Host) error

func ClearTaskQueue

func ClearTaskQueue(distro string) error

func CreateBuildFromVersion

func CreateBuildFromVersion(args BuildCreateArgs) (string, error)

CreateBuildFromVersion creates a build given all of the necessary information from the corresponding version and project and a list of tasks.

func CreateTasksCache

func CreateTasksCache(tasks []task.Task) []build.TaskCache

func DeactivatePreviousTasks

func DeactivatePreviousTasks(t *task.Task, caller string) error

Deactivate any previously activated but undispatched tasks for the same build variant + display name + project combination as the task.

func DeleteTaskJSONTagFromTask

func DeleteTaskJSONTagFromTask(taskId, name string) error

func DoProjectActivation

func DoProjectActivation(id string) error

func FindMinimumQueuePositionForTask

func FindMinimumQueuePositionForTask(taskId string) (int, error)

FindMinimumQueuePositionForTask finds the position of a task in the many task queues where its position is the lowest. It returns an error if the aggregation it runs fails.

func FindMostRecentLogMessages

func FindMostRecentLogMessages(taskId string, execution int, numMsgs int,
	severities []string, msgTypes []string) ([]apimodels.LogMessage, error)

note: to ignore severity or type filtering, pass in empty slices

func FindPredictedMakespan

func FindPredictedMakespan(tasks []task.Task) dependencyPath

FindPredictedMakespan, given a list of tasks that have been completed, finds the optimal makespan of that build.

func FindTaskAliasQueueGenerationRuntime

func FindTaskAliasQueueGenerationRuntime() (map[string]time.Duration, error)

func FindTaskAliasQueueLastGenerationTimes

func FindTaskAliasQueueLastGenerationTimes() (map[string]time.Time, error)

func FindTaskQueueGenerationRuntime

func FindTaskQueueGenerationRuntime() (map[string]time.Duration, error)

func FindTaskQueueLastGenerationTimes

func FindTaskQueueLastGenerationTimes() (map[string]time.Time, error)

func FindUserByID

func FindUserByID(id string) (*user.DBUser, error)

func GetEstimatedStartTime

func GetEstimatedStartTime(t task.Task) (time.Duration, error)

GetEstimatedStartTime returns the estimated start time for a task

func GetNewRevisionOrderNumber

func GetNewRevisionOrderNumber(projectId string) (int, error)

GetNewRevisionOrderNumber gets a new revision order number for a project.

func GetOrCreateUser

func GetOrCreateUser(userId, displayName, email string) (*user.DBUser, error)

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 GetRawTaskLogChannel(taskId string, execution int, severities []string,
	msgTypes []string) (chan apimodels.LogMessage, error)

func GetUpstreamProjectName

func GetUpstreamProjectName(triggerID, triggerType string) (string, error)

func InsertNotificationRecord

func InsertNotificationRecord(prevNotification, currNotification,
	notificationName, notificationType, notificationProject,
	notificationRequester string) error

func InsertTaskJSON

func InsertTaskJSON(t *task.Task, name string, data map[string]interface{}) error

InsertTask creates a TaskJSON document in the plugin's collection.

func IsValidId

func IsValidId(id string) bool

IsValidId returns whether the supplied Id is a valid patch doc id (BSON ObjectId).

func LastNotificationsEventTime

func LastNotificationsEventTime(projectName string) (time.Time,
	error)

func LoadProjectInto

func LoadProjectInto(data []byte, identifier string, project *Project) error

LoadProjectInto loads the raw data from the config file into project and sets the project's identifier field to identifier. Tags are evaluated.

func LogProjectAdded

func LogProjectAdded(projectId, username string) error

func LogProjectEvent

func LogProjectEvent(eventType string, projectId string, eventData ProjectChangeEvent) error

func LogProjectModified

func LogProjectModified(projectId, username string, before, after ProjectSettingsEvent) error

func MakePatchedConfig

func MakePatchedConfig(ctx context.Context, env evergreen.Environment, p *patch.Patch, remoteConfigPath, projectConfig string) ([]byte, error)

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 MarkEnd

func MarkEnd(t *task.Task, caller string, finishTime time.Time, detail *apimodels.TaskEndDetail,
	deactivatePrevious bool, updates *StatusChanges) error

MarkEnd updates the task as being finished, performs a stepback if necessary, and updates the build status

func MarkStart

func MarkStart(t *task.Task, updates *StatusChanges) error

MarkStart updates the task, build, version and if necessary, patch documents with the task start time

func MarkTaskDispatched

func MarkTaskDispatched(t *task.Task, hostId, distroId string) error

func MarkTaskUndispatched

func MarkTaskUndispatched(t *task.Task) error

func MarkVersionCompleted

func MarkVersionCompleted(versionId string, finishTime time.Time, updates *StatusChanges) error

MarkVersionCompleted updates the status of a completed version to reflect its correct state by checking the status of its individual builds.

func MarkVersionStarted

func MarkVersionStarted(versionId string, startTime time.Time) error

func NewAxisSelectorEvaluator

func NewAxisSelectorEvaluator(axes []matrixAxis) *axisSelectorEvaluator

func NewId

func NewId(id string) mgobson.ObjectId

NewId constructs a valid patch Id from the given hex string.

func NewParserTaskSelectorEvaluator

func NewParserTaskSelectorEvaluator(tasks []parserTask) *taskSelectorEvaluator

NewParserTaskSelectorEvaluator returns a new taskSelectorEvaluator.

func NewQueue

func NewQueue() estimatedTaskQueue

func NewVariantSelectorEvaluator

func NewVariantSelectorEvaluator(variants []parserBV, ase *axisSelectorEvaluator) *variantSelectorEvaluator

NewVariantSelectorEvaluator returns a new taskSelectorEvaluator.

func PopulateExpansions

func PopulateExpansions(t *task.Task, h *host.Host, oauthToken string) (util.Expansions, error)

func RefreshTasksCache

func RefreshTasksCache(buildId string) error

RefreshTasksCache updates a build document so that the tasks cache reflects the correct current state of the tasks it represents.

func RemoveProjectAlias

func RemoveProjectAlias(id string) error

RemoveProjectAlias removes a project alias with the given document ID from the database.

func RestartBuild

func RestartBuild(buildId string, taskIds []string, abortInProgress bool, caller string) error

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 RestartBuildTasks

func RestartBuildTasks(buildId string, caller string) error

RestartBuildTasks restarts all the tasks associated with a given build.

func RestartVersion

func RestartVersion(versionId string, taskIds []string, abortInProgress bool, caller string) error

RestartVersion restarts completed tasks associated with a given versionId. If abortInProgress is true, it also sets the abort flag on any in-progress tasks.

func RetryCommitQueueItems

func RetryCommitQueueItems(projectID string, patchType string, opts RestartOptions) ([]string, []string, error)

func SaveUserSettings

func SaveUserSettings(userId string, settings user.UserSettings) error

SaveUserSettings updates the settings stored for the given user id.

func SetAWSKeyForProject

func SetAWSKeyForProject(projectId string, ssh *AWSSSHKey) error

func SetActiveState

func SetActiveState(taskId string, caller string, active bool) error

func SetBuildActivation

func SetBuildActivation(buildId string, active bool, caller string, skipDependencies bool) error

SetBuildActivation updates the "active" state of this build and all associated tasks. It also updates the task cache for the build document.

func SetBuildPriority

func SetBuildPriority(buildId string, priority int64) error

SetBuildPriority updates the priority field of all tasks associated with the given build id.

func SetLastNotificationsEventTime

func SetLastNotificationsEventTime(projectName string,
	timeOfEvent time.Time) error

Record the last-notification time for a given project.

func SetProcessRuntimeCompleted

func SetProcessRuntimeCompleted(processName string,
	runtime time.Duration) error

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 SetTaskJSONTagForTask

func SetTaskJSONTagForTask(taskId, name, tag string) error

func SetUserAPIKey

func SetUserAPIKey(userId, newKey string) error

SetUserAPIKey updates the API key stored with a user.

func SetVersionActivation

func SetVersionActivation(versionId string, active bool, caller string) error

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

func SetVersionPriority(versionId string, priority int64) error

func TaskHistoryPickaxe

func TaskHistoryPickaxe(params PickaxeParams) ([]task.Task, error)

func TryMarkPatchBuildFinished

func TryMarkPatchBuildFinished(b *build.Build, finishTime time.Time, updates *StatusChanges) error

TryMarkPatchBuildFinished attempts to mark a patch as finished if all the builds for the patch are finished as well

func TryResetTask

func TryResetTask(taskId, user, origin string, detail *apimodels.TaskEndDetail) error

TryResetTask resets a task

func UpdateBuildAndVersionStatusForTask

func UpdateBuildAndVersionStatusForTask(taskId string, updates *StatusChanges) error

UpdateBuildStatusForTask finds all the builds for a task and updates the status of the build based on the task's status.

func UpdateDisplayTask

func UpdateDisplayTask(t *task.Task) error

func UpdateLastRevision

func UpdateLastRevision(projectId, revision string) error

UpdateLastRevision updates the last created revision of a project.

func UpdateOneNotification

func UpdateOneNotification(query interface{}, update interface{}) error

func UpsertAliasesForProject

func UpsertAliasesForProject(aliases []ProjectAlias, projectId string) error

func UpsertOneProcessRuntime

func UpsertOneProcessRuntime(query interface{}, update interface{}) error

func ValidateHost

func ValidateHost(hostId string, r *http.Request) (*host.Host, int, error)

ValidateHost ensures that the host exists in the database and that, if a secret is provided, it matches the secret in the database. If a task ID is provided, it ensures that the host should be running this task. It returns a host, http status code, and error.

func ValidateNewGraph

func ValidateNewGraph(t *task.Task, tasksToBlock []task.Task) error

func ValidateProjectAliases

func ValidateProjectAliases(aliases []ProjectAlias, aliasType string) []string

func ValidateTVPairs

func ValidateTVPairs(p *Project, in []TVPair) error

ValidateTVPairs checks that all of a set of variant/task pairs exist in a given project.

func ValidateTask

func ValidateTask(taskId string, checkSecret bool, r *http.Request) (*task.Task, int, error)

ValidateTask ensures that a task ID is set and corresponds to a task in the database. If checkSecret is true, it also validates the task's secret. It returns a task, http status code, and error.

func VersionBaseVersionFromPatch

func VersionBaseVersionFromPatch(projectId, revision string) db.Q

BaseVersionFromPatch finds the base version for a patch version.

func VersionById

func VersionById(id string) db.Q

ById returns a db.Q object which will filter on {_id : <the id param>}

func VersionByIds

func VersionByIds(ids []string) db.Q

ByIds returns a db.Q object which will find any versions whose _id appears in the given list.

func VersionByLastKnownGoodConfig

func VersionByLastKnownGoodConfig(projectId string) db.Q

ByLastKnownGoodConfig filters on versions with valid (i.e., have no errors) config for the given project. Does not apply a limit, so should generally be used with a FindOne.

func VersionByLastVariantActivation

func VersionByLastVariantActivation(projectId, variant string) db.Q

ByLastVariantActivation finds the most recent non-patch, non-ignored versions in a project that have a particular variant activated.

func VersionByMostRecentNonIgnored

func VersionByMostRecentNonIgnored(projectId string) db.Q

ByMostRecentNonIgnored finds all non-ignored versions within a project, ordered by most recently created to oldest.

func VersionByMostRecentSystemRequester

func VersionByMostRecentSystemRequester(projectId string) db.Q

ByProjectId finds all versions within a project, ordered by most recently created to oldest. The requester controls if it should search patch or non-patch versions.

func VersionByProjectAndTrigger

func VersionByProjectAndTrigger(projectID string, includeTriggered bool) db.Q

func VersionByProjectId

func VersionByProjectId(projectId string) db.Q

ByProjectId finds all non-patch versions within a project.

func VersionByProjectIdAndOrder

func VersionByProjectIdAndOrder(projectId string, revisionOrderNumber int) db.Q

ByProjectIdAndOrder finds non-patch versions for the given project with revision order numbers less than or equal to revisionOrderNumber.

func VersionByProjectIdAndRevision

func VersionByProjectIdAndRevision(projectId, revision string) db.Q

ByProjectIdAndRevision finds non-patch versions for the given project and revision.

func VersionByProjectIdAndRevisionPrefix

func VersionByProjectIdAndRevisionPrefix(projectId, revisionPrefix string) db.Q

func VersionBySuccessfulBeforeRevision

func VersionBySuccessfulBeforeRevision(project string, beforeRevision int) db.Q

func VersionBySystemRequesterOrdered

func VersionBySystemRequesterOrdered(projectId string, startOrder int) db.Q

if startOrder is specified, only returns older versions (i.e. with a smaller revision number)

func VersionCount

func VersionCount(query db.Q) (int, error)

Count returns the number of hosts that satisfy the given query.

func VersionUpdateOne

func VersionUpdateOne(query interface{}, update interface{}) error

UpdateOne updates one version.

func VersionsByRequesterOrdered

func VersionsByRequesterOrdered(project, requester string, limit, startOrder int) db.Q

Types

type AWSSSHKey

type AWSSSHKey struct {
	Name  string
	Value string
}

func GetAWSKeyForProject

func GetAWSKeyForProject(projectId string) (*AWSSSHKey, error)

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"`
}

func (AlertConfig) GetSettingsMap

func (a AlertConfig) GetSettingsMap() map[string]string

type ArtifactInstructions

type ArtifactInstructions struct {
	Include      []string `yaml:"include,omitempty" bson:"include"`
	ExcludeFiles []string `yaml:"excludefiles,omitempty" bson:"exclude_files"`
}

type AverageTimeByDistroAndRequester

type AverageTimeByDistroAndRequester struct {
	Distro      string        `bson:"distro" json:"distro"`
	Requester   string        `bson:"requester" json:"requester"`
	AverageTime time.Duration `bson:"average_time" json:"average_time"`
}

AverageTimeByDistroAndRequester is the average time of a task.

func (*AverageTimeByDistroAndRequester) MarshalBSON

func (a *AverageTimeByDistroAndRequester) MarshalBSON() ([]byte, error)

func (*AverageTimeByDistroAndRequester) UnmarshalBSON

func (a *AverageTimeByDistroAndRequester) UnmarshalBSON(in []byte) error

type AverageTimes

type AverageTimes struct {
	Times        []AverageTimeByDistroAndRequester `json:"times"`
	message.Base `json:"metadata,omitempty"`
	// contains filtered or unexported fields
}

AverageTimes implements message.Composer.

func AverageTaskLatency

func AverageTaskLatency(since time.Duration) (*AverageTimes, error)

AverageTaskLatency finds the average task latency by distro and requester.

func (*AverageTimes) Loggable

func (a *AverageTimes) Loggable() bool

func (*AverageTimes) MarshalBSON

func (a *AverageTimes) MarshalBSON() ([]byte, error)

func (*AverageTimes) Raw

func (a *AverageTimes) Raw() interface{}

func (*AverageTimes) String

func (a *AverageTimes) String() string

func (*AverageTimes) UnmarshalBSON

func (a *AverageTimes) UnmarshalBSON(in []byte) error

type AvgBucket

type AvgBucket struct {
	Id          int           `bson:"_id" json:"index" csv:"index"`
	AverageTime time.Duration `bson:"a" json:"avg" csv:"avg_time"`
	NumberTasks int           `bson:"n" json:"number_tasks" csv:"number_tasks"`
	Start       time.Time     `json:"start_time" csv:"start_time"`
	End         time.Time     `json:"end_time" csv:"end_time"`
}

AvgBucket is one element in the results of a list of buckets that are created from the agg query.

type AvgBuckets

type AvgBuckets []AvgBucket

func AverageStatistics

func AverageStatistics(distroId string, bounds FrameBounds) (AvgBuckets, error)

AverageStatistics uses an agg pipeline that creates buckets given a time frame and finds the average scheduled -> start time for that time frame. One thing to note is that the average time is in milliseconds, not nanoseconds and must be converted.

type Bucket

type Bucket struct {
	TotalTime time.Duration  `json:"total_time"`
	Resources []ResourceInfo `json:"resources"`
}

Bucket stores the total amount of time in a given bucket and a list of the resources that are in that bucket

func CreateHostBuckets

func CreateHostBuckets(hosts []host.Host, bounds FrameBounds) ([]Bucket, []error)

CreateHostBuckets takes in a list of hosts with their creation and termination times and returns durations bucketed based on a start time, number of buckets and the size of each bucket

func CreateTaskBuckets

func CreateTaskBuckets(tasks []task.Task, oldTasks []task.Task, bounds FrameBounds) ([]Bucket, []error)

CreateTaskBuckets takes in a list of tasks with their start and finish times and returns durations bucketed based on a start time, number of buckets and the size of each bucket

type BuildCreateArgs

type BuildCreateArgs struct {
	Project       Project                 // project to create the build for
	Version       Version                 // the version the build belong to
	TaskIDs       TaskIdConfig            // pre-generated IDs for the tasks to be created
	BuildName     string                  // name of the buildvariant
	Activated     bool                    // true if the build should be scheduled
	TaskNames     []string                // names of tasks to create (used in patches). Will create all if nil
	DisplayNames  []string                // names of display tasks to create (used in patches). Will create all if nil
	GeneratedBy   string                  // ID of the task that generated this build
	SourceRev     string                  // githash of the revision that triggered this build
	DefinitionID  string                  // definition ID of the trigger used to create this build
	Aliases       ProjectAliases          // project aliases to use to filter tasks created
	Session       mongo.SessionContext    // session context to use for transactions
	DistroAliases distro.AliasLookupTable // map of distro aliases to names of distros
}

BuildCreateArgs is the set of parameters used in CreateBuildFromVersion

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,omitempty" bson:"name"`
	DisplayName string            `yaml:"display_name,omitempty" bson:"display_name"`
	Expansions  map[string]string `yaml:"expansions,omitempty" bson:"expansions"`
	Modules     []string          `yaml:"modules,omitempty" bson:"modules"`
	Disabled    bool              `yaml:"disabled,omitempty" bson:"disabled"`
	Tags        []string          `yaml:"tags,omitempty" bson:"tags"`
	Push        bool              `yaml:"push,omitempty" 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,omitempty" bson:"run_on"`

	// all of the tasks/groups to be run on the build variant, compile through tests.
	Tasks        []BuildVariantTaskUnit `yaml:"tasks,omitempty" bson:"tasks"`
	DisplayTasks []DisplayTask          `yaml:"display_tasks,omitempty" bson:"display_tasks,omitempty"`
}

func (BuildVariant) Get

func (*BuildVariant) GetDisplayTaskNamek

func (bv *BuildVariant) GetDisplayTaskNamek(execTask string) string

type BuildVariantHistoryIterator

type BuildVariantHistoryIterator interface {
	GetItems(beforeCommit *Version, numCommits int) ([]bson.M, []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 BuildVariantTaskUnit

type BuildVariantTaskUnit struct {
	// Name has to match the name field of one of the tasks or groups specified at
	// the project level, or an error will be thrown
	Name      string `yaml:"name,omitempty" bson:"name"`
	IsGroup   bool   `yaml:"-" bson:"-"`
	GroupName string `yaml:"-" bson:"-"`

	// fields to overwrite ProjectTask settings.
	Patchable *bool                 `yaml:"patchable,omitempty" bson:"patchable,omitempty"`
	PatchOnly *bool                 `yaml:"patch_only,omitempty" bson:"patch_only,omitempty"`
	Priority  int64                 `yaml:"priority,omitempty" bson:"priority"`
	DependsOn []TaskUnitDependency  `yaml:"depends_on,omitempty" bson:"depends_on"`
	Requires  []TaskUnitRequirement `yaml:"requires,omitempty" bson:"requires"`

	// the distros that the task can be run on
	Distros []string `yaml:"distros,omitempty" bson:"distros"`

	// currently unsupported (TODO EVG-578)
	ExecTimeoutSecs int   `yaml:"exec_timeout_secs,omitempty" bson:"exec_timeout_secs"`
	Stepback        *bool `yaml:"stepback,omitempty" bson:"stepback,omitempty"`

	Variant string `yaml:"-" bson:"-"`

	CommitQueueMerge bool `yaml:"commit_queue_merge,omitempty" bson:"commit_queue_merge"`
}

Unmarshalled from the "tasks" list in an individual build variant. Can be either a task or task group

func CreateTasksFromGroup

func CreateTasksFromGroup(in BuildVariantTaskUnit, proj *Project) []BuildVariantTaskUnit

func (*BuildVariantTaskUnit) Populate

func (bvt *BuildVariantTaskUnit) Populate(pt ProjectTask)

Populate updates the base fields of the BuildVariantTaskUnit with fields from the project task definition.

func (*BuildVariantTaskUnit) SkipOnNonPatchBuild

func (bvt *BuildVariantTaskUnit) SkipOnNonPatchBuild() bool

func (*BuildVariantTaskUnit) SkipOnPatchBuild

func (bvt *BuildVariantTaskUnit) SkipOnPatchBuild() bool

func (*BuildVariantTaskUnit) UnmarshalYAML

func (bvt *BuildVariantTaskUnit) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML allows tasks to be referenced as single selector strings. This works by first attempting to unmarshal the YAML into a string and then falling back to the BuildVariantTaskUnit struct.

type BuildVariants

type BuildVariants []BuildVariant

func (BuildVariants) Get

func (b BuildVariants) Get(name string) (BuildVariant, error)

func (BuildVariants) Len

func (b BuildVariants) Len() int

func (BuildVariants) Less

func (b BuildVariants) Less(i, j int) bool

func (BuildVariants) Swap

func (b BuildVariants) Swap(i, j int)

type CachedDispatcher

type CachedDispatcher interface {
	Refresh() error
	FindNextTask(TaskSpec) *TaskQueueItem
}

type CommitQueueParams

type CommitQueueParams struct {
	Enabled     bool   `bson:"enabled" json:"enabled"`
	MergeMethod string `bson:"merge_method" json:"merge_method"`
	PatchType   string `bson:"patch_type" json:"patch_type"`
}

type Context

type Context struct {
	Task       *task.Task
	Build      *build.Build
	Version    *Version
	Patch      *patch.Patch
	ProjectRef *ProjectRef
	// contains filtered or unexported fields
}

Context is the set of all the related entities in a task/build/version/project hierarchy. Using the LoadContext function, all the other applicable fields in the Context can inferred and populated from the id of any one of the fields.

func LoadContext

func LoadContext(taskId, buildId, versionId, patchId, projectId string) (Context, error)

LoadContext builds a Context from the set of given resource ID's by inferring all the relationships between them - for example, e.g. loading a project based on the the task, or the version based on the patch, etc.

func (*Context) GetProject

func (ctx *Context) GetProject() (*Project, error)

GetProject returns the project associated with the Context.

func (*Context) GetProjectRef

func (ctx *Context) GetProjectRef() (*ProjectRef, error)

type DisplayTask

type DisplayTask struct {
	Name           string   `yaml:"name,omitempty" bson:"name,omitempty"`
	ExecutionTasks []string `yaml:"execution_tasks,omitempty" bson:"execution_tasks,omitempty"`
}

type DistroQueueInfo

type DistroQueueInfo struct {
	Length               int             `bson:"length" json:"length"`
	ExpectedDuration     time.Duration   `bson:"expected_duration" json:"expected_duration"`
	MaxDurationThreshold time.Duration   `bson:"max_duration_threshold" json:"max_duration_threshold"`
	PlanCreatedAt        time.Time       `bson:"created_at" json:"created_at"`
	CountOverThreshold   int             `bson:"count_over_threshold" json:"count_over_threshold"`
	TaskGroupInfos       []TaskGroupInfo `bson:"task_group_infos" json:"task_group_infos"`
	AliasQueue           bool            `bson:"alias_queue" json:"alias_queue"`
}

func GetDistroQueueInfo

func GetDistroQueueInfo(distroID string) (DistroQueueInfo, error)

func (*DistroQueueInfo) GetQueueCollection

func (q *DistroQueueInfo) GetQueueCollection() string

type DuplicateVersions

type DuplicateVersions struct {
	ID       DuplicateVersionsID `bson:"_id"`
	Versions []Version           `bson:"versions"`
}

type DuplicateVersionsID

type DuplicateVersionsID struct {
	Hash      string `bson:"hash"`
	ProjectID string `bson:"project_id"`
}

type EmailAlertData

type EmailAlertData struct {
	Recipients []string `bson:"recipients"`
}

type ExhaustedIterator

type ExhaustedIterator struct {
	Before, After bool
}

type FeedbackSubmission

type FeedbackSubmission struct {
	Type        string           `json:"type" bson:"type"`
	User        string           `json:"user,omitempty" bson:"user,omitempty"`
	SubmittedAt time.Time        `json:"submitted_at" bson:"submitted_at"`
	Questions   []QuestionAnswer `json:"questions" bson:"questions"`
}

func FindFeedbackOfType

func FindFeedbackOfType(t string) ([]FeedbackSubmission, error)

func (*FeedbackSubmission) Insert

func (s *FeedbackSubmission) Insert() error

type FrameBounds

type FrameBounds struct {
	StartTime     time.Time
	EndTime       time.Time
	BucketSize    time.Duration
	NumberBuckets int
}

FrameBounds is a set of information about the inputs of buckets

func CalculateBounds

func CalculateBounds(daysBack, granularity int) FrameBounds

CalculateBounds takes in a daysBack and granularity and returns the start time, end time, bucket size, and number of buckets

type GeneratedProject

type GeneratedProject struct {
	BuildVariants []parserBV                 `yaml:"buildvariants"`
	Tasks         []parserTask               `yaml:"tasks"`
	Functions     map[string]*YAMLCommandSet `yaml:"functions"`
	TaskGroups    []parserTaskGroup          `yaml:"task_groups"`

	TaskID string
}

GeneratedProject is a subset of the Project type, and is generated from the JSON from a `generate.tasks` command.

func MergeGeneratedProjects

func MergeGeneratedProjects(projects []GeneratedProject) *GeneratedProject

MergeGeneratedProjects takes a slice of generated projects and returns a single, deduplicated project.

func ParseProjectFromJSON

func ParseProjectFromJSON(data []byte) (GeneratedProject, error)

ParseProjectFromJSON returns a GeneratedTasks type from JSON. We use the YAML parser instead of the JSON parser because the JSON parser will not properly unmarshal into a struct with multiple fields as options, like the YAMLCommandSet.

func (*GeneratedProject) NewVersion

func (g *GeneratedProject) NewVersion() (*Project, *Version, *task.Task, *projectMaps, error)

NewVersion adds the buildvariants, tasks, and functions from a generated project config to a project, and returns the previous config number.

func (*GeneratedProject) Save

func (g *GeneratedProject) Save(ctx context.Context, p *Project, v *Version, t *task.Task, pm *projectMaps) error

type GithubHook

type GithubHook struct {
	HookID int    `bson:"hook_id"`
	Owner  string `bson:"owner"`
	Repo   string `bson:"repo"`
}

func FindGithubHook

func FindGithubHook(owner, repo string) (*GithubHook, error)

func SetupNewGithubHook

func SetupNewGithubHook(ctx context.Context, settings evergreen.Settings, owner string, repo string) (*GithubHook, error)

func (*GithubHook) Insert

func (h *GithubHook) Insert() error

type HostTaskInconsistency

type HostTaskInconsistency struct {
	Host          string
	HostTaskCache string
	Task          string
	TaskHostCache string
}

HostTaskInconsistency represents a mismatch between task and host documents. It contains both the host and task's view of their relationship. Implements the Error interface, which returns a full string describing the nature of the mismatch.

func AuditHostTaskConsistency

func AuditHostTaskConsistency() ([]HostTaskInconsistency, error)

AuditHostTaskConsistency finds all running tasks and running hosts and compares their caches of what host/task they are assigned to. Returns a slice of any mappings that are not 1:1 and any errors that occur.

NOTE: the error returned ONLY represents issues communicating with the database. HostTaskInconsistency implements the error interface, but it is up to the caller to cast the inconsistencies into an error type if they desire.

func (HostTaskInconsistency) Error

func (i HostTaskInconsistency) Error() string

Error returns a human-readible explanation of a HostTaskInconsistency.

type HostUtilizationBucket

type HostUtilizationBucket struct {
	StaticHost  time.Duration `json:"static_host" csv:"static_host"`
	DynamicHost time.Duration `json:"dynamic_host" csv:"dynamic_host"`
	Task        time.Duration `json:"task" csv:"task"`
	StartTime   time.Time     `json:"start_time" csv:"start_time"`
	EndTime     time.Time     `json:"end_time" csv:"end_time"`
}

HostUtilizationBucket represents an aggregate view of the hosts and tasks Bucket for a given time frame.

func CreateAllHostUtilizationBuckets

func CreateAllHostUtilizationBuckets(daysBack, granularity int) ([]HostUtilizationBucket, error)

CreateAllHostUtilizationBuckets aggregates each bucket by creating a time frame given the number of days back and the granularity wanted (ie. days, minutes, seconds, hours) all in seconds. It returns a list of Host utilization information for each bucket.

type KeyVal

type KeyVal struct {
	Key   string `bson:"_id" json:"key"`
	Value int64  `bson:"value" json:"value"`
}

func (*KeyVal) Inc

func (kv *KeyVal) Inc() error

type LogOpts

type LogOpts struct {
	Type         string `yaml:"type" bson:"type"`
	SplunkServer string `yaml:"splunk_server,omitempty" bson:"splunk_server,omitempty"`
	SplunkToken  string `yaml:"splunk_token,omitempty" bson:"splunk_token,omitempty"`
	LogDirectory string `yaml:"log_directory" bson:"log_directory"`
}

func (*LogOpts) IsValid

func (o *LogOpts) IsValid() error

type LoggerConfig

type LoggerConfig struct {
	Agent  []LogOpts `yaml:"agent" bson:"agent"`
	System []LogOpts `yaml:"system" bson:"system"`
	Task   []LogOpts `yaml:"task" bson:"task"`
}

func (*LoggerConfig) IsValid

func (c *LoggerConfig) IsValid() error

type Module

type Module struct {
	Name   string `yaml:"name,omitempty" bson:"name"`
	Branch string `yaml:"branch,omitempty" bson:"branch"`
	Repo   string `yaml:"repo,omitempty" bson:"repo"`
	Prefix string `yaml:"prefix,omitempty" bson:"prefix"`
	Ref    string `yaml:"ref,omitempty" bson:"ref"`
}

func (*Module) GetRepoOwnerAndName

func (m *Module) GetRepoOwnerAndName() (string, string)

type ModuleList

type ModuleList []Module

func (*ModuleList) IsIdentical

func (l *ModuleList) IsIdentical(m manifest.Manifest) bool

type Note

type Note struct {
	TaskId       string `bson:"_id" json:"-"`
	UnixNanoTime int64  `bson:"time" json:"time"`
	Content      string `bson:"content" json:"content"`
}

Note contains arbitrary information entered by an Evergreen user, scope to a task.

func NoteForTask

func NoteForTask(taskId string) (*Note, error)

NoteForTask returns the note for the given task Id, if it exists.

func (*Note) Upsert

func (n *Note) Upsert() error

Upsert overwrites an existing note.

type NotificationHistory

type NotificationHistory struct {
	Id                    mgobson.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 PerfCommitInfo

type PerfCommitInfo struct {
	Author     string    `json:"author"`
	Message    string    `json:"message"`
	CreateTime time.Time `json:"create_time"`
	Revision   string    `json:"revision"`
	VersionId  string    `json:"version_id"`
}

CommitInfo represents the information about the commit associated with the version of a given project. This is displayed at the top of each header for each project.

type PerfTaskForVersionId

type PerfTaskForVersionId struct {
	VersionId           string `bson:"vid"`
	RevisionOrderNumber int    `bson:"r"`
}

TaskForVersionId contains the id information about the group of tasks including the version id and the revision order number.

type PerfTaskInfo

type PerfTaskInfo struct {
	TaskId   string      `bson:"t_id" json:"task_id"`
	TaskName string      `bson:"tn" json:"task_name"`
	Variant  string      `bson:"var" json:"variant"`
	Data     interface{} `bson:"d" json:"data"`
}

TaskInfo contains the relevant TaskJSON information the tasks associated with a Version

type PerfTasksForVersion

type PerfTasksForVersion struct {
	Id    PerfTaskForVersionId `bson:"_id" json:"id"`
	Tasks []PerfTaskInfo       `bson:"t" json:"tasks"`
}

TasksForVersion is a list of tasks that are associated with a given version id.

type PerfVersionData

type PerfVersionData struct {
	JSONTasks    []PerfTaskInfo `json:"json_tasks"`
	Commit       PerfCommitInfo `json:"commit_info"`
	LastRevision bool           `json:"last_revision"`
}

VersionData includes the TaskInfo, and Commit information for a given Version

func PerfGetTasksForLatestVersion

func PerfGetTasksForLatestVersion(project, name string, skip int) (*PerfVersionData, error)

getTasksForLatestVersion sends back the TaskJSON data associated with the latest Version

type PeriodicBuildDefinition

type PeriodicBuildDefinition struct {
	ID            string `bson:"id" json:"id"`
	ConfigFile    string `bson:"config_file" json:"config_file"`
	IntervalHours int    `bson:"interval_hours" json:"interval_hours"`
	Alias         string `bson:"alias,omitempty" json:"alias,omitempty"`
	Message       string `bson:"message,omitempty" json:"message,omitempty"`
}

func (*PeriodicBuildDefinition) Validate

func (d *PeriodicBuildDefinition) Validate() error

type PickaxeParams

type PickaxeParams struct {
	Project           *Project
	TaskName          string
	NewestOrder       int64
	OldestOrder       int64
	BuildVariants     []string
	Tests             map[string]string
	OnlyMatchingTasks bool
}

type PluginCommandConf

type PluginCommandConf struct {
	Function string `yaml:"func,omitempty" bson:"func"`
	// Type is used to differentiate between setup related commands and actual
	// testing commands.
	Type string `yaml:"type,omitempty" bson:"type"`

	// DisplayName is a human readable description of the function of a given
	// command.
	DisplayName string `yaml:"display_name,omitempty" 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,omitempty" 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,omitempty" bson:"variants"`

	// TimeoutSecs indicates the maximum duration the command is allowed to run for.
	TimeoutSecs int `yaml:"timeout_secs,omitempty" bson:"timeout_secs"`

	// Params are used to supply configuration specific information.
	// map[string]interface{} is stored as a JSON string.
	Params map[string]interface{} `yaml:"params,omitempty" bson:"params"`

	// YAML string of Params to store in database
	ParamsYAML string `yaml:"params_yaml,omitempty" bson:"params_yaml"`

	// Vars defines variables that can be used within commands.
	Vars map[string]string `yaml:"vars,omitempty" bson:"vars"`

	Loggers *LoggerConfig `yaml:"loggers,omitempty" bson:"loggers,omitempty"`
}

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

func (*PluginCommandConf) UnmarshalYAML

func (c *PluginCommandConf) UnmarshalYAML(unmarshal func(interface{}) error) error

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,omitempty" bson:"enabled"`
	Stepback          bool                       `yaml:"stepback,omitempty" bson:"stepback"`
	PreErrorFailsTask bool                       `yaml:"pre_error_fails_task,omitempty" bson:"pre_error_fails_task,omitempty"`
	BatchTime         int                        `yaml:"batchtime,omitempty" bson:"batch_time"`
	Owner             string                     `yaml:"owner,omitempty" bson:"owner_name"`
	Repo              string                     `yaml:"repo,omitempty" bson:"repo_name"`
	RemotePath        string                     `yaml:"remote_path,omitempty" bson:"remote_path"`
	RepoKind          string                     `yaml:"repokind,omitempty" bson:"repo_kind"`
	Branch            string                     `yaml:"branch,omitempty" bson:"branch_name"`
	Identifier        string                     `yaml:"identifier,omitempty" bson:"identifier"`
	DisplayName       string                     `yaml:"display_name,omitempty" bson:"display_name"`
	CommandType       string                     `yaml:"command_type,omitempty" bson:"command_type"`
	Ignore            []string                   `yaml:"ignore,omitempty" bson:"ignore"`
	Pre               *YAMLCommandSet            `yaml:"pre,omitempty" bson:"pre"`
	Post              *YAMLCommandSet            `yaml:"post,omitempty" bson:"post"`
	Timeout           *YAMLCommandSet            `yaml:"timeout,omitempty" bson:"timeout"`
	CallbackTimeout   int                        `yaml:"callback_timeout_secs,omitempty" bson:"callback_timeout_secs"`
	Modules           ModuleList                 `yaml:"modules,omitempty" bson:"modules"`
	BuildVariants     BuildVariants              `yaml:"buildvariants,omitempty" bson:"build_variants"`
	Functions         map[string]*YAMLCommandSet `yaml:"functions,omitempty" bson:"functions"`
	TaskGroups        []TaskGroup                `yaml:"task_groups,omitempty" bson:"task_groups"`
	Tasks             []ProjectTask              `yaml:"tasks,omitempty" bson:"tasks"`
	ExecTimeoutSecs   int                        `yaml:"exec_timeout_secs,omitempty" bson:"exec_timeout_secs"`
	Loggers           *LoggerConfig              `yaml:"loggers,omitempty" bson:"loggers,omitempty"`

	// Flag that indicates a project as requiring user authentication
	Private bool `yaml:"private,omitempty" bson:"private"`
}

func FindLastKnownGoodProject

func FindLastKnownGoodProject(identifier string) (*Project, error)

func FindProjectFromVersionID

func FindProjectFromVersionID(versionStr string) (*Project, error)

func GetPatchedProject

func GetPatchedProject(ctx context.Context, p *patch.Patch, githubOauthToken string) (*Project, string, error)

GetPatchedProject creates and validates a project created by fetching latest commit information from GitHub and applying the patch to the latest remote configuration. Also returns the condensed yaml string for storage. The error returned can be a validation error.

func (*Project) BuildProjectTVPairs

func (p *Project) BuildProjectTVPairs(patchDoc *patch.Patch, alias string)

func (*Project) BuildProjectTVPairsWithAlias

func (p *Project) BuildProjectTVPairsWithAlias(alias string) ([]TVPair, []TVPair, error)

BuildProjectTVPairsWithAlias returns variants and tasks for a project alias.

func (*Project) FindAllBuildVariantTasks

func (p *Project) FindAllBuildVariantTasks() []BuildVariantTaskUnit

FindAllBuildVariantTasks returns every BuildVariantTaskUnit, fully populated, for all variants of a project.

func (*Project) FindAllVariants

func (p *Project) FindAllVariants() []string

func (*Project) FindBuildVariant

func (p *Project) FindBuildVariant(build string) *BuildVariant

func (*Project) FindDistroNameForTask

func (p *Project) FindDistroNameForTask(t *task.Task) (string, error)

func (*Project) FindProjectTask

func (p *Project) FindProjectTask(name string) *ProjectTask

func (*Project) FindTaskForVariant

func (p *Project) FindTaskForVariant(task, variant string) *BuildVariantTaskUnit

func (*Project) FindTaskGroup

func (p *Project) FindTaskGroup(name string) *TaskGroup

FindTaskGroup returns a specific task group from a project

func (*Project) FindTasksForVariant

func (p *Project) FindTasksForVariant(build string) []string

func (*Project) FindVariantsWithTask

func (p *Project) FindVariantsWithTask(task string) []string

FindVariantsWithTask returns the name of each variant containing the given task name.

func (*Project) GetModuleByName

func (p *Project) GetModuleByName(name string) (*Module, error)

func (Project) GetSpecForTask

func (p Project) GetSpecForTask(name string) ProjectTask

GetSpecForTask returns a ProjectTask spec for the given name. Returns an empty ProjectTask if none exists.

func (*Project) GetVariantMappings

func (p *Project) GetVariantMappings() map[string]string

func (*Project) IgnoresAllFiles

func (p *Project) IgnoresAllFiles(files []string) bool

IgnoresAllFiles takes in a slice of filepaths and checks to see if all files are matched by the project's Ignore regular expressions.

func (*Project) IsGenerateTask

func (p *Project) IsGenerateTask(taskName string) bool

IsGenerateTask indicates that the task generates other tasks, which the scheduler will use to prioritize this task.

func (*Project) TasksThatCallCommand

func (p *Project) TasksThatCallCommand(find string) map[string]int

TasksThatCallCommand returns a map of tasks that call a given command.

type ProjectAlias

type ProjectAlias struct {
	ID          mgobson.ObjectId `bson:"_id" json:"_id"`
	ProjectID   string           `bson:"project_id" json:"project_id"`
	Alias       string           `bson:"alias" json:"alias"`
	Variant     string           `bson:"variant,omitempty" json:"variant"`
	VariantTags []string         `bson:"variant_tags,omitempty" json:"variant_tags"`
	Task        string           `bson:"task,omitempty" json:"task"`
	TaskTags    []string         `bson:"tags,omitempty" json:"tags"`
}

ProjectAlias defines a single alias mapping an alias name to two regexes which define the variants and tasks for the alias. Users can use these aliases for operations within the system.

For example, a user can specify that alias with the CLI tool so that a project admin can define a set of default builders for patch builds. Pull request testing uses a special alias, "__github" to determine the default variants and tasks to run in a patch build.

An alias can be specified multiple times. The resulting variant/task combinations are the union of the aliases. For example, a user might set the following:

ALIAS VARIANTS TASKS __github .*linux.* .*test.* __github ^ubuntu1604.*$ ^compile.*$

This will cause a GitHub pull request to create and finalize a patch which runs all tasks containing the string “test” on all variants containing the string “linux”; and to run all tasks beginning with the string “compile” to run on all variants beginning with the string “ubuntu1604”.

func FindAliasInProject

func FindAliasInProject(projectID, alias string) ([]ProjectAlias, error)

FindAliasInProject finds all aliases with a given name for a project.

func FindAliasesForProject

func FindAliasesForProject(projectID string) ([]ProjectAlias, error)

FindAliasesForProject fetches all aliases for a given project

func (*ProjectAlias) Upsert

func (p *ProjectAlias) Upsert() error

type ProjectAliases

type ProjectAliases []ProjectAlias

func (ProjectAliases) HasMatchingTask

func (a ProjectAliases) HasMatchingTask(variant string, variantTags []string, t *ProjectTask) (bool, error)

func (ProjectAliases) HasMatchingVariant

func (a ProjectAliases) HasMatchingVariant(variant string, variantTags []string) (bool, error)

type ProjectChangeEvent

type ProjectChangeEvent struct {
	User   string               `bson:"user" json:"user"`
	Before ProjectSettingsEvent `bson:"before" json:"before"`
	After  ProjectSettingsEvent `bson:"after" json:"after"`
}

type ProjectChangeEventEntry

type ProjectChangeEventEntry struct {
	event.EventLogEntry
}

func (*ProjectChangeEventEntry) MarshalBSON

func (e *ProjectChangeEventEntry) MarshalBSON() ([]byte, error)

func (*ProjectChangeEventEntry) SetBSON

func (e *ProjectChangeEventEntry) SetBSON(raw mgobson.Raw) error

func (*ProjectChangeEventEntry) UnmarshalBSON

func (e *ProjectChangeEventEntry) UnmarshalBSON(in []byte) error

type ProjectChangeEvents

type ProjectChangeEvents []ProjectChangeEventEntry

func MostRecentProjectEvents

func MostRecentProjectEvents(id string, n int) (ProjectChangeEvents, error)

Project Events queries

func ProjectEventsBefore

func ProjectEventsBefore(id string, before time.Time, n int) (ProjectChangeEvents, error)

func (*ProjectChangeEvents) RedactPrivateVars

func (p *ProjectChangeEvents) RedactPrivateVars()

type ProjectNotificationTime

type ProjectNotificationTime struct {
	ProjectName               string    `bson:"_id"`
	LastNotificationEventTime time.Time `bson:"last_notification_event_time"`
}

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"`
	DeactivatePrevious bool   `bson:"deactivate_previous" json:"deactivate_previous" yaml:"deactivate_previous"`

	// TracksPushEvents, if true indicates that Repotracker is triggered by
	// Github PushEvents for this project, instead of the Repotracker runner
	TracksPushEvents bool `bson:"tracks_push_events" json:"tracks_push_events" yaml:"tracks_push_events"`

	PRTestingEnabled bool              `bson:"pr_testing_enabled" json:"pr_testing_enabled" yaml:"pr_testing_enabled"`
	CommitQueue      CommitQueueParams `bson:"commit_queue" json:"commit_queue" yaml:"commit_queue"`

	//Tracked determines whether or not the project is discoverable in the UI
	Tracked          bool `bson:"tracked" json:"tracked"`
	PatchingDisabled bool `bson:"patching_disabled" json:"patching_disabled"`

	// Admins contain a list of users who are able to access the projects page.
	Admins []string `bson:"admins" json:"admins"`

	NotifyOnBuildFailure bool `bson:"notify_on_failure" json:"notify_on_failure"`

	// RepoDetails contain the details of the status of the consistency
	// between what is in GitHub and what is in Evergreen
	RepotrackerError *RepositoryErrorDetails `bson:"repotracker_error" json:"repotracker_error"`

	// List of regular expressions describing files to ignore when caching historical test results
	FilesIgnoredFromCache []string `bson:"files_ignored_from_cache,omitempty" json:"files_ignored_from_cache,omitempty"`
	DisabledStatsCache    bool     `bson:"disabled_stats_cache,omitempty" json:"disabled_stats_cache,omitempty"`

	Triggers       []TriggerDefinition       `bson:"triggers,omitempty" json:"triggers,omitempty"`
	PeriodicBuilds []PeriodicBuildDefinition `bson:"periodic_builds,omitempty" json:"periodic_builds,omitempty"`
}

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 FindAllTrackedProjectRefsWithRepoInfo

func FindAllTrackedProjectRefsWithRepoInfo() ([]ProjectRef, error)

func FindDownstreamProjects

func FindDownstreamProjects(project string) ([]ProjectRef, error)

func FindFirstProjectRef

func FindFirstProjectRef() (*ProjectRef, error)

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 FindOneProjectRefByRepoAndBranchWithPRTesting

func FindOneProjectRefByRepoAndBranchWithPRTesting(owner, repo, branch string) (*ProjectRef, error)

FindOneProjectRefByRepoAndBranch finds a signle ProjectRef with matching repo/branch that is enabled and setup for PR testing. If more than one is found, an error is returned

func FindOneProjectRefWithCommitQueueByOwnerRepoAndBranch

func FindOneProjectRefWithCommitQueueByOwnerRepoAndBranch(owner, repo, branch string) (*ProjectRef, error)

FindOneProjectRef finds the project ref for this owner/repo/branch that has the commit queue enabled. There should only ever be one project for the query because we only enable commit queue if no other project ref with the same specification has it enabled.

func FindPeriodicProjects

func FindPeriodicProjects() ([]ProjectRef, error)

func FindProjectRefs

func FindProjectRefs(key string, limit int, sortDir int) ([]ProjectRef, error)

FindProjectRefs returns limit refs starting at project identifier key in the sortDir direction

func FindProjectRefsByRepoAndBranch

func FindProjectRefsByRepoAndBranch(owner, repoName, branch string) ([]ProjectRef, error)

FindProjectRefsByRepoAndBranch finds ProjectRefs with matching repo/branch that are enabled and setup for PR testing

func FindProjectRefsWithCommitQueueEnabled

func FindProjectRefsWithCommitQueueEnabled() ([]ProjectRef, error)

func (*ProjectRef) CanEnableCommitQueue

func (projectRef *ProjectRef) CanEnableCommitQueue() (bool, error)

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) IsAdmin

func (p *ProjectRef) IsAdmin(userID string, settings evergreen.Settings) bool

func (*ProjectRef) String

func (projectRef *ProjectRef) String() string

ProjectRef returns a string representation of a ProjectRef

func (*ProjectRef) Update

func (projectRef *ProjectRef) Update() error

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 ProjectSettingsEvent

type ProjectSettingsEvent struct {
	ProjectRef         ProjectRef           `bson:"proj_ref" json:"proj_ref"`
	GitHubHooksEnabled bool                 `bson:"github_hooks_enabled" json:"github_hooks_enabled"`
	Vars               ProjectVars          `bson:"vars" json:"vars"`
	Aliases            []ProjectAlias       `bson:"aliases" json:"aliases"`
	Subscriptions      []event.Subscription `bson:"subscriptions" json:"subscriptions"`
}

type ProjectTask

type ProjectTask struct {
	Name            string                `yaml:"name,omitempty" bson:"name"`
	Priority        int64                 `yaml:"priority,omitempty" bson:"priority"`
	ExecTimeoutSecs int                   `yaml:"exec_timeout_secs,omitempty" bson:"exec_timeout_secs"`
	DependsOn       []TaskUnitDependency  `yaml:"depends_on,omitempty" bson:"depends_on"`
	Requires        []TaskUnitRequirement `yaml:"requires,omitempty" bson:"requires"`
	Commands        []PluginCommandConf   `yaml:"commands,omitempty" bson:"commands"`
	Tags            []string              `yaml:"tags,omitempty" bson:"tags"`
	// 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
	Patchable *bool `yaml:"patchable,omitempty" bson:"patchable,omitempty"`
	Stepback  *bool `yaml:"stepback,omitempty" bson:"stepback,omitempty"`
	PatchOnly *bool `yaml:"patch_only,omitempty" bson:"patch_only,omitempty"`
}

Unmarshalled from the "tasks" list in the project file

type ProjectVars

type ProjectVars struct {

	//Should match the identifier of 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"`

	//PrivateVars keeps track of which variables are private and should therefore not
	//be returned to the UI server.
	PrivateVars map[string]bool `bson:"private_vars" json:"private_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) FindAndModify

func (projectVars *ProjectVars) FindAndModify(varsToDelete []string) (*adb.ChangeInfo, error)

func (*ProjectVars) Insert

func (projectVars *ProjectVars) Insert() error

func (*ProjectVars) RedactPrivateVars

func (projectVars *ProjectVars) RedactPrivateVars()

func (*ProjectVars) Upsert

func (projectVars *ProjectVars) Upsert() (*adb.ChangeInfo, error)

type PushLog

type PushLog struct {
	Id mgobson.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 FindOnePushLog(query interface{}, projection interface{},
	sort []string) (*PushLog, error)

func FindPushLogAfter

func FindPushLogAfter(fileLoc string, revisionOrderNumber int) (*PushLog, error)

FindNewerPushLog returns a PushLog item if there is a file pushed from this version or a newer one, or one already in progress.

func NewPushLog

func NewPushLog(v *Version, task *task.Task, location string) *PushLog

func (*PushLog) Insert

func (self *PushLog) Insert() error

func (*PushLog) UpdateStatus

func (self *PushLog) UpdateStatus(newStatus string) error

type QuestionAnswer

type QuestionAnswer struct {
	ID     string `json:"id" bson:"id"`
	Prompt string `json:"prompt" bson:"prompt"`
	Answer string `json:"answer" bson:"answer"`
}

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 RepositoryErrorDetails

type RepositoryErrorDetails struct {
	Exists            bool   `bson:"exists" json:"exists"`
	InvalidRevision   string `bson:"invalid_revision" json:"invalid_revision"`
	MergeBaseRevision string `bson:"merge_base_revision" json:"merge_base_revision"`
}

RepositoryErrorDetails indicates whether or not there is an invalid revision and if there is one, what the guessed merge base revision is.

type ResourceInfo

type ResourceInfo struct {
	Id    string      `json:"id"`
	Start time.Time   `json:"start"`
	End   time.Time   `json:"end"`
	Data  interface{} `json:"data"`
}

ResourceInfo contains the meta data about a given resource This includes the id of the resource, the overall start and finish time and any extra data that should be included about the resource.

type RestartOptions

type RestartOptions struct {
	DryRun    bool      `bson:"dry_run" json:"dry_run"`
	StartTime time.Time `bson:"start_time" json:"start_time"`
	EndTime   time.Time `bson:"end_time" json:"end_time"`
	User      string    `bson:"user" json:"user"`

	// note that the bson tags are not quite accurate, but are kept around for backwards compatibility
	IncludeTestFailed  bool `bson:"only_red" json:"only_red"`
	IncludeSysFailed   bool `bson:"only_purple" json:"only_purple"`
	IncludeSetupFailed bool `bson:"include_setup_failed" json:"include_setup_failed"`
}

type RestartResults

type RestartResults struct {
	ItemsRestarted []string
	ItemsErrored   []string
}

func RestartFailedTasks

func RestartFailedTasks(opts RestartOptions) (RestartResults, error)

RestartFailedTasks attempts to restart failed tasks that started between 2 times It returns a slice of task IDs that were successfully restarted as well as a slice of task IDs that failed to restart opts.dryRun will return the tasks that will be restarted if sent true opts.red and opts.purple will only restart tasks that were failed due to the test or due to the system, respectively

type Revision

type Revision struct {
	Author          string
	AuthorGithubUID int
	AuthorEmail     string
	RevisionMessage string
	Revision        string
	CreateTime      time.Time
}

type S3CopyRequest

type S3CopyRequest struct {
	AwsKey              string `json:"aws_key"`
	AwsSecret           string `json:"aws_secret"`
	S3SourceBucket      string `json:"s3_source_bucket"`
	S3SourcePath        string `json:"s3_source_path"`
	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 Selector

type Selector []selectCriterion

Selector holds the information necessary to build a set of elements based on name and tag combinations.

func ParseSelector

func ParseSelector(s string) Selector

ParseSelector reads in a set of selection criteria defined as a string. This function only parses; it does not evaluate. Returns nil on an empty selection string.

func (Selector) String

func (s Selector) String() string

String returns a readable representation of the Selector.

type StatusChanges

type StatusChanges struct {
	PatchNewStatus   string
	VersionNewStatus string
	VersionComplete  bool
	BuildNewStatus   string
	BuildComplete    bool
}

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

type StatusDiff struct {
	Original string `json:"original"`
	Patch    string `json:"patch"`
}

StatusDiff stores a pairing of status strings for easy visualization/aggregation later.

type StuckHostInconsistency

type StuckHostInconsistency struct {
	Host        string `bson:"host_id"`
	RunningTask string `bson:"running_task"`
	TaskStatus  string `bson:"task_status"`
}

StuckHostInconsistncy represents hosts that have running tasks but the tasks have been marked as completed.

func CheckStuckHosts

func CheckStuckHosts() ([]StuckHostInconsistency, error)

CheckStuckHosts queries for hosts that tasks that are completed but that still have them as a running task

func (StuckHostInconsistency) Error

func (shi StuckHostInconsistency) Error() string

type TVPair

type TVPair struct {
	Variant  string
	TaskName string
}

TVPair is a helper type for mapping bv/task pairs to ids.

func IncludePatchDependencies

func IncludePatchDependencies(project *Project, tvpairs []TVPair) []TVPair

IncludePatchDependencies takes a project and a slice of variant/task pairs names and returns the expanded set of variant/task pairs to include all the dependencies/requirements for the given set of tasks. If any dependency is cross-variant, it will include the variant and task for that dependency.

func (TVPair) String

func (p TVPair) String() string

String returns the pair's name in a readable form.

type TVPairSet

type TVPairSet []TVPair

func (TVPairSet) ByVariant

func (tvps TVPairSet) ByVariant(variant string) TVPairSet

ByVariant returns a list of TVPairs filtered to include only those for the given variant

func (TVPairSet) TaskNames

func (tvps TVPairSet) TaskNames(variant string) []string

TaskNames extracts the unique set of task names for a given variant in the set of task/variant pairs.

type TagContainer

type TagContainer struct {
	Tag string `bson:"_id" json:"tag"`
}

func GetTaskJSONTags

func GetTaskJSONTags(taskId string) ([]TagContainer, error)

GetTags finds TaskJSONs that have tags in the project associated with a given task.

type TaskConfig

type TaskConfig struct {
	Distro          *distro.Distro
	Version         *Version
	ProjectRef      *ProjectRef
	Project         *Project
	Task            *task.Task
	BuildVariant    *BuildVariant
	Expansions      *util.Expansions
	Redacted        map[string]bool
	WorkDir         string
	GithubPatchData patch.GithubPatch
	Timeout         *Timeout
	// contains filtered or unexported fields
}

func MakeConfigFromTask

func MakeConfigFromTask(t *task.Task) (*TaskConfig, error)

func NewTaskConfig

func NewTaskConfig(d *distro.Distro, v *Version, p *Project, t *task.Task, r *ProjectRef, patchDoc *patch.Patch, e util.Expansions) (*TaskConfig, error)

func (*TaskConfig) GetExecTimeout

func (t *TaskConfig) GetExecTimeout() int

func (*TaskConfig) GetIdleTimeout

func (t *TaskConfig) GetIdleTimeout() int

func (*TaskConfig) GetWorkingDirectory

func (c *TaskConfig) GetWorkingDirectory(dir string) (string, error)

func (*TaskConfig) SetExecTimeout

func (t *TaskConfig) SetExecTimeout(timeout int)

func (*TaskConfig) SetIdleTimeout

func (t *TaskConfig) SetIdleTimeout(timeout int)

type TaskDep

type TaskDep struct {
	Id          string `bson:"task_id,omitempty" json:"task_id"`
	DisplayName string `bson:"display_name" json:"display_name"`
}

type TaskDetails

type TaskDetails struct {
	TimedOut bool   `bson:"timed_out"`
	Status   string `bson:"st"`
}

type TaskGroup

type TaskGroup struct {
	Name string `yaml:"name" bson:"name"`

	// data about the task group
	MaxHosts              int             `yaml:"max_hosts" bson:"max_hosts"`
	SetupGroupFailTask    bool            `yaml:"setup_group_can_fail_task" bson:"setup_group_can_fail_task"`
	SetupGroupTimeoutSecs int             `yaml:"setup_group_timeout_secs" bson:"setup_group_timeout_secs"`
	SetupGroup            *YAMLCommandSet `yaml:"setup_group" bson:"setup_group"`
	TeardownGroup         *YAMLCommandSet `yaml:"teardown_group" bson:"teardown_group"`
	SetupTask             *YAMLCommandSet `yaml:"setup_task" bson:"setup_task"`
	TeardownTask          *YAMLCommandSet `yaml:"teardown_task" bson:"teardown_task"`
	Timeout               *YAMLCommandSet `yaml:"timeout,omitempty" bson:"timeout"`
	Tasks                 []string        `yaml:"tasks" bson:"tasks"`
	Tags                  []string        `yaml:"tags,omitempty" bson:"tags"`
	// ShareProcs causes processes to persist between task group tasks.
	ShareProcs bool `yaml:"share_processes" bson:"share_processes"`
}

func GetTaskGroup

func GetTaskGroup(taskGroup string, tc *TaskConfig) (*TaskGroup, error)

GetTaskGroup returns the task group for a given task from its project

func (*TaskGroup) InjectInfo

func (tg *TaskGroup) InjectInfo(t *task.Task)

type TaskGroupInfo

type TaskGroupInfo struct {
	Name                  string        `bson:"name" json:"name"`
	Count                 int           `bson:"count" json:"count"`
	MaxHosts              int           `bson:"max_hosts" json:"max_hosts"`
	ExpectedDuration      time.Duration `bson:"expected_duration" json:"expected_duration"`
	CountOverThreshold    int           `bson:"count_over_threshold" json:"count_over_threshold"`
	DurationOverThreshold time.Duration `bson:"duration_over_threshold" json:"duration_over_threshold"`
}

type TaskHistory

type TaskHistory struct {
	Id    string                  `bson:"_id" json:"_id"`
	Order string                  `bson:"order" json:"order"`
	Tasks []aggregatedTaskHistory `bson:"tasks" json:"tasks"`
}

type TaskHistoryChunk

type TaskHistoryChunk struct {
	Tasks       []bson.M
	Versions    []Version
	FailedTests map[string][]task.TestResult
	Exhausted   ExhaustedIterator
}

type TaskHistoryIterator

type TaskHistoryIterator interface {
	GetChunk(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 TaskIdConfig

type TaskIdConfig struct {
	ExecutionTasks TaskIdTable
	DisplayTasks   TaskIdTable
}

func NewPatchTaskIdTable

func NewPatchTaskIdTable(proj *Project, v *Version, tasks TaskVariantPairs) TaskIdConfig

NewPatchTaskIdTable constructs a new TaskIdTable (map of [variant, task display name]->[task id])

func NewTaskIdTable

func NewTaskIdTable(p *Project, v *Version, sourceRev, defID string) TaskIdConfig

TaskIdTable builds a TaskIdTable for the given version and project

type TaskIdTable

type TaskIdTable map[TVPair]string

TaskIdTable is a map of [variant, task display name]->[task id].

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(taskName string) []string

GetIdsForAllVariants returns all task Ids for taskName on all variants.

func (TaskIdTable) GetIdsForAllVariantsExcluding

func (tt TaskIdTable) GetIdsForAllVariantsExcluding(taskName string, exclude TVPair) []string

GetIdsForAllVariants returns all task Ids for taskName on all variants, excluding the specific task denoted by the task/variant pair.

type TaskJSON

type TaskJSON struct {
	Name                string                 `bson:"name" json:"name"`
	TaskName            string                 `bson:"task_name" json:"task_name"`
	ProjectId           string                 `bson:"project_id" json:"project_id"`
	TaskId              string                 `bson:"task_id" json:"task_id"`
	BuildId             string                 `bson:"build_id" json:"build_id"`
	Variant             string                 `bson:"variant" json:"variant"`
	VersionId           string                 `bson:"version_id" json:"version_id"`
	CreateTime          time.Time              `bson:"create_time" json:"create_time"`
	IsPatch             bool                   `bson:"is_patch" json:"is_patch"`
	RevisionOrderNumber int                    `bson:"order" json:"order"`
	Revision            string                 `bson:"revision" json:"revision"`
	Data                map[string]interface{} `bson:"data" json:"data"`
	Tag                 string                 `bson:"tag" json:"tag"`
}

func GetTaskJSONById

func GetTaskJSONById(taskId, name string) (TaskJSON, error)

GetTaskById fetches a JSONTask with the corresponding task id.

func GetTaskJSONByName

func GetTaskJSONByName(version, buildId, taskName, name string) (TaskJSON, error)

GetTaskByName finds a taskdata document by using the name of the task and other identifying information.

func GetTaskJSONByTag

func GetTaskJSONByTag(projectId, tag, variant, taskName, name string) (*TaskJSON, error)

GetTaskJSONByTag finds a TaskJSON by a tag

func GetTaskJSONCommit

func GetTaskJSONCommit(projectId, revision, variant, taskName, name string) (TaskJSON, error)

GetTaskJSONCommit gets the task data associated with a particular task by using the commit hash to find the data. FIXME Given set of parameters is not specific enough

it drops all other results which matches condition (due to findOne)

func GetTaskJSONForVariant

func GetTaskJSONForVariant(version, variantId, taskName, name string) (TaskJSON, error)

GetTaskJSONForVariant finds a task by name and variant and finds the document in the json collection associated with that task's id.

func GetTaskJSONHistory

func GetTaskJSONHistory(t *task.Task, name string) ([]TaskJSON, error)

func GetTaskJSONTagsForTask

func GetTaskJSONTagsForTask(project, buildVariant, taskName, name string) ([]TaskJSON, error)

GetTagsForTask gets all of the tasks with tags for the given task name and build variant.

func PerfGetTasksForVersion

func PerfGetTasksForVersion(versionId, name string) ([]TaskJSON, error)

getTasksForVersion sends back the list of TaskJSON documents associated with a version id.

type TaskJSONTag

type TaskJSONTag struct {
	Name string          `bson:"_id" json:"name"`
	Obj  TaskJSONTagMeta `bson:"obj" json:"obj"`
}

func GetDistinctTagNames

func GetDistinctTagNames(projectId string) ([]TaskJSONTag, error)

Returns distinct list of all tags for given `projectId`

type TaskJSONTagMeta

type TaskJSONTagMeta struct {
	Created   time.Time `bson:"created" json:"created"`
	Revision  string    `bson:"revision" json:"revision"`
	VersionId string    `bson:"version_id" json:"version_id"`
}

type TaskLog

type TaskLog struct {
	Id           string                 `bson:"_id" 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     []apimodels.LogMessage `bson:"m" json:"m"`
}

a single chunk of a task log

func FindAllTaskLogs

func FindAllTaskLogs(taskId string, execution int) ([]TaskLog, error)

func FindMostRecentTaskLogs

func FindMostRecentTaskLogs(taskId string, execution int, limit int) ([]TaskLog, error)

func FindTaskLogsBeforeTime

func FindTaskLogsBeforeTime(taskId string, execution int, ts time.Time, limit int) ([]TaskLog, error)

func (*TaskLog) AddLogMessage

func (self *TaskLog) AddLogMessage(msg apimodels.LogMessage) error

func (*TaskLog) Insert

func (self *TaskLog) Insert() error

func (*TaskLog) MarshalBSON

func (t *TaskLog) MarshalBSON() ([]byte, error)

func (*TaskLog) UnmarshalBSON

func (t *TaskLog) UnmarshalBSON(in []byte) error

type TaskQueue

type TaskQueue struct {
	Id              mgobson.ObjectId `bson:"_id,omitempty" json:"_id"`
	Distro          string           `bson:"distro" json:"distro"`
	GeneratedAt     time.Time        `bson:"generated_at" json:"generated_at"`
	Queue           []TaskQueueItem  `bson:"queue" json:"queue"`
	DistroQueueInfo DistroQueueInfo  `bson:"distro_queue_info" json:"distro_queue_info"`
	// contains filtered or unexported fields
}

represents the next n tasks to be run on hosts of the distro

func FindAllTaskQueues

func FindAllTaskQueues() ([]TaskQueue, error)

func FindDistroAliasTaskQueue

func FindDistroAliasTaskQueue(distroID string) (TaskQueue, error)

func FindDistroTaskQueue

func FindDistroTaskQueue(distroID string) (TaskQueue, error)

func LoadDistroAliasTaskQueue

func LoadDistroAliasTaskQueue(distroID string) (*TaskQueue, error)

func LoadTaskQueue

func LoadTaskQueue(distro string) (*TaskQueue, error)

func NewTaskQueue

func NewTaskQueue(distroID string, queue []TaskQueueItem, distroQueueInfo DistroQueueInfo) *TaskQueue

func (*TaskQueue) DequeueTask

func (self *TaskQueue) DequeueTask(taskId string) error

pull out the task with the specified id from both the in-memory and db versions of the task queue

func (*TaskQueue) FindNextTask

func (self *TaskQueue) FindNextTask(spec TaskSpec) *TaskQueueItem

func (*TaskQueue) Length

func (self *TaskQueue) Length() int

func (*TaskQueue) NextTask

func (self *TaskQueue) NextTask() *TaskQueueItem

func (*TaskQueue) Save

func (self *TaskQueue) Save() error

type TaskQueueItem

type TaskQueueItem struct {
	Id                  string        `bson:"_id" json:"_id"`
	IsDispatched        bool          `bson:"dispatched" json:"dispatched"`
	DisplayName         string        `bson:"display_name" json:"display_name"`
	Group               string        `bson:"group_name" json:"group_name"`
	GroupMaxHosts       int           `bson:"group_max_hosts,omitempty" json:"group_max_hosts,omitempty"`
	GroupIndex          int           `bson:"group_index,omitempty" json:"group_index,omitempty"`
	Version             string        `bson:"version" json:"version"`
	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"`
	Priority            int64         `bson:"priority" json:"priority"`
	Dependencies        []string      `bson:"dependencies" json:"dependencies"`
}

type TaskQueueItemDispatcher

type TaskQueueItemDispatcher interface {
	FindNextTask(string, TaskSpec) (*TaskQueueItem, error)
	Refresh(string) error
	RefreshFindNextTask(string, TaskSpec) (*TaskQueueItem, error)
}

func NewTaskDispatchAliasService

func NewTaskDispatchAliasService(ttl time.Duration) TaskQueueItemDispatcher

func NewTaskDispatchService

func NewTaskDispatchService(ttl time.Duration) TaskQueueItemDispatcher

type TaskSpec

type TaskSpec struct {
	Group         string `json:"group"`
	BuildVariant  string `json:"build_variant"`
	Project       string `json:"project"`
	Version       string `json:"version"`
	GroupMaxHosts int    `json:"group_max_hosts"`
}

TaskSpec is an argument structure to formalize the way that callers may query/select a task from an existing task queue to support out-of-order task execution for the purpose of task-groups.

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.Task, patch *task.Task) TaskStatusDiff

StatusDiffTasks takes two tasks and returns a diff of their results for easy comparison and analysis.

type TaskUnitDependency

type TaskUnitDependency struct {
	Name          string `yaml:"name,omitempty" bson:"name"`
	Variant       string `yaml:"variant,omitempty" bson:"variant,omitempty"`
	Status        string `yaml:"status,omitempty" bson:"status,omitempty"`
	PatchOptional bool   `yaml:"patch_optional,omitempty" bson:"patch_optional,omitempty"`
}

TaskUnitDependency holds configuration information about a task/group that must finish before the task/group that contains the dependency can run.

func (*TaskUnitDependency) UnmarshalYAML

func (td *TaskUnitDependency) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML allows tasks to be referenced as single selector strings. This works by first attempting to unmarshal the YAML into a string and then falling back to the TaskUnitDependency struct.

type TaskUnitRequirement

type TaskUnitRequirement struct {
	Name    string `yaml:"name,omitempty" bson:"name"`
	Variant string `yaml:"variant,omitempty" bson:"variant,omitempty"`
}

TaskUnitRequirement represents tasks/groups that must exist along with the requirement's holder. This is only used when configuring patches.

type TaskVariantPairs

type TaskVariantPairs struct {
	ExecTasks    TVPairSet
	DisplayTasks TVPairSet
}

func VariantTasksToTVPairs

func VariantTasksToTVPairs(in []patch.VariantTasks) TaskVariantPairs

VariantTasksToTVPairs takes a set of variants and tasks (from both the old and new request formats) and builds a universal set of pairs that can be used to expand the dependency tree.

func (*TaskVariantPairs) TVPairsToVariantTasks

func (tvp *TaskVariantPairs) TVPairsToVariantTasks() []patch.VariantTasks

TVPairsToVariantTasks takes a list of TVPairs (task/variant pairs), groups the tasks for the same variant together under a single list, and return all the variant groups as a set of patch.VariantTasks.

type TestHistoryParameters

type TestHistoryParameters struct {
	Sort  int `json:"sort"`
	Limit int `json:"limit"`

	// task parameters
	Project         string    `json:"project"`
	TaskNames       []string  `json:"task_names"`
	BuildVariants   []string  `json:"variants"`
	TaskStatuses    []string  `json:"task_statuses"`
	BeforeRevision  string    `json:"before_revision"`
	AfterRevision   string    `json:"after_revision"`
	TaskRequestType string    `json:"task_request"`
	BeforeDate      time.Time `json:"before_date"`
	AfterDate       time.Time `json:"after_date"`

	// test result parameters
	TestNames    []string `json:"test_names"`
	TestStatuses []string `json:"test_statuses"`
}

TestHistoryParameters are the parameters that are used to retrieve Test Results.

func (TestHistoryParameters) QueryString

func (t TestHistoryParameters) QueryString() string

func (*TestHistoryParameters) SetDefaultsAndValidate

func (thp *TestHistoryParameters) SetDefaultsAndValidate() error

setDefaultsAndValidate sets the default for test history parameters that do not have values and validates the test parameters.

type TestHistoryResult

type TestHistoryResult struct {
	TestFile        string  `bson:"tf"`
	TaskName        string  `bson:"tn"`
	TaskStatus      string  `bson:"task_status"`
	TestStatus      string  `bson:"test_status"`
	Revision        string  `bson:"r"`
	Project         string  `bson:"p"`
	TaskId          string  `bson:"tid"`
	BuildVariant    string  `bson:"bv"`
	StartTime       float64 `bson:"st"`
	EndTime         float64 `bson:"et"`
	Execution       int     `bson:"ex"`
	Url             string  `bson:"url"`
	UrlRaw          string  `bson:"url_r"`
	OldTaskId       string  `bson:"otid"`
	TaskTimedOut    bool    `bson:"to"`
	TaskDetailsType string  `bson:"tdt"`
	LogId           string  `bson:"lid"`
	Order           int     `bson:"order"`
}

TestHistoryResult represents what is returned by the aggregation

func GetTestHistory

func GetTestHistory(testHistoryParameters *TestHistoryParameters) ([]TestHistoryResult, error)

GetTestHistory takes in test history parameters, validates them, and returns the test results according to those parameters. It sets tasks failed and tests failed as default statuses if none are provided, and defaults to all tasks, tests, and variants if those are not set.

func GetTestHistoryV2

func GetTestHistoryV2(testHistoryParameters *TestHistoryParameters) ([]TestHistoryResult, error)

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

func FindOneTestLog(name, task string, execution int) (*TestLog, error)

FindOneTestLog returns a TestLog, given the test's name, task id, and execution.

func FindOneTestLogById

func FindOneTestLogById(id string) (*TestLog, error)

func (*TestLog) Insert

func (self *TestLog) Insert() error

Insert inserts the TestLog into the database

func (*TestLog) URL

func (self *TestLog) URL() string

URL returns the path to access the log based on its current fields. Does not error if fields are not set.

func (*TestLog) Validate

func (self *TestLog) Validate() error

Validate makes sure the log will accessible in the database before the log itself is inserted. Returns an error if something is wrong.

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 TestSuite

type TestSuite struct {
	Name  string `yaml:"name,omitempty"`
	Phase string `yaml:"phase,omitempty"`
}

type Timeout

type Timeout struct {
	IdleTimeoutSecs int
	ExecTimeoutSecs int
}

type TriggerDefinition

type TriggerDefinition struct {
	// completion of specified task(s) in the project listed here will cause a build in the current project
	Project string `bson:"project" json:"project"`
	Level   string `bson:"level" json:"level"` //build or task
	//used to enforce that only 1 version gets created from a given upstream commit + trigger combo
	DefinitionID string `bson:"definition_id" json:"definition_id"`

	// filters for this trigger
	BuildVariantRegex string `bson:"variant_regex,omitempty" json:"variant_regex,omitempty"`
	TaskRegex         string `bson:"task_regex,omitempty" json:"task_regex,omitempty"`
	Status            string `bson:"status,omitempty" json:"status,omitempty"`
	DateCutoff        *int   `bson:"date_cutoff,omitempty" json:"date_cutoff,omitempty"`

	// definitions for tasks to run for this trigger
	ConfigFile   string `bson:"config_file,omitempty" json:"config_file,omitempty"`
	Command      string `bson:"command,omitempty" json:"command,omitempty"`
	GenerateFile string `bson:"generate_file,omitempty" json:"generate_file,omitempty"`
	Alias        string `bson:"alias,omitempty" json:"alias,omitempty"`
}

func (TriggerDefinition) Validate

func (t TriggerDefinition) Validate(parentProject string) error

type Version

type Version struct {
	Id                  string               `bson:"_id" json:"id,omitempty"`
	CreateTime          time.Time            `bson:"create_time" json:"create_time,omitempty"`
	StartTime           time.Time            `bson:"start_time" json:"start_time,omitempty"`
	FinishTime          time.Time            `bson:"finish_time" json:"finish_time,omitempty"`
	Revision            string               `bson:"gitspec" json:"revision,omitempty"`
	Author              string               `bson:"author" json:"author,omitempty"`
	AuthorEmail         string               `bson:"author_email" json:"author_email,omitempty"`
	Message             string               `bson:"message" json:"message,omitempty"`
	Status              string               `bson:"status" json:"status,omitempty"`
	RevisionOrderNumber int                  `bson:"order,omitempty" json:"order,omitempty"`
	ParserProject       *parserProject       `bson:"project" json:"project,omitempty"`
	Config              string               `bson:"config" json:"config,omitempty"`
	ConfigUpdateNumber  int                  `bson:"config_number" json:"config_number,omitempty"`
	Ignored             bool                 `bson:"ignored" json:"ignored"`
	Owner               string               `bson:"owner_name" json:"owner_name,omitempty"`
	Repo                string               `bson:"repo_name" json:"repo_name,omitempty"`
	Branch              string               `bson:"branch_name" json:"branch_name,omitempty"`
	RepoKind            string               `bson:"repo_kind" json:"repo_kind,omitempty"`
	BuildVariants       []VersionBuildStatus `bson:"build_variants_status,omitempty" json:"build_variants_status,omitempty"`
	PeriodicBuildID     string               `bson:"periodic_build_id,omitempty" json:"periodic_build_id,omitempty"`

	// This is technically redundant, but a lot of code relies on it, so I'm going to leave it
	BuildIds []string `bson:"builds" json:"builds,omitempty"`

	Identifier string `bson:"identifier" json:"identifier,omitempty"`
	Remote     bool   `bson:"remote" json:"remote,omitempty"`
	RemotePath string `bson:"remote_path" json:"remote_path,omitempty"`
	// version requester - this is used to help tell the
	// reason this version 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:"requester,omitempty"`
	// version errors - this is used to keep track of any errors that were
	// encountered in the process of creating a version. If there are no errors
	// this field is omitted in the database
	Errors   []string `bson:"errors,omitempty" json:"errors,omitempty"`
	Warnings []string `bson:"warnings,omitempty" json:"warnings,omitempty"`

	// AuthorID is an optional reference to the Evergreen user that authored
	// this comment, if they can be identified
	AuthorID string `bson:"author_id,omitempty" json:"author_id,omitempty"`

	SatisfiedTriggers []string `bson:"satisfied_triggers,omitempty" json:"satisfied_triggers,omitempty"`
	// Fields set if triggered by an upstream build
	TriggerID    string `bson:"trigger_id,omitempty" json:"trigger_id,omitempty"`
	TriggerType  string `bson:"trigger_type,omitempty" json:"trigger_type,omitempty"`
	TriggerEvent string `bson:"trigger_event,omitempty" json:"trigger_event,omitempty"`
}

func FetchVersionsAndAssociatedBuilds

func FetchVersionsAndAssociatedBuilds(project *Project, skip int, numVersions int, showTriggered bool) ([]Version, map[string][]build.Build, error)

FetchVersionsAndAssociatedBuilds is a helper function to fetch a group of versions and their associated builds. Returns the versions themselves, as well as a map of version id -> the builds that are a part of the version (unsorted).

func FinalizePatch

func FinalizePatch(ctx context.Context, p *patch.Patch, requester string, githubOauthToken string) (*Version, 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, 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 FindLastPeriodicBuild

func FindLastPeriodicBuild(projectID, definitionID string) (*Version, error)

func VersionFind

func VersionFind(query db.Q) ([]Version, error)

func VersionFindByIds

func VersionFindByIds(ids []string) ([]Version, error)

func VersionFindOne

func VersionFindOne(query db.Q) (*Version, error)

func VersionFindOneId

func VersionFindOneId(id string) (*Version, error)

func VersionGetHistory

func VersionGetHistory(versionId string, N int) ([]Version, error)

func (*Version) AddSatisfiedTrigger

func (v *Version) AddSatisfiedTrigger(definitionID string) error

func (*Version) GetTimeSpent

func (v *Version) GetTimeSpent() (time.Duration, time.Duration, error)

GetTimeSpent returns the total time_taken and makespan of a version for each task that has finished running

func (*Version) Insert

func (self *Version) Insert() error

func (*Version) LastSuccessful

func (v *Version) LastSuccessful() (*Version, error)

func (*Version) MarshalBSON

func (v *Version) MarshalBSON() ([]byte, error)

func (*Version) UnmarshalBSON

func (v *Version) UnmarshalBSON(in []byte) error

func (*Version) UpdateBuildVariants

func (self *Version) UpdateBuildVariants() error

func (*Version) UpdateMergeTaskDependencies

func (v *Version) UpdateMergeTaskDependencies(p *Project, mergeTask *task.Task) error

type VersionBuildStatus

type VersionBuildStatus struct {
	BuildVariant string    `bson:"build_variant" json:"id"`
	Activated    bool      `bson:"activated" json:"activated"`
	ActivateAt   time.Time `bson:"activate_at,omitempty" json:"activate_at,omitempty"`
	BuildId      string    `bson:"build_id,omitempty" json:"build_id,omitempty"`
}

VersionBuildStatus stores metadata relating to each build

type VersionsByOrder

type VersionsByOrder []Version

func (VersionsByOrder) Len

func (v VersionsByOrder) Len() int

func (VersionsByOrder) Less

func (v VersionsByOrder) Less(i, j int) bool

func (VersionsByOrder) Swap

func (v VersionsByOrder) Swap(i, j int)

type YAMLCommandSet

type YAMLCommandSet struct {
	SingleCommand *PluginCommandConf  `bson:"single_command"`
	MultiCommand  []PluginCommandConf `bson:"multi_command"`
}

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

Directories

Path Synopsis
Package stats provides functions to generate and query pre-computed test and task statistics.
Package stats provides functions to generate and query pre-computed test and task statistics.

Jump to

Keyboard shortcuts

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