model

package
v0.0.0-...-68ab3ac Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 65 Imported by: 190

Documentation

Overview

Package model defines Evergreen's data model. See subpackages for specific documentation.

Index

Constants

View Source
const (
	AllDependencies = "*"
	AllVariants     = "*"
	AllStatuses     = "*"
)
View Source
const (
	AliasSourceProject = "project"
	AliasSourceConfig  = "config"
	AliasSourceRepo    = "repo"
)
View Source
const (
	ReadFromGithub    = "github"
	ReadFromLocal     = "local"
	ReadFromPatch     = "patch"
	ReadFromPatchDiff = "patch_diff"
)
View Source
const (
	ProjectRefCollection     = "project_ref"
	ProjectTriggerLevelTask  = "task"
	ProjectTriggerLevelBuild = "build"
	ProjectTriggerLevelPush  = "push"
)
View Source
const (
	ProjectPageGeneralSection           = "GENERAL"
	ProjectPageAccessSection            = "ACCESS"
	ProjectPageVariablesSection         = "VARIABLES"
	ProjectPageNotificationsSection     = "NOTIFICATIONS"
	ProjectPagePatchAliasSection        = "PATCH_ALIASES"
	ProjectPageWorkstationsSection      = "WORKSTATION"
	ProjectPageTriggersSection          = "TRIGGERS"
	ProjectPagePeriodicBuildsSection    = "PERIODIC_BUILDS"
	ProjectPagePluginSection            = "PLUGINS"
	ProjectPageContainerSection         = "CONTAINERS"
	ProjectPageViewsAndFiltersSection   = "VIEWS_AND_FILTERS"
	ProjectPageGithubAndCQSection       = "GITHUB_AND_COMMIT_QUEUE"
	ProjectPageGithubAppSettingsSection = "GITHUB_APP_SETTINGS"
	ProjectPageGithubPermissionsSection = "GITHUB_PERMISSIONS"
)

These values must remain consistent with the GraphQL enum ProjectSettingsSection.

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 (
	TaskQueuesCollection          = "task_queues"
	TaskSecondaryQueuesCollection = "task_alias_queues"
)
View Source
const (
	ApiTaskKey apiTaskKey = 0

	ApiProjectKey apiProjectKey = 0
)
View Source
const (
	DefaultMainlineCommitVersionLimit = 7
	MaxMainlineCommitVersionLimit     = 300
)
View Source
const (
	DefaultWaterfallQueryCount   = 20
	DefaultWaterfallVersionLimit = 5
	MaxWaterfallVersionLimit     = 300
)
View Source
const ContainerSecretTag = "evergreen-tracked"

ContainerSecretTag is the tag used to track container secrets.

View Source
const (
	DAGDispatcher = "DAG-task-dispatcher"
)
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 DefaultParserProjectAccessTimeout = 60 * time.Second

DefaultParserProjectAccessTimeout is the default timeout for accessing a parser project. In general, the context timeout should prefer to be inherited from a higher-level context (e.g. a REST request's context), so this timeout should only be used as a last resort if the context cannot be easily passed to the place where the parser project is accessed.

View Source
const EmptyConfigurationError = "received empty configuration file"
View Source
const (
	EvergreenLogSender = "evergreen"
)
View Source
const FeedbackCollection = "feedback"
View Source
const (
	GithubRepoType = "github"
)
View Source
const KeyValCollection = "keyval_plugin"
View Source
const LoadProjectError = "load project error(s)"
View Source
const MergeProjectConfigError = "error merging project configs"
View Source
const NotesCollection = "build_baron_notes"
View Source
const (
	ParserProjectCollection = "parser_projects"
)
View Source
const (
	ProjectAliasCollection = "project_aliases"
)
View Source
const (
	ProjectConfigCollection = "project_configs"
)
View Source
const PushlogCollection = "pushes"
View Source
const RepoRefCollection = "repo_ref"
View Source
const (
	RepositoriesCollection = "repo_revisions"
)
View Source
const (
	StaleVersionCutoff = 100
)

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

View Source
const TranslateProjectError = "error translating project"
View Source
const (
	VersionCollection = "versions"
)

Variables

View Source
var (
	ProjectConfigIdKey         = bsonutil.MustHaveTag(ProjectConfig{}, "Id")
	ProjectConfigProjectKey    = bsonutil.MustHaveTag(ProjectConfig{}, "Project")
	ProjectConfigCreateTimeKey = bsonutil.MustHaveTag(ProjectConfig{}, "CreateTime")
)
View Source
var (
	ParserProjectIdKey                = bsonutil.MustHaveTag(ParserProject{}, "Id")
	ParserProjectStepbackKey          = bsonutil.MustHaveTag(ParserProject{}, "Stepback")
	ParserProjectPreErrorFailsTaskKey = bsonutil.MustHaveTag(ParserProject{}, "PreErrorFailsTask")
	ParserProjectOomTracker           = bsonutil.MustHaveTag(ParserProject{}, "OomTracker")
	ParserProjectOwnerKey             = bsonutil.MustHaveTag(ParserProject{}, "Owner")
	ParserProjectRepoKey              = bsonutil.MustHaveTag(ParserProject{}, "Repo")
	ParserProjectRemotePathKey        = bsonutil.MustHaveTag(ParserProject{}, "RemotePath")
	ParserProjectBranchKey            = bsonutil.MustHaveTag(ParserProject{}, "Branch")
	ParserProjectIdentifierKey        = bsonutil.MustHaveTag(ParserProject{}, "Identifier")
	ParserProjectDisplayNameKey       = bsonutil.MustHaveTag(ParserProject{}, "DisplayName")
	ParserProjectCommandTypeKey       = bsonutil.MustHaveTag(ParserProject{}, "CommandType")
	ParserProjectIgnoreKey            = bsonutil.MustHaveTag(ParserProject{}, "Ignore")
	ParserProjectParametersKey        = bsonutil.MustHaveTag(ParserProject{}, "Parameters")
	ParserProjectPreKey               = bsonutil.MustHaveTag(ParserProject{}, "Pre")
	ParserProjectPostKey              = bsonutil.MustHaveTag(ParserProject{}, "Post")
	ParserProjectTimeoutKey           = bsonutil.MustHaveTag(ParserProject{}, "Timeout")
	ParserProjectCallbackTimeoutKey   = bsonutil.MustHaveTag(ParserProject{}, "CallbackTimeout")
	ParserProjectModulesKey           = bsonutil.MustHaveTag(ParserProject{}, "Modules")
	ParserProjectContainersKey        = bsonutil.MustHaveTag(ParserProject{}, "Containers")
	ParserProjectBuildVariantsKey     = bsonutil.MustHaveTag(ParserProject{}, "BuildVariants")
)
View Source
var (
	// bson fields for the ProjectRef struct
	ProjectRefIdKey                    = bsonutil.MustHaveTag(ProjectRef{}, "Id")
	ProjectRefOwnerKey                 = bsonutil.MustHaveTag(ProjectRef{}, "Owner")
	ProjectRefRepoKey                  = bsonutil.MustHaveTag(ProjectRef{}, "Repo")
	ProjectRefBranchKey                = bsonutil.MustHaveTag(ProjectRef{}, "Branch")
	ProjectRefEnabledKey               = bsonutil.MustHaveTag(ProjectRef{}, "Enabled")
	ProjectRefRestrictedKey            = bsonutil.MustHaveTag(ProjectRef{}, "Restricted")
	ProjectRefBatchTimeKey             = bsonutil.MustHaveTag(ProjectRef{}, "BatchTime")
	ProjectRefIdentifierKey            = bsonutil.MustHaveTag(ProjectRef{}, "Identifier")
	ProjectRefRepoRefIdKey             = bsonutil.MustHaveTag(ProjectRef{}, "RepoRefId")
	ProjectRefDisplayNameKey           = bsonutil.MustHaveTag(ProjectRef{}, "DisplayName")
	ProjectRefDeactivatePreviousKey    = bsonutil.MustHaveTag(ProjectRef{}, "DeactivatePrevious")
	ProjectRefRemotePathKey            = bsonutil.MustHaveTag(ProjectRef{}, "RemotePath")
	ProjectRefHiddenKey                = bsonutil.MustHaveTag(ProjectRef{}, "Hidden")
	ProjectRefRepotrackerErrorKey      = bsonutil.MustHaveTag(ProjectRef{}, "RepotrackerError")
	ProjectRefDisabledStatsCacheKey    = bsonutil.MustHaveTag(ProjectRef{}, "DisabledStatsCache")
	ProjectRefAdminsKey                = bsonutil.MustHaveTag(ProjectRef{}, "Admins")
	ProjectRefGitTagAuthorizedUsersKey = bsonutil.MustHaveTag(ProjectRef{}, "GitTagAuthorizedUsers")
	ProjectRefGitTagAuthorizedTeamsKey = bsonutil.MustHaveTag(ProjectRef{}, "GitTagAuthorizedTeams")
	ProjectRefTracksPushEventsKey      = bsonutil.MustHaveTag(ProjectRef{}, "TracksPushEvents")
)
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 RepoRef struct
	RepoRefIdKey             = bsonutil.MustHaveTag(RepoRef{}, "Id")
	RepoRefOwnerKey          = bsonutil.MustHaveTag(RepoRef{}, "Owner")
	RepoRefRepoKey           = bsonutil.MustHaveTag(RepoRef{}, "Repo")
	RepoRefAdminsKey         = bsonutil.MustHaveTag(RepoRef{}, "Admins")
	RepoRefCommitQueueKey    = bsonutil.MustHaveTag(RepoRef{}, "CommitQueue")
	RepoRefPeriodicBuildsKey = bsonutil.MustHaveTag(RepoRef{}, "PeriodicBuilds")
	RepoRefTriggersKey       = bsonutil.MustHaveTag(RepoRef{}, "Triggers")
)
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 (
	VersionBuildStatusIdKey             = bsonutil.MustHaveTag(VersionBuildStatus{}, "BuildId")
	VersionBuildStatusVariantKey        = bsonutil.MustHaveTag(VersionBuildStatus{}, "BuildVariant")
	VersionBuildStatusActivatedKey      = bsonutil.MustHaveTag(VersionBuildStatus{}, "Activated")
	VersionBuildStatusBatchTimeTasksKey = bsonutil.MustHaveTag(VersionBuildStatus{}, "BatchTimeTasks")

	BatchTimeTaskStatusTaskNameKey  = bsonutil.MustHaveTag(BatchTimeTaskStatus{}, "TaskName")
	BatchTimeTaskStatusActivatedKey = bsonutil.MustHaveTag(BatchTimeTaskStatus{}, "Activated")
)
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")
	VersionParametersKey                        = bsonutil.MustHaveTag(Version{}, "Parameters")
	VersionBuildIdsKey                          = bsonutil.MustHaveTag(Version{}, "BuildIds")
	VersionBuildVariantsKey                     = bsonutil.MustHaveTag(Version{}, "BuildVariants")
	VersionRevisionOrderNumberKey               = bsonutil.MustHaveTag(Version{}, "RevisionOrderNumber")
	VersionRequesterKey                         = bsonutil.MustHaveTag(Version{}, "Requester")
	VersionGitTagsKey                           = bsonutil.MustHaveTag(Version{}, "GitTags")
	VersionIgnoredKey                           = bsonutil.MustHaveTag(Version{}, "Ignored")
	VersionOwnerNameKey                         = bsonutil.MustHaveTag(Version{}, "Owner")
	VersionRepoKey                              = bsonutil.MustHaveTag(Version{}, "Repo")
	VersionBranchKey                            = bsonutil.MustHaveTag(Version{}, "Branch")
	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")
	VersionActivatedKey                         = bsonutil.MustHaveTag(Version{}, "Activated")
	VersionAbortedKey                           = bsonutil.MustHaveTag(Version{}, "Aborted")
	VersionAuthorIDKey                          = bsonutil.MustHaveTag(Version{}, "AuthorID")
	VersionProjectStorageMethodKey              = bsonutil.MustHaveTag(Version{}, "ProjectStorageMethod")
	VersionPreGenerationProjectStorageMethodKey = bsonutil.MustHaveTag(Version{}, "PreGenerationProjectStorageMethod")
)
View Source
var DependencyCycleError = errors.New("adding dependencies creates a dependency cycle")
View Source
var (
	FeedbackTypeKey = bsonutil.MustHaveTag(FeedbackSubmission{}, "Type")
)
View Source
var NoteTaskIdKey = bsonutil.MustHaveTag(Note{}, "TaskId")
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 marks the build as deactivated and sets the abort flag on all tasks associated with the build which are in an abortable state.

func AbortPatchesWithGithubPatchData

func AbortPatchesWithGithubPatchData(ctx context.Context, createdBefore time.Time, closed bool, newPatch, owner, repo string, prNumber int) error

AbortPatchesWithGithubPatchData aborts patches and commit queue items created before the given time, with the same PR number, and base repository. Tasks which are abortable will be aborted, while completed tasks will not be affected. This function makes one exception for commit queue items so that if the item is currently running the merge task, then that patch is not aborted and is allowed to finish.

func AbortTask

func AbortTask(ctx context.Context, taskId, caller string) error

func ActivateBuildsAndTasks

func ActivateBuildsAndTasks(ctx context.Context, buildIds []string, active bool, caller string) error

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

func ActivateElapsedBuildsAndTasks

func ActivateElapsedBuildsAndTasks(ctx context.Context, v *Version) (bool, error)

ActivateElapsedBuildsAndTasks activates any builds/tasks if their BatchTimes have elapsed.

func ActivateVersions

func ActivateVersions(versionIds []string) error

func AddGitTag

func AddGitTag(versionId string, tag GitTag) error

func AddSatisfiedTrigger

func AddSatisfiedTrigger(versionID, definitionID string) error

func BaseVersionByProjectIdAndRevision

func BaseVersionByProjectIdAndRevision(projectId, revision string) db.Q

BaseVersionByProjectIdAndRevision finds a base version for the given project and revision.

func BbGetTask

func BbGetTask(taskId string, executionString string) (*task.Task, 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(ctx context.Context, p *patch.Patch, reason task.AbortInfo) error

CancelPatch aborts all of a patch's in-progress tasks and deactivates its undispatched tasks.

func ClearAndResetStrandedContainerTask

func ClearAndResetStrandedContainerTask(ctx context.Context, settings *evergreen.Settings, p *pod.Pod) error

ClearAndResetStrandedContainerTask clears the container task dispatched to a pod. It also resets the task so that the current task execution is marked as finished and, if necessary, a new execution is created to restart the task. TODO (PM-2618): should probably block single-container task groups once they're supported.

func ClearAndResetStrandedHostTask

func ClearAndResetStrandedHostTask(ctx context.Context, settings *evergreen.Settings, h *host.Host) error

ClearAndResetStrandedHostTask clears the host task dispatched to the host due to being stranded on a bad host (e.g. one that has been terminated). It also marks the current task execution as finished and, if possible, a new execution is created to restart the task.

func ClearTaskQueue

func ClearTaskQueue(distroId string) error

ClearTaskQueue removes all tasks from task queue by updating them with a blank queue, and modifies the queue info. This is in contrast to RemoveTaskQueues, which simply deletes these documents.

func CommitQueueRemoveItem

func CommitQueueRemoveItem(ctx context.Context, cq *commitqueue.CommitQueue, item commitqueue.CommitQueueItem, user, reason string) (*commitqueue.CommitQueueItem, error)

CommitQueueRemoveItem dequeues an item from the commit queue and returns the removed item. If the item is already being tested in a batch, later items in the batch are restarted.

func ConfigurePatch

func ConfigurePatch(ctx context.Context, settings *evergreen.Settings, p *patch.Patch, version *Version, proj *ProjectRef, patchUpdateReq PatchUpdate) (int, error)

ConfigurePatch validates and creates the updated tasks/variants if given, and updates description if needed. Returns an http status code and error.

func CopyProjectAliases

func CopyProjectAliases(oldProjectId, newProjectId string) error

CopyProjectAliases finds the aliases for a given project and inserts them for the new project.

func CopyProjectVars

func CopyProjectVars(oldProjectId, newProjectId string) error

CopyProjectVars copies the variables for the first project to the second

func CountProjectRefsWithIdentifier

func CountProjectRefsWithIdentifier(identifier string) (int, error)

func CreateBuildFromVersionNoInsert

func CreateBuildFromVersionNoInsert(ctx context.Context, creationInfo TaskCreationInfo) (*build.Build, task.Tasks, error)

CreateBuildFromVersionNoInsert creates a build given all of the necessary information from the corresponding version and project and a list of tasks. Note that the caller is responsible for inserting the created build and task documents

func CreateManifest

func CreateManifest(v *Version, modules ModuleList, projectRef *ProjectRef, settings *evergreen.Settings) (*manifest.Manifest, error)

CreateManifest inserts a newly constructed manifest into the DB.

func CreateTasksCache

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

func DeactivatePreviousTasks

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

DeactivatePreviousTasks deactivates any previously activated but undispatched tasks for the same build variant + display name + project combination as the task, provided nothing is waiting on it.

func DefaultGithubAppCredentialsToRepo

func DefaultGithubAppCredentialsToRepo(projectId string) error

DefaultGithubAppCredentialsToRepo defaults the app credentials to the repo by removing the GithubAppAuth entry for the project.

func DefaultSectionToRepo

func DefaultSectionToRepo(projectId string, section ProjectPageSection, userId string) error

DefaultSectionToRepo modifies a subset of the project ref to use the repo values instead. This subset is based on the pages used in Spruce. If project settings aren't given, we should assume we're defaulting to repo and we need to create our own project settings event after completing the update.

func DequeueAndRestartForTask

func DequeueAndRestartForTask(ctx context.Context, cq *commitqueue.CommitQueue, t *task.Task, githubState message.GithubState, caller, reason string) error

DequeueAndRestartForTask restarts all items after the given task's version, aborts/dequeues the current version, and sends an updated status to GitHub.

func DequeueAndRestartForVersion

func DequeueAndRestartForVersion(ctx context.Context, cq *commitqueue.CommitQueue, project, version, user, reason string) (*commitqueue.CommitQueueItem, error)

DequeueAndRestartForVersion restarts all items after the commit queue item, aborts/dequeues this version, and sends an updated status to GitHub. If it succeeds, it returns the removed item.

func DisableStaleContainerTasks

func DisableStaleContainerTasks(caller string) error

DisableStaleContainerTasks disables all container tasks that have been scheduled to run for a long time without actually dispatching the task.

func DisableTasks

func DisableTasks(caller string, tasks ...task.Task) error

func DoProjectActivation

func DoProjectActivation(ctx context.Context, id string, ts time.Time) (bool, error)

func FindAndTranslateProjectForPatch

func FindAndTranslateProjectForPatch(ctx context.Context, settings *evergreen.Settings, p *patch.Patch) (*Project, *ParserProject, error)

FindAndTranslateProjectForPatch translates a parser project for a patch into a project. This assumes that the version may not exist yet (i.e. the patch is unfinalized); otherwise FindAndTranslateProjectForVersion is equivalent.

func FindAndTranslateProjectForVersion

func FindAndTranslateProjectForVersion(ctx context.Context, settings *evergreen.Settings, v *Version, preGeneration bool) (*Project, *ParserProject, error)

FindAndTranslateProjectForVersion translates a parser project for a version into a Project. Also sets the project ID. If the preGeneration flag is true, this function will attempt to fetch and translate the parser project from before it was modified by generate.tasks

func FindBranchAdminsForRepo

func FindBranchAdminsForRepo(repoId string) ([]string, error)

func FindLatestRevisionAndAuthorForProject

func FindLatestRevisionAndAuthorForProject(projectId string) (string, string, error)

FindLatestRevisionAndAuthorForProject returns the latest revision and author ID for the project, and returns an error if it's not found.

func FindLatestVersionWithValidProject

func FindLatestVersionWithValidProject(projectId string, preGeneration bool) (*Version, *Project, *ParserProject, error)

FindLatestVersionWithValidProject returns the latest mainline version that has a valid project configuration. It also returns the intermediate and final project configurations. If the preGeneration flag is set, this will retrieve a cached version of this version's parser project from before it was modified by generate.tasks, which is required for child patches.

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 FindPredictedMakespan

func FindPredictedMakespan(tasks []task.Task) dependencyPath

FindPredictedMakespan, given a list of tasks that have been completed, finds the optimal makespan of that build. While it's possible for tasks to depend on tasks outside its build, this function does not take that into account because it is meant to compute the optimal makespan for a single build

func FindProjectForVersion

func FindProjectForVersion(versionID string) (string, error)

func FindProjectRefIdsWithCommitQueueEnabled

func FindProjectRefIdsWithCommitQueueEnabled() ([]string, error)

FindProjectRefIdsWithCommitQueueEnabled returns a list of project IDs that have the commit queue enabled. We don't return the full projects since they aren't actually merged with the repo documents, so they aren't necessarily accurate.

func FixStaleTask

func FixStaleTask(ctx context.Context, settings *evergreen.Settings, t *task.Task) error

FixStaleTask fixes a task that has exceeded the heartbeat timeout. The current task execution is marked as finished and, if the task was not aborted, the task is reset. If the task was aborted, we do not reset the task and it is just marked as failed alongside other necessary updates to finish the task.

func GetAndLogProjectModified

func GetAndLogProjectModified(id, userId string, isRepo bool, before *ProjectSettings) error

GetAndLogProjectModified retrieves the project settings before and after some change, and logs an event for the modification.

func GetAndLogProjectRepoAttachment

func GetAndLogProjectRepoAttachment(id, userId, attachmentType string, isRepo bool, before *ProjectSettings) error

GetAndLogProjectRepoAttachment retrieves the project settings before and after the change, and logs the modification as a repo attachment/detachment event.

func GetBuildBaronSettings

func GetBuildBaronSettings(projectId string, version string) (evergreen.BuildBaronSettings, bool)

GetBuildBaronSettings retrieves build baron settings from project settings. Project page settings takes precedence, otherwise fallback to project config yaml. Returns build baron settings and ok if found.

func GetEstimatedStartTime

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

GetEstimatedStartTime returns the estimated start time for a task

func GetIdForProject

func GetIdForProject(identifier string) (string, error)

func GetIdentifierForProject

func GetIdentifierForProject(id string) (string, error)

func GetMessageForPatch

func GetMessageForPatch(patchID string) (string, error)

func GetModulesFromPR

func GetModulesFromPR(ctx context.Context, modules []commitqueue.Module, projectConfig *Project) ([]*github.PullRequest, []patch.ModulePatch, error)

func GetNewRevisionOrderNumber

func GetNewRevisionOrderNumber(projectId string) (int, error)

GetNewRevisionOrderNumber gets a new revision order number for a project.

func GetNextCronTime

func GetNextCronTime(baseTime time.Time, cronBatchTime string) (time.Time, error)

GetNextCronTime returns the next valid batch time

func GetNumberOfEnabledProjects

func GetNumberOfEnabledProjects() (int, error)

GetNumberOfEnabledProjects returns the current number of enabled projects on evergreen.

func GetNumberOfEnabledProjectsForOwnerRepo

func GetNumberOfEnabledProjectsForOwnerRepo(owner, repo string) (int, error)

GetNumberOfEnabledProjectsForOwnerRepo returns the number of enabled projects for a given owner/repo.

func GetPatchedProject

func GetPatchedProject(ctx context.Context, settings *evergreen.Settings, p *patch.Patch) (*Project, *PatchConfig, error)

GetPatchedProject creates and validates a project 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 GetPatchedProjectConfig

func GetPatchedProjectConfig(ctx context.Context, settings *evergreen.Settings, p *patch.Patch) (string, error)

GetPatchedProjectConfig returns the project configuration by fetching the latest commit information from GitHub and applying the patch to the latest remote configuration. The error returned can be a validation error.

func GetPreviousPageCommitOrderNumber

func GetPreviousPageCommitOrderNumber(ctx context.Context, projectId string, order int, limit int, requesters []string) (*int, error)

GetPreviousPageCommitOrderNumber returns the first mainline commit that is LIMIT activated versions more recent than the specified commit

func GetRepoAdminRole

func GetRepoAdminRole(repoId string) string

GetRepoAdminRole returns the repo admin role ID for the given repo.

func GetRepoAdminScope

func GetRepoAdminScope(repoId string) string

GetRepoAdminScope returns the scope ID that includes all branch projects, regardless of restricted/unrestricted.

func GetSearchReturnInfo

func GetSearchReturnInfo(taskId string, exec string) (*thirdparty.SearchReturnInfo, buildBaronConfig, error)

func GetSetupScriptForTask

func GetSetupScriptForTask(ctx context.Context, taskId string) (string, error)

func GetTasksWithOptions

func GetTasksWithOptions(projectName string, taskName string, opts GetProjectTasksOpts) ([]task.Task, error)

GetTasksWithOptions will find the matching tasks run in the last number of versions(denoted by Limit) that exist for a given project. This function may also filter on tasks running on a specific build variant, or tasks that come after a specific revision order number.

func GetUnrestrictedBranchProjectsScope

func GetUnrestrictedBranchProjectsScope(repoId string) string

GetUnrestrictedBranchProjectsScope returns the scope ID that includes the unrestricted branches for this project.

func GetUpstreamProjectName

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

func GetVariantsWithMatrices

func GetVariantsWithMatrices(ase *axisSelectorEvaluator, axes []matrixAxis, bvs []parserBV) ([]parserBV, []error)

func GetVersionAuthorID

func GetVersionAuthorID(versionID string) (string, error)

func HandleEndTaskForCommitQueueTask

func HandleEndTaskForCommitQueueTask(ctx context.Context, t *task.Task, status string) error

HandleEndTaskForCommitQueueTask handles necessary dequeues and stepback restarts for ending tasks that run on a commit queue.

func HasMatchingGitTagAliasAndRemotePath

func HasMatchingGitTagAliasAndRemotePath(projectId, tag string) (bool, string, error)

HasMatchingGitTagAliasAndRemotePath returns matching git tag aliases that match the given git tag

func IsAborted

func IsAborted(id string) (bool, error)

func IsPatchAlias

func IsPatchAlias(alias string) bool

func IsPerfEnabledForProject

func IsPerfEnabledForProject(projectId string) bool

func IsValidId

func IsValidId(id string) bool

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

func IsWebhookConfigured

func IsWebhookConfigured(project string, version string) (evergreen.WebHook, bool, error)

IsWebhookConfigured retrieves webhook configuration from the project settings.

func LogProjectAdded

func LogProjectAdded(projectId, username string) error

LogProjectAdded logs a project added event.

func LogProjectEvent

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

LogProjectEvent logs a project event.

func LogProjectModified

func LogProjectModified(projectId, username string, before, after *ProjectSettings) error

LogProjectModified logs an event for a modification of a project's settings. Secrets are redacted from the event data.

func LogProjectRepoAttachment

func LogProjectRepoAttachment(projectId, username, attachmentType string, before, after *ProjectSettings) error

LogProjectRepoAttachment logs an event for either the attachment of a project to a repo, or a detachment of a project from a repo.

func MakeCommitQueueDescription

func MakeCommitQueueDescription(patches []patch.ModulePatch, projectRef *ProjectRef, project *Project,
	githubMergePatch bool, mergeGroup thirdparty.GithubMergeGroup) string

func MakeMergePatchFromExisting

func MakeMergePatchFromExisting(ctx context.Context, settings *evergreen.Settings, existingPatch *patch.Patch, commitMessage string) (*patch.Patch, error)

MakeMergePatchFromExisting creates a merge patch from an existing one to be put in the commit queue. Is also creates the parser project associated with the patch.

func MakePatchedConfig

func MakePatchedConfig(ctx context.Context, opts GetProjectOpts, projectConfig string) ([]byte, error)

MakePatchedConfig takes in the project's remote file path containing the project YAML configuration and a stringified version of the project YAML configuration, and returns an unmarshalled version of the project with the patch applied.

func MarkEnd

func MarkEnd(ctx context.Context, settings *evergreen.Settings, t *task.Task, caller string, finishTime time.Time, detail *apimodels.TaskEndDetail,
	deactivatePrevious bool) error

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

func MarkHostTaskDispatched

func MarkHostTaskDispatched(t *task.Task, h *host.Host) error

MarkHostTaskDispatched marks a task as being dispatched to the host. If it's part of a display task, update the display task as necessary.

func MarkOneTaskReset

func MarkOneTaskReset(ctx context.Context, t *task.Task, caller string) error

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 MarkTasksReset

func MarkTasksReset(ctx context.Context, taskIds []string, caller string) error

MarkTasksReset resets many tasks by their IDs. For execution tasks, this also resets their parent display tasks.

func MarkUnallocatableContainerTasksSystemFailed

func MarkUnallocatableContainerTasksSystemFailed(ctx context.Context, settings *evergreen.Settings, candidateTaskIDs []string) error

MarkUnallocatableContainerTasksSystemFailed marks any container task within the candidate task IDs that needs to re-allocate a container but has used up all of its container allocation attempts as finished due to system failure.

func ModifyVersion

func ModifyVersion(ctx context.Context, version Version, user user.DBUser, modifications VersionModification) (int, 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 ParserProjectUpsertOne

func ParserProjectUpsertOne(ctx context.Context, settings *evergreen.Settings, method evergreen.ParserProjectStorageMethod, pp *ParserProject) error

ParserProjectUpsertOne is a convenience wrapper to upsert one parser project to persistent storage.

func ParserProjectUpsertOneWithS3Fallback

func ParserProjectUpsertOneWithS3Fallback(ctx context.Context, settings *evergreen.Settings, method evergreen.ParserProjectStorageMethod, pp *ParserProject) (evergreen.ParserProjectStorageMethod, error)

ParserProjectUpsertOneWithS3Fallback attempts to upsert the parser project into persistent storage using the given storage method. If it fails due to DB document size limitations, it will attempt to fall back to using S3 to store it. If it succeeds, this returns the actual project storage method used to persist the parser project; otherwise, it returns the originally-requested storage method.

func PopulateExpansions

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

PopulateExpansions returns expansions for a task, excluding build variant expansions, project variables, and project/version parameters.

func ProjectCanDispatchTask

func ProjectCanDispatchTask(pRef *ProjectRef, t *task.Task) (canDispatch bool, reason string)

ProjectCanDispatchTask returns a boolean indicating if the task can be dispatched based on the project ref's settings and optionally includes a particular reason that the task can or cannot be dispatched.

func RecomputeNumDependents

func RecomputeNumDependents(ctx context.Context, t task.Task) 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 RemoveAdminFromProjects

func RemoveAdminFromProjects(toDelete string) error

RemoveAdminFromProjects removes a user from all Admin slices of every project and repo

func RemoveCommitQueueItemForVersion

func RemoveCommitQueueItemForVersion(projectId, version string, user string) (*commitqueue.CommitQueueItem, error)

func RemoveItemAndPreventMerge

func RemoveItemAndPreventMerge(cq *commitqueue.CommitQueue, issue string, user string) (*commitqueue.CommitQueueItem, error)

RemoveItemAndPreventMerge removes an item from the commit queue and disables the merge task, if applicable.

func RemoveProjectAlias

func RemoveProjectAlias(id string) error

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

func RemoveTaskQueues

func RemoveTaskQueues(distroID string) error

func ResetTaskOrDisplayTask

func ResetTaskOrDisplayTask(ctx context.Context, settings *evergreen.Settings, t *task.Task, user, origin string, failedOnly bool, detail *apimodels.TaskEndDetail) error

ResetTaskOrDisplayTask is a wrapper for TryResetTask that handles execution and display tasks that are restarted from sources separate from marking the task finished. If an execution task, attempts to restart the display task instead. Marks display tasks as reset when finished and then check if it can be reset immediately.

func RestartBuild

func RestartBuild(ctx context.Context, b *build.Build, taskIDs []string, abortInProgress bool, caller string) error

RestartBuild restarts completed tasks belonging to the given build. If no task IDs are provided, all completed task IDs in the build are restarted. If abortInProgress is true, it also sets the abort and reset flags on any in-progress tasks.

func RestartItemsAfterVersion

func RestartItemsAfterVersion(ctx context.Context, cq *commitqueue.CommitQueue, project, version, caller string) error

func RestartVersion

func RestartVersion(ctx context.Context, versionID string, taskIDs []string, abortInProgress bool, caller string) error

RestartVersion restarts completed tasks belonging to the given version ID. If no task IDs are provided, all completed task IDs in the version are restarted. If abortInProgress is true, it also sets the abort and reset flags on any in-progress tasks.

func RestartVersions

func RestartVersions(ctx context.Context, versionsToRestart []*VersionToRestart, abortInProgress bool, caller string) error

RestartVersions restarts selected tasks for a set of versions. If abortInProgress is true for any version, it also sets the abort and reset flags on any in-progress tasks belonging to that version.

func RetryCommitQueueItems

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

func SaveProjectPageForSection

func SaveProjectPageForSection(projectId string, p *ProjectRef, section ProjectPageSection, isRepo bool) (bool, error)

SaveProjectPageForSection updates the project or repo ref variables for the section (if no project is given, we unset to default to repo).

func SendCommitQueueResult

func SendCommitQueueResult(ctx context.Context, p *patch.Patch, status message.GithubState, description string) error

SendCommitQueueResult sends an updated GitHub PR status for a commit queue result. If the patch is not part of a PR, this is a no-op.

func SetAWSKeyForProject

func SetAWSKeyForProject(projectId string, ssh *AWSSSHKey) error

func SetActiveState

func SetActiveState(ctx context.Context, caller string, active bool, tasks ...task.Task) error

func SetActiveStateById

func SetActiveStateById(ctx context.Context, id, user string, active bool) error

func SetBuildPriority

func SetBuildPriority(ctx context.Context, buildId string, priority int64, caller string) error

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

func SetTaskPriority

func SetTaskPriority(ctx context.Context, t task.Task, priority int64, caller string) error

SetTaskPriority sets the priority for the given task. Any of the task's dependencies that have a lower priority than the one being set for this task will also have their priority increased.

func SetTracksPushEvents

func SetTracksPushEvents(ctx context.Context, projectRef *ProjectRef) (bool, error)

SetTracksPushEvents returns true if the GitHub app is installed on the owner/repo for the given project.

func SetVersionActivated

func SetVersionActivated(versionId string, activated bool) error

SetVersionActivated sets version activated field to specified boolean given a version id.

func SetVersionActivation

func SetVersionActivation(ctx context.Context, 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 SetVersionsPriority

func SetVersionsPriority(ctx context.Context, versionIds []string, priority int64, caller string) error

SetVersionsPriority updates the priority field of all tasks and child tasks associated with the given version ids.

func SubscribeOnParentOutcome

func SubscribeOnParentOutcome(parentStatus string, childPatchId string, parentPatch *patch.Patch, requester string) error

func TaskHistoryPickaxe

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

func TryMarkVersionStarted

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

func TryResetTask

func TryResetTask(ctx context.Context, settings *evergreen.Settings, taskId, user, origin string, detail *apimodels.TaskEndDetail) error

TryResetTask resets a task. Individual execution tasks cannot be reset - to reset an execution task, the given task ID must be that of its parent display task.

func UpdateAdminRoles

func UpdateAdminRoles(project *ProjectRef, toAdd, toDelete []string) error

func UpdateBlockedDependencies

func UpdateBlockedDependencies(ctx context.Context, dependencies []task.Task, ignoreDependencyStatusForBlocking bool) error

UpdateBlockedDependencies traverses the dependency graph and recursively sets each parent dependency in dependencies as unattainable in depending tasks. It updates the status of builds as well, in case they change due to blocking dependencies. The ignoreDependencyStatusForBlocking indicates whether all tasks that depend on the given tasks will be updated (i.e., whether the task's Dependency.Status will be ignored).

func UpdateBuildAndVersionStatusForTask

func UpdateBuildAndVersionStatusForTask(ctx context.Context, t *task.Task) error

UpdateBuildAndVersionStatusForTask updates the status of the task's build based on all the tasks in the build and the task's version based on all the builds in the version. Also update build and version Github statuses based on the subset of tasks and builds included in github checks

func UpdateDisplayTaskForTask

func UpdateDisplayTaskForTask(t *task.Task) error

UpdateDisplayTaskForTask updates the status of the given execution task's display task

func UpdateLastRevision

func UpdateLastRevision(projectId, revision string) error

UpdateLastRevision updates the last created revision of a project.

func UpdateNextPeriodicBuild

func UpdateNextPeriodicBuild(projectId string, definition *PeriodicBuildDefinition) error

UpdateNextPeriodicBuild updates the periodic build run time for either the project or repo ref depending on where it's defined.

func UpdateOwnerAndRepoForBranchProjects

func UpdateOwnerAndRepoForBranchProjects(repoId, owner, repo string) error

func UpdatePatchStatus

func UpdatePatchStatus(ctx context.Context, p *patch.Patch, status string) error

UpdatePatchStatus updates the status of a patch.

func UpdateProjectRevision

func UpdateProjectRevision(projectID, revision string) error

UpdateProjectRevision updates the given project's revision

func UpdateProjectVarsByValue

func UpdateProjectVarsByValue(toReplace, replacement, username string, dryRun, enabledOnly bool) (map[string][]string, error)

UpdateProjectVarsByValue searches all projects who have a variable set to the toReplace input parameter, and replaces all matching project variables with the replacement input parameter. If dryRun is set to true, the update is not performed. We return a list of keys that were replaced (or, the list of keys that would be replaced in the case that dryRun is true). If enabledOnly is set to true, we update only projects that are enabled, and repos.

func UpdateUnblockedDependencies

func UpdateUnblockedDependencies(ctx context.Context, dependencies []task.Task) error

UpdateUnblockedDependencies recursively marks all unattainable dependencies as attainable.

func UpdateVersionAndPatchStatusForBuilds

func UpdateVersionAndPatchStatusForBuilds(ctx context.Context, buildIds []string) error

UpdateVersionAndPatchStatusForBuilds updates the status of all versions, patches and builds associated with the given input list of build IDs.

func UpdateVersionMessage

func UpdateVersionMessage(versionId, message string) error

func UpsertAliasesForProject

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

func UserHasRepoViewPermission

func UserHasRepoViewPermission(u *user.DBUser, repoRefId string) (bool, error)

UserHasRepoViewPermission returns true if the user has permission to view any branch project settings.

func ValidateBbProject

func ValidateBbProject(projName string, proj evergreen.BuildBaronSettings, webhook *evergreen.WebHook) error

func ValidateContainers

func ValidateContainers(ecsConf evergreen.ECSConfig, pRef *ProjectRef, containers []Container) error

ValidateContainers inspects the list of containers defined in the project YAML and checks that each are properly configured, and that their definitions can coexist with what is defined for container sizes on the project admin page.

func ValidateEnabledProjectsLimit

func ValidateEnabledProjectsLimit(projectId string, config *evergreen.Settings, originalMergedRef, mergedRefToValidate *ProjectRef) (int, error)

ValidateEnabledProjectsLimit takes in a the original and new merged project refs and validates project limits, assuming the given project is going to be enabled. Returns a status code and error if we are already at limit with enabled projects.

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 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 ValidateTriggerDefinition

func ValidateTriggerDefinition(definition patch.PatchTriggerDefinition, parentProject string) (patch.PatchTriggerDefinition, error)

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 VersionByLastTaskActivation

func VersionByLastTaskActivation(projectId, variant, taskName string) db.Q

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

func VersionByLastVariantActivation

func VersionByLastVariantActivation(projectId, variant string) db.Q

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

func VersionByMostRecentNonIgnored

func VersionByMostRecentNonIgnored(projectId string, ts time.Time) db.Q

VersionByMostRecentNonIgnored finds all non-ignored mainline commit versions within a project, ordered by most recently created to oldest, before a given time.

func VersionByMostRecentSystemRequester

func VersionByMostRecentSystemRequester(projectId string) db.Q

VersionByMostRecentSystemRequester finds all mainline versions within a project, ordered by most recently created to oldest.

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 VersionByProjectIdAndCreateTime

func VersionByProjectIdAndCreateTime(projectId string, createTime time.Time) db.Q

VersionByProjectIdAndCreateTime finds the most recent system-requested version created on or before a specified createTime.

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 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.

Types

type AWSSSHKey

type AWSSSHKey struct {
	Name  string
	Value string
}

func GetAWSKeyForProject

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

type ActivationStatus

type ActivationStatus struct {
	Activated  bool      `bson:"activated" json:"activated"`
	ActivateAt time.Time `bson:"activate_at,omitempty" json:"activate_at,omitempty"`
}

func (*ActivationStatus) ShouldActivate

func (s *ActivationStatus) ShouldActivate(now time.Time) bool

type BatchTimeTaskStatus

type BatchTimeTaskStatus struct {
	TaskName         string `bson:"task_name" json:"task_name"`
	TaskId           string `bson:"task_id,omitempty" json:"task_id,omitempty"`
	ActivationStatus `bson:",inline"`
}

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, error)

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"`
	Tags        []string          `yaml:"tags,omitempty" bson:"tags"`

	// 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"`
	// If CronBatchTime is not empty, then override the project settings with cron syntax,
	// with BatchTime and CronBatchTime being mutually exclusive.
	CronBatchTime string `yaml:"cron,omitempty" bson:"cron,omitempty"`

	// If Activate is set to false, then we don't initially activate the build
	// variant. By default, the build variant is activated.
	Activate *bool `yaml:"activate,omitempty" bson:"activate,omitempty"`
	// Disable will disable tasks in the build variant, preventing them from
	// running and omitting them if they're dependencies. By default, the build
	// variant is not disabled.
	Disable *bool `yaml:"disable,omitempty" bson:"disable"`
	// Patchable will prevent tasks in this build variant from running in
	// patches when set to false. By default, the build variant runs in patches.
	Patchable *bool `yaml:"patchable,omitempty" bson:"patchable,omitempty"`
	// PatchOnly will only allow tasks in the build variant to run in patches
	// when set to true. By default, the build variant runs for non-patches.
	PatchOnly *bool `yaml:"patch_only,omitempty" bson:"patch_only,omitempty"`
	// AllowForGitTag will prevent tasks in this build variant from running in
	// git tag versions when set to false. By default, the build variant runs in
	// git tag versions.
	AllowForGitTag *bool `yaml:"allow_for_git_tag,omitempty" bson:"allow_for_git_tag,omitempty"`
	// GitTagOnly will only allow tasks in the build variant to run in git tag
	// versions when set to true. By default, the build variant runs in non-git
	// tag versions.
	GitTagOnly *bool `yaml:"git_tag_only,omitempty" bson:"git_tag_only,omitempty"`
	// AllowedRequesters lists all internal requester types which can run a
	// task. If set, the allowed requesters take precedence over other
	// requester-related filters such as Patchable, PatchOnly, AllowForGitTag,
	// and GitTagOnly. By default, all requesters are allowed to run the task.
	AllowedRequesters []evergreen.UserRequester `yaml:"allowed_requesters,omitempty" bson:"allowed_requesters,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 []patch.DisplayTask    `yaml:"display_tasks,omitempty" bson:"display_tasks,omitempty"`

	// TranslationWarnings are validation warnings that are only detectable during project translation.
	// e.g. task selectors that don't target any tasks in a build variant but the build
	// variant still has tasks.
	TranslationWarnings []string `yaml:"-" bson:"-"`
}

func (BuildVariant) Get

func (BuildVariant) GetDisplayTask

func (b BuildVariant) GetDisplayTask(name string) *patch.DisplayTask

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 indicates that it is a task group. This is always populated for
	// task groups after project translation.
	IsGroup bool `yaml:"-" bson:"-"`
	// IsPartOfGroup indicates that this unit is a task within a task group. If
	// this is set, then GroupName is also set.
	// Note that project translation does not expand task groups into their
	// individual tasks, so this is only set for special functions that
	// explicitly expand task groups into individual task units (such as
	// FindAllBuildVariantTasks).
	IsPartOfGroup bool `yaml:"-" bson:"-"`
	// GroupName is the task group name if this is a task in a task group. This
	// is only set if the task unit is a task within a task group (i.e.
	// IsPartOfGroup is set). If the task unit is the task group itself, it is
	// not populated (Name is the task group name).
	// Note that project translation does not expand task groups into their
	// individual tasks, so this is only set for special functions that
	// explicitly expand task groups into individual task units (such as
	// FindAllBuildVariantTasks).
	GroupName string `yaml:"-" bson:"-"`
	// Variant is the build variant that the task unit is part of. This is
	// always populated after translating the parser project to the project.
	Variant 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"`
	Disable           *bool                     `yaml:"disable,omitempty" bson:"disable,omitempty"`
	AllowForGitTag    *bool                     `yaml:"allow_for_git_tag,omitempty" bson:"allow_for_git_tag,omitempty"`
	GitTagOnly        *bool                     `yaml:"git_tag_only,omitempty" bson:"git_tag_only,omitempty"`
	AllowedRequesters []evergreen.UserRequester `yaml:"allowed_requesters,omitempty" bson:"allowed_requesters,omitempty"`
	Priority          int64                     `yaml:"priority,omitempty" bson:"priority"`
	DependsOn         []TaskUnitDependency      `yaml:"depends_on,omitempty" bson:"depends_on"`

	// the distros that the task can be run on
	RunOn    []string `yaml:"run_on,omitempty" bson:"run_on"`
	Stepback *bool    `yaml:"stepback,omitempty" bson:"stepback,omitempty"`

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

	// 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"`
	// If CronBatchTime is not empty, then override the project settings with cron syntax,
	// with BatchTime and CronBatchTime being mutually exclusive.
	CronBatchTime string `yaml:"cron,omitempty" bson:"cron,omitempty"`
	// If Activate is set to false, then we don't initially activate the task.
	Activate *bool `yaml:"activate,omitempty" bson:"activate,omitempty"`
	// CreateCheckRun will create a check run on GitHub if set.
	CreateCheckRun *CheckRun `yaml:"create_check_run,omitempty" bson:"create_check_run,omitempty"`
}

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, requester string) []BuildVariantTaskUnit

CreateTasksFromGroup expands a task group into its individual tasks and returns a build variant task unit for each task in the task group.

func (*BuildVariantTaskUnit) HasCheckRun

func (bvt *BuildVariantTaskUnit) HasCheckRun() bool

HasCheckRun returns if the build variant task specifies a checkrun

func (*BuildVariantTaskUnit) HasSpecificActivation

func (bvt *BuildVariantTaskUnit) HasSpecificActivation() bool

HasSpecificActivation returns if the build variant task specifies an activation condition that overrides the default, such as cron/batchtime, disabling the task, or explicitly activating it.

func (*BuildVariantTaskUnit) IsDisabled

func (bvt *BuildVariantTaskUnit) IsDisabled() bool

IsDisabled returns whether or not this build variant task is disabled.

func (*BuildVariantTaskUnit) Populate

func (bvt *BuildVariantTaskUnit) Populate(pt ProjectTask, bv BuildVariant)

Populate updates the base fields of the BuildVariantTaskUnit with fields from the project task definition and build variant definition. When there are conflicting settings defined at different levels, the priority of settings are (from highest to lowest): * Task settings within a build variant's list of tasks * Task settings within a task group's list of tasks * Project task's settings * Build variant's settings

func (*BuildVariantTaskUnit) SkipOnGitTagBuild

func (bvt *BuildVariantTaskUnit) SkipOnGitTagBuild() bool

func (*BuildVariantTaskUnit) SkipOnNonGitTagBuild

func (bvt *BuildVariantTaskUnit) SkipOnNonGitTagBuild() bool

func (*BuildVariantTaskUnit) SkipOnNonPatchBuild

func (bvt *BuildVariantTaskUnit) SkipOnNonPatchBuild() bool

func (*BuildVariantTaskUnit) SkipOnPatchBuild

func (bvt *BuildVariantTaskUnit) SkipOnPatchBuild() bool

func (*BuildVariantTaskUnit) SkipOnRequester

func (bvt *BuildVariantTaskUnit) SkipOnRequester(requester string) bool

func (*BuildVariantTaskUnit) ToTVPair

func (bvt *BuildVariantTaskUnit) ToTVPair() TVPair

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 BuildVariantsByName

type BuildVariantsByName []BuildVariant

BuildVariantsByName represents a slice of project config build variants that can be sorted by name.

func (BuildVariantsByName) Len

func (b BuildVariantsByName) Len() int

func (BuildVariantsByName) Less

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

func (BuildVariantsByName) Swap

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

type CachedDispatcher

type CachedDispatcher interface {
	Refresh() error
	FindNextTask(context.Context, TaskSpec, time.Time) *TaskQueueItem
	Type() string
}

type CheckRun

type CheckRun struct {
	// PathToOutputs is a local file path to an output json file for the checkrun.
	PathToOutputs string `yaml:"path_to_outputs" bson:"path_to_outputs"`
}

CheckRun is used to provide information about a github check run.

type CommitQueueParams

type CommitQueueParams struct {
	Enabled     *bool      `bson:"enabled" json:"enabled" yaml:"enabled"`
	MergeMethod string     `bson:"merge_method" json:"merge_method" yaml:"merge_method"`
	MergeQueue  MergeQueue `bson:"merge_queue" json:"merge_queue" yaml:"merge_queue"`
	Message     string     `bson:"message,omitempty" json:"message,omitempty" yaml:"message"`
}

func (*CommitQueueParams) IsEnabled

func (p *CommitQueueParams) IsEnabled() bool

type Container

type Container struct {
	Name       string              `yaml:"name" bson:"name"`
	WorkingDir string              `yaml:"working_dir,omitempty" bson:"working_dir"`
	Image      string              `yaml:"image" bson:"image" plugin:"expand"`
	Size       string              `yaml:"size,omitempty" bson:"size"`
	Credential string              `yaml:"credential,omitempty" bson:"credential"`
	Resources  *ContainerResources `yaml:"resources,omitempty" bson:"resources"`
	System     ContainerSystem     `yaml:"system,omitempty" bson:"system"`
}

Container holds all properties that are configurable when defining a container for tasks and build variants to run on in a project YAML file.

type ContainerResources

type ContainerResources struct {
	Name     string `bson:"name,omitempty" json:"name" yaml:"name"`
	MemoryMB int    `bson:"memory_mb,omitempty" json:"memory_mb" yaml:"memory_mb"`
	CPU      int    `bson:"cpu,omitempty" json:"cpu" yaml:"cpu"`
}

ContainerResources specifies the computing resources given to the container. MemoryMB is the memory (in MB) that the container will be allocated, and CPU is the CPU units that will be allocated. 1024 CPU units is equivalent to 1vCPU.

func (ContainerResources) Validate

func (c ContainerResources) Validate(ecsConf evergreen.ECSConfig) error

Validate that essential ContainerResources fields are properly defined.

type ContainerSecret

type ContainerSecret struct {
	// Name is the user-friendly display name of the secret.
	Name string `bson:"name" json:"name" yaml:"name"`
	// Type is the type of secret that is stored.
	Type ContainerSecretType `bson:"type" json:"type" yaml:"type"`
	// ExternalName is the name of the stored secret.
	ExternalName string `bson:"external_name" json:"external_name" yaml:"external_name"`
	// ExternalID is the unique resource identifier for the secret. This can be
	// used to access and modify the secret.
	ExternalID string `bson:"external_id" json:"external_id" yaml:"external_id"`
	// Value is the plaintext value of the secret. This is not stored and must
	// be retrieved using the external ID.
	Value string `bson:"-" json:"-" yaml:"-"`
}

ContainerSecret specifies the username and password required for authentication on a private image repository. The credential is saved in AWS Secrets Manager upon saving to the ProjectRef

func ValidateContainerSecrets

func ValidateContainerSecrets(settings *evergreen.Settings, projectID string, original, toUpdate []ContainerSecret) ([]ContainerSecret, error)

ValidateContainerSecrets checks that the project-level container secrets to be added/updated are valid and sets default values where necessary. It returns the validated and merged container secrets, including the unmodified secrets, the modified secrets, and the new secrets to create.

func (ContainerSecret) Validate

func (c ContainerSecret) Validate() error

Validate that essential container secret fields are properly defined for a new secret.

type ContainerSecretCache

type ContainerSecretCache struct{}

ContainerSecretCache implements the cocoa.SecretCache to provide a cache to store secrets in the DB's project ref.

func (ContainerSecretCache) Delete

func (c ContainerSecretCache) Delete(_ context.Context, externalID string) error

Delete deletes a container secret from the project ref by its external identifier.

func (ContainerSecretCache) GetTag

func (c ContainerSecretCache) GetTag() string

GetTag returns the tag used for tracking cloud container secrets.

func (ContainerSecretCache) Put

Put sets the external ID for a project ref's container secret by its name.

type ContainerSecretType

type ContainerSecretType string

ContainerSecretType represents a particular type of container secret, which designates its purpose.

const (
	// ContainerSecretPodSecret is a container secret representing the Evergreen
	// agent's pod secret.
	ContainerSecretPodSecret ContainerSecretType = "pod_secret"
	// ContainerSecretRepoCreds is a container secret representing an image
	// repository's credentials.
	ContainerSecretRepoCreds ContainerSecretType = "repository_credentials"
)

func (ContainerSecretType) Validate

func (t ContainerSecretType) Validate() error

Validate checks that the container secret type is recognized.

type ContainerSystem

type ContainerSystem struct {
	CPUArchitecture evergreen.ContainerArch  `yaml:"cpu_architecture,omitempty" bson:"cpu_architecture"`
	OperatingSystem evergreen.ContainerOS    `yaml:"operating_system,omitempty" bson:"operating_system"`
	WindowsVersion  evergreen.WindowsVersion `yaml:"windows_version,omitempty" bson:"windows_version"`
}

ContainerSystem specifies the architecture and OS for the running container to use.

func (ContainerSystem) Validate

func (c ContainerSystem) Validate() error

Validate that essential ContainerSystem fields are properly defined and no data contradictions exist.

type ContainerTaskQueue

type ContainerTaskQueue struct {
	// contains filtered or unexported fields
}

ContainerTaskQueue represents an iterator that represents an ordered queue of container tasks that are ready be allocated a container.

func NewContainerTaskQueue

func NewContainerTaskQueue() (*ContainerTaskQueue, error)

NewContainerTaskQueue returns a populated iterator representing an ordered queue of container tasks that are ready to be allocated a container.

func (*ContainerTaskQueue) HasNext

func (q *ContainerTaskQueue) HasNext() bool

HasNext returns whether or not there are more container tasks that have not yet been returned.

func (*ContainerTaskQueue) Len

func (q *ContainerTaskQueue) Len() int

Len returns the number of tasks remaining.

func (*ContainerTaskQueue) Next

func (q *ContainerTaskQueue) Next() *task.Task

Next returns the next task that's ready for container allocation. It will return a nil task once there are no tasks remaining in the queue.

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 DistroQueueInfo

type DistroQueueInfo struct {
	Length                     int             `bson:"length" json:"length"`
	LengthWithDependenciesMet  int             `bson:"length_with_dependencies_met" json:"length_with_dependencies_met"`
	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"`
	CountDurationOverThreshold int             `bson:"count_over_threshold" json:"count_over_threshold"`
	DurationOverThreshold      time.Duration   `bson:"duration_over_threshold" json:"duration_over_threshold"`
	CountWaitOverThreshold     int             `bson:"count_wait_over_threshold" json:"count_wait_over_threshold"`
	TaskGroupInfos             []TaskGroupInfo `bson:"task_group_infos" json:"task_group_infos"`
	// SecondaryQueue refers to whether or not this info refers to a secondary queue.
	// Tags don't match due to outdated naming convention.
	SecondaryQueue bool `bson:"alias_queue" json:"alias_queue"`
}

func GetDistroQueueInfo

func GetDistroQueueInfo(distroID string) (DistroQueueInfo, error)

func GetDistroSecondaryQueueInfo

func GetDistroSecondaryQueueInfo(distroID string) (DistroQueueInfo, error)

func (*DistroQueueInfo) GetQueueCollection

func (q *DistroQueueInfo) GetQueueCollection() string

GetQueueCollection returns the collection associated with this queue.

type DuplicateEnqueuedTasksResult

type DuplicateEnqueuedTasksResult struct {
	TaskID    string   `bson:"_id"`
	DistroIDs []string `bson:"distros"`
}

func FindDuplicateEnqueuedTasks

func FindDuplicateEnqueuedTasks(coll string) ([]DuplicateEnqueuedTasksResult, error)

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 EnqueuePatch

type EnqueuePatch struct {
	PatchID string
}

func (*EnqueuePatch) Send

func (e *EnqueuePatch) Send() error

func (*EnqueuePatch) String

func (e *EnqueuePatch) String() string

func (*EnqueuePatch) Valid

func (e *EnqueuePatch) Valid() bool

type ExhaustedIterator

type ExhaustedIterator struct {
	Before, After bool
}
type ExternalLink struct {
	DisplayName string   `bson:"display_name,omitempty" json:"display_name,omitempty" yaml:"display_name,omitempty"`
	Requesters  []string `bson:"requesters,omitempty" json:"requesters,omitempty" yaml:"requesters,omitempty"`
	URLTemplate string   `bson:"url_template,omitempty" json:"url_template,omitempty" yaml:"url_template,omitempty"`
}

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 GeneratedProject

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

	// Task is the task that is running generate.tasks.
	Task           *task.Task
	ActivationInfo *specificActivationInfo
	NewTVPairs     *TaskVariantPairs
}

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

func MergeGeneratedProjects

func MergeGeneratedProjects(ctx context.Context, projects []GeneratedProject) (*GeneratedProject, error)

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

func ParseProjectFromJSONString

func ParseProjectFromJSONString(data string) (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) CheckForCycles

func (g *GeneratedProject) CheckForCycles(ctx context.Context, v *Version, p *Project, projectRef *ProjectRef) error

CheckForCycles builds a dependency graph from the existing tasks in the version and simulates adding the generated tasks, their dependencies, and dependencies on the generated tasks to the graph. Returns a DependencyCycleError error if the resultant graph contains dependency cycles.

func (*GeneratedProject) GetNewTasksAndActivationInfo

func (g *GeneratedProject) GetNewTasksAndActivationInfo(ctx context.Context, v *Version, p *Project) (*TaskVariantPairs, *specificActivationInfo)

GetNewTasksAndActivationInfo computes the generate.tasks variant-tasks to be created and specific activation information for those tasks.

func (*GeneratedProject) NewVersion

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, settings *evergreen.Settings, p *Project, pp *ParserProject, v *Version) error

type GetProjectOpts

type GetProjectOpts struct {
	Ref                 *ProjectRef
	PatchOpts           *PatchOpts
	LocalModules        map[string]string
	RemotePath          string
	Revision            string
	ReadFileFrom        string
	Identifier          string
	UnmarshalStrict     bool
	LocalModuleIncludes []patch.LocalModuleInclude
	ReferencePatchID    string
	ReferenceManifestID string
}

func (*GetProjectOpts) UpdateReadFileFrom

func (opts *GetProjectOpts) UpdateReadFileFrom(path string)

UpdateNewFile modifies ReadFileFrom to read from the patch diff if the included file has been modified.

type GetProjectTasksOpts

type GetProjectTasksOpts struct {
	Limit        int      `json:"num_versions"`
	BuildVariant string   `json:"build_variant"`
	StartAt      int      `json:"start_at"`
	Requesters   []string `json:"requesters"`
}

type GetVersionsOptions

type GetVersionsOptions struct {
	Start          int    `json:"start"`
	RevisionEnd    int    `json:"revision_end"`
	Requester      string `json:"requester"`
	Limit          int    `json:"limit"`
	Skip           int    `json:"skip"`
	IncludeBuilds  bool   `json:"include_builds"`
	IncludeTasks   bool   `json:"include_tasks"`
	ByBuildVariant string `json:"by_build_variant"`
	ByTask         string `json:"by_task"`
}

GetVersionsOptions is a struct that holds the options for retrieving a list of versions

type GitHubDynamicTokenPermissionGroup

type GitHubDynamicTokenPermissionGroup struct {
	// Name is the name of the group.
	Name string `bson:"name,omitempty" json:"name,omitempty" yaml:"name,omitempty"`
	// Permissions are a key-value pair of GitHub token permissions to their permission level
	Permissions github.InstallationPermissions `bson:"permissions,omitempty" json:"permissions,omitempty" yaml:"permissions,omitempty"`
	// AllPermissions is a flag that indicates that the group has all permissions.
	// If this is set to true, the Permissions field is ignored.
	// If this is set to false, the Permissions field is used (and may be
	// nil, representing no permissions).
	AllPermissions bool `bson:"all_permissions,omitempty" json:"all_permissions,omitempty" yaml:"all_permissions,omitempty"`
}

GitHubDynamicTokenPermissionGroup is a permission group for GitHub dynamic access tokens.

func (*GitHubDynamicTokenPermissionGroup) HasNoPermissions

func (p *GitHubDynamicTokenPermissionGroup) HasNoPermissions() bool

HasNoPermissions tests if the group has no permissions.

func (*GitHubDynamicTokenPermissionGroup) Intersection

Intersection returns the most restrictive intersection of the two permission groups. The name carries over from the calling group. If either permission is no permissions, it will return a group with no permissions.

type GitTag

type GitTag struct {
	Tag    string
	Pusher string
}

type GitTags

type GitTags []GitTag

func (GitTags) String

func (tags GitTags) String() string

type GithubProjectConflicts

type GithubProjectConflicts struct {
	CommitQueueIdentifiers []string
	PRTestingIdentifiers   []string
	CommitCheckIdentifiers []string
}

type JiraSuggest

type JiraSuggest struct {
	BbProj      evergreen.BuildBaronSettings
	JiraHandler thirdparty.JiraHandler
}

func (*JiraSuggest) GetTimeout

func (js *JiraSuggest) GetTimeout() time.Duration

func (*JiraSuggest) Suggest

func (js *JiraSuggest) Suggest(ctx context.Context, t *task.Task) ([]thirdparty.JiraTicket, error)

Suggest returns JIRA ticket results based on the test and/or task name.

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 MainlineCommitVersionOptions

type MainlineCommitVersionOptions struct {
	Limit           int
	SkipOrderNumber int
	Requesters      []string
}

type MergeQueue

type MergeQueue string
const (
	MergeQueueEvergreen MergeQueue = "EVERGREEN"
	MergeQueueGitHub    MergeQueue = "GITHUB"
)

type ModifyVersionsOptions

type ModifyVersionsOptions struct {
	Priority      *int64 `json:"priority"`
	StartTimeStr  string `json:"start_time_str"`
	EndTimeStr    string `json:"end_time_str"`
	RevisionStart int    `json:"revision_start"`
	RevisionEnd   int    `json:"revision_end"`
	Requester     string `json:"requester"`
}

ModifyVersionsOptions is a struct containing options necessary to modify versions.

type Module

type Module struct {
	Name       string `yaml:"name,omitempty" bson:"name" plugin:"expand"`
	Branch     string `yaml:"branch,omitempty" bson:"branch"  plugin:"expand"`
	Repo       string `yaml:"repo,omitempty" bson:"repo"  plugin:"expand"`
	Owner      string `yaml:"owner,omitempty" bson:"owner"  plugin:"expand"`
	Prefix     string `yaml:"prefix,omitempty" bson:"prefix"  plugin:"expand"`
	Ref        string `yaml:"ref,omitempty" bson:"ref"  plugin:"expand"`
	AutoUpdate bool   `yaml:"auto_update,omitempty" bson:"auto_update"`
}

Module specifies the git details of another git project to be included within a given version at runtime. Module fields include the expand plugin tag because they need to support project ref variable expansions.

func GetModuleByName

func GetModuleByName(moduleList ModuleList, moduleName string) (*Module, error)

func (Module) GetOwnerAndRepo

func (m Module) GetOwnerAndRepo() (string, string, error)

GetOwnerAndRepo returns the owner and repo for a module If the owner is not set, it will attempt to parse the repo URL to get the owner and repo.

type ModuleList

type ModuleList []Module

func (*ModuleList) IsIdentical

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

type MultiSourceSuggest

type MultiSourceSuggest struct {
	JiraSuggester Suggester
}

func (*MultiSourceSuggest) Suggest

func (mss *MultiSourceSuggest) Suggest(t *task.Task) ([]thirdparty.JiraTicket, string, error)

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 ParameterInfo

type ParameterInfo struct {
	patch.Parameter `yaml:",inline" bson:",inline"`
	Description     string `yaml:"description" bson:"description"`
}

ParameterInfo is used to provide extra information about a parameter.

type ParameterMapping

type ParameterMapping struct {
	// Name is the name of the value being stored (e.g. a project variable
	// name).
	Name string `bson:"name" json:"name"`
	// ParameterName is the location where the parameter is kept in Parameter
	// Store.
	ParameterName string `bson:"parameter_name" json:"parameter_name"`
}

ParameterMapping represents a mapping between a DB field and the location of its actual value in Parameter Store. This is used to keep track of where sensitive secrets can be found in Parameter Store.

type ParameterMappings

type ParameterMappings []ParameterMapping

ParameterMappings is a wrapper around a slice of mappings between names and their corresponding parameters kept in Parameter Store.

func FullSyncToParameterStore

func FullSyncToParameterStore(ctx context.Context, vars *ProjectVars, pRef *ProjectRef, isRepoRef bool) (*ParameterMappings, error)

TODO (DEVPROD-11882): remove full sync logic once the Parameter Store rollout is complete. This functionality only exists to aid the migration process.

func (ParameterMappings) Len

func (pm ParameterMappings) Len() int

Len returns the number of parameter mappings for the sake of implementing sort.Interface.

func (ParameterMappings) Less

func (pm ParameterMappings) Less(i, j int) bool

Less returns whether the parameter mapping name at index i must be sorted before the parameter mapping name at index j for the sake of implementing sort.Interface.

func (ParameterMappings) NameMap

func (pm ParameterMappings) NameMap() map[string]ParameterMapping

NameMap returns a map from each name to the full parameter mapping information.

func (ParameterMappings) Names

func (pm ParameterMappings) Names() []string

Names returns the names for each parameter mapping.

func (ParameterMappings) ParameterNameMap

func (pm ParameterMappings) ParameterNameMap() map[string]ParameterMapping

ParameterNameMap returns a map from each parameter name to the full parameter mapping information.

func (ParameterMappings) ParameterNames

func (pm ParameterMappings) ParameterNames() []string

ParameterNames returns the parameter names for each parameter mapping.

func (ParameterMappings) Swap

func (pm ParameterMappings) Swap(i, j int)

Swap swaps the parameter mappings at indices i and j for the sake of implementing sort.Interface.

type ParserProject

type ParserProject struct {
	// Id and ConfigdUpdateNumber are not pointers because they are only used internally
	Id string `yaml:"_id" bson:"_id"` // should be the same as the version's ID
	// UpdatedByGenerators is used to determine if the parser project needs to be re-saved or not.
	UpdatedByGenerators []string `yaml:"updated_by_generators,omitempty" bson:"updated_by_generators,omitempty"`
	// List of yamls to merge
	Include []parserInclude `yaml:"include,omitempty" bson:"include,omitempty"`

	// Beginning of ParserProject mergeable fields (this comment is used by the linter).
	Stepback           *bool                      `yaml:"stepback,omitempty" bson:"stepback,omitempty"`
	PreTimeoutSecs     *int                       `yaml:"pre_timeout_secs,omitempty" bson:"pre_timeout_secs,omitempty"`
	PostTimeoutSecs    *int                       `yaml:"post_timeout_secs,omitempty" bson:"post_timeout_secs,omitempty"`
	PreErrorFailsTask  *bool                      `yaml:"pre_error_fails_task,omitempty" bson:"pre_error_fails_task,omitempty"`
	PostErrorFailsTask *bool                      `yaml:"post_error_fails_task,omitempty" bson:"post_error_fails_task,omitempty"`
	OomTracker         *bool                      `yaml:"oom_tracker,omitempty" bson:"oom_tracker,omitempty"`
	Owner              *string                    `yaml:"owner,omitempty" bson:"owner,omitempty"`
	Repo               *string                    `yaml:"repo,omitempty" bson:"repo,omitempty"`
	RemotePath         *string                    `yaml:"remote_path,omitempty" bson:"remote_path,omitempty"`
	Branch             *string                    `yaml:"branch,omitempty" bson:"branch,omitempty"`
	Identifier         *string                    `yaml:"identifier,omitempty" bson:"identifier,omitempty"`
	DisplayName        *string                    `yaml:"display_name,omitempty" bson:"display_name,omitempty"`
	CommandType        *string                    `yaml:"command_type,omitempty" bson:"command_type,omitempty"`
	Ignore             parserStringSlice          `yaml:"ignore,omitempty" bson:"ignore,omitempty"`
	Parameters         []ParameterInfo            `yaml:"parameters,omitempty" bson:"parameters,omitempty"`
	Pre                *YAMLCommandSet            `yaml:"pre,omitempty" bson:"pre,omitempty"`
	Post               *YAMLCommandSet            `yaml:"post,omitempty" bson:"post,omitempty"`
	Timeout            *YAMLCommandSet            `yaml:"timeout,omitempty" bson:"timeout,omitempty"`
	CallbackTimeout    *int                       `yaml:"callback_timeout_secs,omitempty" bson:"callback_timeout_secs,omitempty"`
	Modules            []Module                   `yaml:"modules,omitempty" bson:"modules,omitempty"`
	Containers         []Container                `yaml:"containers,omitempty" bson:"containers,omitempty"`
	BuildVariants      []parserBV                 `yaml:"buildvariants,omitempty" bson:"buildvariants,omitempty"`
	Functions          map[string]*YAMLCommandSet `yaml:"functions,omitempty" bson:"functions,omitempty"`
	TaskGroups         []parserTaskGroup          `yaml:"task_groups,omitempty" bson:"task_groups,omitempty"`
	Tasks              []parserTask               `yaml:"tasks,omitempty" bson:"tasks,omitempty"`
	ExecTimeoutSecs    *int                       `yaml:"exec_timeout_secs,omitempty" bson:"exec_timeout_secs,omitempty"`
	TimeoutSecs        *int                       `yaml:"timeout_secs,omitempty" bson:"timeout_secs,omitempty"`
	CreateTime         time.Time                  `yaml:"create_time,omitempty" bson:"create_time,omitempty"`

	// Matrix code
	Axes []matrixAxis `yaml:"axes,omitempty" bson:"axes,omitempty"`

} // End of ParserProject mergeable fields (this comment is used by the linter).

ParserProject serves as an intermediary struct for parsing project configuration YAML. It implements the Unmarshaler interface to allow for flexible handling. From a mental model perspective, the ParserProject is the project configuration after YAML rules have been evaluated (e.g. matching YAML fields to Go struct fields, evaluating YAML anchors and aliases), but before any Evergreen-specific evaluation rules have been applied. For example, Evergreen has a custom feature to support tagging a set of tasks and expanding those tags into a list of tasks under the build variant's list of tasks (i.e. ".tagname" syntax). In the ParserProject, these are stored as the unexpanded tag text (i.e. ".tagname"), and these tags are not evaluated until the ParserProject is turned into a final Project.

func LoadProjectInto

func LoadProjectInto(ctx context.Context, data []byte, opts *GetProjectOpts, identifier string, project *Project) (*ParserProject, error)

LoadProjectInto loads the raw data from the config file into project and sets the project's identifier field to identifier. Tags are evaluated. Returns the intermediate step. If reading from a version config, LoadProjectInfoForVersion should be used to persist the resulting parser project. opts is used to look up files on github if the main parser project has an Include.

func ParserProjectFindOneByID

func ParserProjectFindOneByID(ctx context.Context, settings *evergreen.Settings, method evergreen.ParserProjectStorageMethod, id string) (*ParserProject, error)

ParserProjectFindOneByID is a convenience wrapper to find one parser project by ID from persistent storage.

func (*ParserProject) AddBuildVariant

func (pp *ParserProject) AddBuildVariant(name, displayName, runOn string, batchTime *int, tasks []string)

func (*ParserProject) AddTask

func (pp *ParserProject) AddTask(name string, commands []PluginCommandConf)

func (*ParserProject) GetParameters

func (pp *ParserProject) GetParameters() []patch.Parameter

func (*ParserProject) Init

func (pp *ParserProject) Init(id string, createdAt time.Time)

Init initializes the parser project with the expected fields before it is persisted. It's assumed that the remaining parser project configuration is already populated, but these values to initialize come from an external source (i.e. the patch or version it's based on).

func (*ParserProject) Insert

func (pp *ParserProject) Insert() error

func (*ParserProject) MarshalBSON

func (pp *ParserProject) MarshalBSON() ([]byte, error)

func (*ParserProject) MarshalYAML

func (pp *ParserProject) MarshalYAML() (interface{}, error)

func (*ParserProject) RetryMarshalBSON

func (pp *ParserProject) RetryMarshalBSON(retries int) ([]byte, error)

RetryMarshalBSON marshals the BSON and attempts to unmarshal it back to make sure it is valid. It only retries when it fails at reading the BSON, not if it encountered an error while marshalling.

type ParserProjectDBStorage

type ParserProjectDBStorage struct{}

ParserProjectDBStorage implements the ParserProjectStorage interface to access parser projects stored in the DB.

func (ParserProjectDBStorage) FindOneByID

FindOneByID finds a parser project from the DB by its ID. This ignores the context parameter.

func (ParserProjectDBStorage) FindOneByIDWithFields

func (s ParserProjectDBStorage) FindOneByIDWithFields(_ context.Context, id string, fields ...string) (*ParserProject, error)

FindOneByIDWithFields returns the parser project from the DB with only the requested fields populated. This may be more efficient than fetching the entire parser project. This ignores the context parameter.

func (ParserProjectDBStorage) UpsertOne

UpsertOne replaces a parser project in the DB if one exists with the same ID. Otherwise, if it does not exist yet, it inserts a new parser project.

type ParserProjectS3Storage

type ParserProjectS3Storage struct {
	// contains filtered or unexported fields
}

ParserProjectS3Storage implements the ParserProjectStorage interface to access parser projects stored in S3.

func NewParserProjectS3Storage

func NewParserProjectS3Storage(ctx context.Context, ppConf evergreen.ParserProjectS3Config) (*ParserProjectS3Storage, error)

NewParserProjectS3Storage sets up access to parser projects stored in S3.

func (*ParserProjectS3Storage) FindOneByID

func (s *ParserProjectS3Storage) FindOneByID(ctx context.Context, id string) (*ParserProject, error)

FindOneByID finds a parser project in S3 using its ID. If the context errors, it will return the context error.

func (*ParserProjectS3Storage) FindOneByIDWithFields

func (s *ParserProjectS3Storage) FindOneByIDWithFields(ctx context.Context, id string, fields ...string) (*ParserProject, error)

FindOneByIDWithFields finds a parser project using its ID from S3 and returns the parser project with only the requested fields populated. This is not any more efficient than FindOneByID. If the context errors, it will return the context error.

func (*ParserProjectS3Storage) UpsertOne

func (s *ParserProjectS3Storage) UpsertOne(ctx context.Context, pp *ParserProject) error

UpsertOne replaces a parser project if the parser project in S3 with the same ID already exists. If it does not exist yet, it inserts a new parser project.

func (*ParserProjectS3Storage) UpsertOneBSON

func (s *ParserProjectS3Storage) UpsertOneBSON(ctx context.Context, id string, bsonPP []byte) error

UpsertOneBSON upserts a parser project by its ID when has already been marshalled to BSON.

type ParserProjectStorage

type ParserProjectStorage interface {
	// FindOneByID finds a parser project using its ID. If the parser project
	// does not exist in the underlying storage, implementations must return a
	// nil parser project and nil error. Implementations may or may not respect
	// the context.
	FindOneByID(ctx context.Context, id string) (*ParserProject, error)
	// FindOneByIDWithFields finds a parser project using its ID and returns the
	// parser project with at least the requested fields populated.
	// Implementations may choose to return more fields than those explicitly
	// requested. If the parser project does not exist in the underlying
	// storage, implementations must return a nil parser project and nil error.
	// Implementations may or may not respect the context.
	FindOneByIDWithFields(ctx context.Context, id string, fields ...string) (*ParserProject, error)
	// UpsertOne replaces a parser project if the parser project with the
	// same ID already exists. If it does not exist yet, it inserts a new parser
	// project.
	UpsertOne(ctx context.Context, pp *ParserProject) error
}

ParserProjectStorage is an interface for accessing the parser project.

func GetParserProjectStorage

func GetParserProjectStorage(ctx context.Context, settings *evergreen.Settings, method evergreen.ParserProjectStorageMethod) (ParserProjectStorage, error)

GetParserProjectStorage returns the parser project storage mechanism to access the persistent copy of it.

type PatchConfig

type PatchConfig struct {
	PatchedParserProjectYAML string
	PatchedParserProject     *ParserProject
	PatchedProjectConfig     string
}

type PatchOpts

type PatchOpts struct {
	// contains filtered or unexported fields
}

type PatchUpdate

type PatchUpdate struct {
	Description         string               `json:"description"`
	Caller              string               `json:"caller"`
	Parameters          []patch.Parameter    `json:"parameters,omitempty"`
	PatchTriggerAliases []string             `json:"patch_trigger_aliases,omitempty"`
	VariantsTasks       []patch.VariantTasks `json:"variants_tasks,omitempty"`
}

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"`
	Cron          string    `bson:"cron" json:"cron"`
	Alias         string    `bson:"alias,omitempty" json:"alias,omitempty"`
	Message       string    `bson:"message,omitempty" json:"message,omitempty"`
	NextRunTime   time.Time `bson:"next_run_time,omitempty" json:"next_run_time,omitempty"`
}

func (*PeriodicBuildDefinition) Validate

func (d *PeriodicBuildDefinition) Validate() error

type PickaxeParams

type PickaxeParams struct {
	Project       *Project
	TaskName      string
	NewestOrder   int64
	OldestOrder   int64
	BuildVariants []string
}

type PluginCommandConf

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

	// DisplayName is a human readable description of the function of a given
	// command.
	DisplayName string `yaml:"display_name,omitempty" bson:"display_name,omitempty"`

	// 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,omitempty"`

	// 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,omitempty"`

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

	// Params is used to define params in the yaml and parser project,
	// but is not stored in the DB (instead see ParamsYAML).
	Params map[string]interface{} `yaml:"params,omitempty" bson:"-"`

	// ParamsYAML is the marshalled Params to store in the database, to preserve nested interfaces.
	ParamsYAML string `yaml:"params_yaml,omitempty" bson:"params_yaml,omitempty"`

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

	// RetryOnFailure indicates whether the task should be retried if this command fails.
	RetryOnFailure bool `yaml:"retry_on_failure,omitempty" bson:"retry_on_failure,omitempty"`

	// FailureMetadataTags are user-defined tags which are not used directly by
	// Evergreen but can be used to allow users to set additional metadata about
	// the command/function if it fails.
	// TODO (DEVPROD-5122): add documentation once the additional features for
	// failing commands (which don't fail the task) are complete.
	FailureMetadataTags []string `yaml:"failure_metadata_tags,omitempty" bson:"failure_metadata_tags,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) UnmarshalBSON

func (c *PluginCommandConf) UnmarshalBSON(in []byte) error

func (*PluginCommandConf) UnmarshalYAML

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

type Project

type Project struct {
	Stepback           bool                       `yaml:"stepback,omitempty" bson:"stepback"`
	PreTimeoutSecs     int                        `yaml:"pre_timeout_secs,omitempty" bson:"pre_timeout_secs,omitempty"`
	PostTimeoutSecs    int                        `yaml:"post_timeout_secs,omitempty" bson:"post_timeout_secs,omitempty"`
	PreErrorFailsTask  bool                       `yaml:"pre_error_fails_task,omitempty" bson:"pre_error_fails_task,omitempty"`
	PostErrorFailsTask bool                       `yaml:"post_error_fails_task,omitempty" bson:"post_error_fails_task,omitempty"`
	OomTracker         bool                       `yaml:"oom_tracker,omitempty" bson:"oom_tracker"`
	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"`
	Parameters         []ParameterInfo            `yaml:"parameters,omitempty" bson:"parameters,omitempty"`
	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"`
	Containers         []Container                `yaml:"containers,omitempty" bson:"containers"`
	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"`
	TimeoutSecs        int                        `yaml:"timeout_secs,omitempty" bson:"timeout_secs"`

	// Number of includes in the project cached for validation
	NumIncludes int `yaml:"-" bson:"-"`
}

Project represents the fully hydrated project configuration after translating the ParserProject.

func FindProjectFromVersionID

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

func GetProjectFromBSON

func GetProjectFromBSON(data []byte) (*Project, error)

func TranslateProject

func TranslateProject(pp *ParserProject) (*Project, error)

TranslateProject converts our intermediate project representation into the Project type that Evergreen actually uses.

func (*Project) BuildProjectTVPairs

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

BuildProjectTVPairs resolves the build variants and tasks into which build variants will run and which tasks will run on each build variant. This filters out tasks that cannot run due to being disabled or having an unmatched requester (e.g. a patch-only task for a mainline commit).

func (*Project) BuildProjectTVPairsWithAlias

func (p *Project) BuildProjectTVPairsWithAlias(aliases []ProjectAlias, requester string) (TaskVariantPairs, error)

BuildProjectTVPairsWithAlias returns variants and tasks for a project alias. This filters out tasks that cannot run due to being disabled or having an unmatched requester (e.g. a patch-only task for a mainline commit).

func (*Project) CommandsRunOnBV

func (p *Project) CommandsRunOnBV(cmds []PluginCommandConf, cmd, bv string) []PluginCommandConf

CommandsRunOnBV returns the list of matching commands from cmds that will run the named command on the build variant.

func (*Project) CommandsRunOnTV

func (p *Project) CommandsRunOnTV(tv TVPair, cmd string) ([]PluginCommandConf, error)

CommandsRunOnTV returns the list of matching commands that match the given command name on the given task in a build variant.

func (*Project) DependencyGraph

func (p *Project) DependencyGraph() task.DependencyGraph

DependencyGraph returns a task.DependencyGraph populated with the tasks in the project.

func (*Project) FindAllBuildVariantTasks

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

FindAllBuildVariantTasks returns every BuildVariantTaskUnit, fully populated, for all variants of a project. Note that task groups, although they are considered build variant task units, are not preserved. Instead, each task in the task group is expanded into its own individual tasks units.

func (*Project) FindAllTasksMap

func (p *Project) FindAllTasksMap() map[string]ProjectTask

func (*Project) FindAllVariants

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

func (*Project) FindBuildVariant

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

func (*Project) FindDisplayTasksForVariant

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

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

FindTaskForVariant returns the build variant task unit for a matching task or task within a task group. If searching for a task within the task group, the build variant task unit returned will have its fields populated, respecting precedence of settings (such as PatchOnly). Note that for tasks within a task group, the returned result will have the name of the task group it's part of, rather than the name of the task.

func (*Project) FindTaskGroup

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

FindTaskGroup returns a specific task group from a project

func (*Project) FindTaskGroupForTask

func (p *Project) FindTaskGroupForTask(bvName, taskName string) *TaskGroup

FindTaskGroupForTask returns a specific task group from a project that contains the given task.

func (*Project) FindTasksForVariant

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

FindTasksForVariant returns all tasks in a variant, including tasks in task groups.

func (*Project) FindVariantsWithTask

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

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

func (*Project) GetAllVariantTasks

func (p *Project) GetAllVariantTasks() []patch.VariantTasks

GetAllVariantTasks returns all the build variants and all tasks specified for each build variant.

func (*Project) GetDisplayTask

func (p *Project) GetDisplayTask(variant, name string) *patch.DisplayTask

func (*Project) GetModuleByName

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

func (*Project) GetNumCheckRunsFromTaskVariantPairs

func (p *Project) GetNumCheckRunsFromTaskVariantPairs(variantTasks *TaskVariantPairs) int

func (*Project) GetNumCheckRunsFromVariantTasks

func (p *Project) GetNumCheckRunsFromVariantTasks(variantTasks []patch.VariantTasks) int

func (*Project) GetParameters

func (p *Project) GetParameters() []patch.Parameter

func (*Project) GetTaskNameAndTags

func (p *Project) GetTaskNameAndTags(bvt BuildVariantTaskUnit) (string, []string, bool)

GetTaskNameAndTags checks the project for a task or task group matching the build variant task unit, and returns the name and tags

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

func (p *Project) ResolvePatchVTs(patchDoc *patch.Patch, requester, alias string, includeDeps bool) (resolvedBVs []string, resolvedTasks []string, vts []patch.VariantTasks)

ResolvePatchVTs resolves a list of build variants and tasks into a list of all build variants that will run, a list of all tasks that will run, and a mapping of the build variant to the tasks that will run on that build variant. If includeDeps is set, it will also resolve task dependencies. This filters out tasks that cannot run due to being disabled or having an unmatched requester (e.g. a patch-only task for a mainline commit).

func (*Project) TasksThatCallCommand

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

TasksThatCallCommand returns a map of tasks that call a given command to the number of times the command is called in the task.

func (*Project) VariantTasksForSelectors

func (p *Project) VariantTasksForSelectors(definitions []patch.PatchTriggerDefinition, requester string) ([]patch.VariantTasks, error)

type ProjectAlias

type ProjectAlias struct {
	ID          mgobson.ObjectId  `bson:"_id,omitempty" json:"_id" yaml:"id"`
	ProjectID   string            `bson:"project_id" json:"project_id" yaml:"project_id"`
	Alias       string            `bson:"alias" json:"alias" yaml:"alias"`
	Variant     string            `bson:"variant,omitempty" json:"variant" yaml:"variant"`
	Description string            `bson:"description" json:"description" yaml:"description"`
	GitTag      string            `bson:"git_tag" json:"git_tag" yaml:"git_tag"`
	RemotePath  string            `bson:"remote_path" json:"remote_path" yaml:"remote_path"`
	VariantTags []string          `bson:"variant_tags,omitempty" json:"variant_tags" yaml:"variant_tags"`
	Task        string            `bson:"task,omitempty" json:"task" yaml:"task"`
	TaskTags    []string          `bson:"tags,omitempty" json:"tags" yaml:"task_tags"`
	Parameters  []patch.Parameter `bson:"parameters,omitempty" json:"parameters" yaml:"parameters"`

	// Source is not stored; indicates where the alias is stored for the project.
	Source string `bson:"-" json:"-" yaml:"-"`
}

Git tags use a special alias "__git_tag" and create a new version for the matching variants/tasks, assuming the tag matches the defined git_tag regex. In this way, users can define different behavior for different kind of tags.

func ConstructMergedAliasesByPrecedence

func ConstructMergedAliasesByPrecedence(projectRef *ProjectRef, projectConfig *ProjectConfig, repoId string) ([]ProjectAlias, error)

ConstructMergedAliasesByPrecedence will construct a merged list of aliases based on what aliases are found at the project level, repo level, and project config level.

func FindAliasInProjectRepoOrConfig

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

FindAliasInProjectRepoOrConfig finds all aliases with a given name for a project. If the project has no aliases, the repo is checked for aliases.

func FindAliasInProjectRepoOrProjectConfig

func FindAliasInProjectRepoOrProjectConfig(projectID, alias string, projectConfig *ProjectConfig) ([]ProjectAlias, error)

FindAliasInProjectRepoOrProjectConfig finds all aliases with a given name for a project. If the project has no aliases, the patched config string is checked for the alias as well.

func FindAliasesForProjectFromDb

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

FindAliasesForProjectFromDb fetches all aliases for a given project without merging with aliases from the parser project

func FindAliasesForRepo

func FindAliasesForRepo(repoId string) ([]ProjectAlias, error)

FindAliasesForRepo fetches all aliases for a given project

func FindMatchingGitTagAliasesInProject

func FindMatchingGitTagAliasesInProject(projectID, tag string) ([]ProjectAlias, error)

func (ProjectAlias) HasMatchingTask

func (a ProjectAlias) HasMatchingTask(taskName string, taskTags []string) (bool, error)

func (ProjectAlias) HasMatchingVariant

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

HasMatchingVariant returns whether or not one the alias variant regexp matches the variant's name, or the alias' variant tags match the variant's tags. Note that this does not check for matching tasks.

func (*ProjectAlias) Upsert

func (p *ProjectAlias) Upsert() error

type ProjectAliases

type ProjectAliases []ProjectAlias

func (ProjectAliases) AliasesMatchingVariant

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

AliasesMatchingVariant returns the filtered set of project aliases for which the alias' variant regexp matches the variant's name, or the alias' variant tags match the variant's tags.

func (ProjectAliases) HasMatchingGitTag

func (a ProjectAliases) HasMatchingGitTag(tag string) (bool, error)

HasMatchingGitTag determines whether or not the given git tag name matches any of the project aliases' git tag regexp.

func (ProjectAliases) HasMatchingTask

func (a ProjectAliases) HasMatchingTask(taskName string, taskTags []string) (bool, error)

HasMatchingTask returns whether or not one the alias task regexp matches the variant's name, or the alias' task tags match the variant's tags. Note that this does not check for matching variant.

type ProjectBanner

type ProjectBanner struct {
	Theme evergreen.BannerTheme `bson:"theme" json:"theme"`
	Text  string                `bson:"text" json:"text"`
}

type ProjectChangeEvent

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

func (*ProjectChangeEvent) RedactSecrets

func (e *ProjectChangeEvent) RedactSecrets()

RedactSecrets redacts project secrets from a project change event. Project variables that are not changed are cleared and project variables that are changed are replaced with redacted placeholders.

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)

MostRecentProjectEvents returns the n most recent project events for the given project ID.

func ProjectEventsBefore

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

ProjectEventsBefore returns the n most recent project events for the given project ID that occurred before the given time.

func (*ProjectChangeEvents) ApplyDefaults

func (p *ProjectChangeEvents) ApplyDefaults()

ApplyDefaults checks for any flags that indicate that a field in a project event should be nil and sets the field accordingly. Attached projects need to be able to distinguish between empty arrays and nil: nil values default to repo, while empty arrays do not. Look at the flags set in the ProjectSettingsEvent so that fields that were converted to empty arrays when casting to an interface{} can be correctly set to nil

func (*ProjectChangeEvents) RedactGitHubPrivateKey

func (p *ProjectChangeEvents) RedactGitHubPrivateKey()

RedactGitHubPrivateKey redacts the GitHub app's private key from the project modification event.

func (*ProjectChangeEvents) RedactSecrets

func (p *ProjectChangeEvents) RedactSecrets()

RedactSecrets redacts project variables from all the project modification events. TODO (DEVPROD-11827): this can be removed entirely once project event logs are migrated to not store any project var values or GitHub app credentials. Project change events should already redact those secret values when the log is inserted into the DB (see (ProjectChangeEvent).RedactSecrets).

type ProjectConfig

type ProjectConfig struct {
	Id         string    `yaml:"_id" bson:"_id"`
	CreateTime time.Time `yaml:"create_time,omitempty" bson:"create_time,omitempty"`
	Project    string    `yaml:"project,omitempty" bson:"project,omitempty"`
	// ProjectConfigFields are the properties on the project config that do not duplicate parser project's fields to allow strict unmarshalling of a full config file.
	// Since a config file gets split into ParserProject and ProjectConfig, strict unmarshalling does not work when duplicate fields exist (e.g. Id, CreateTime).
	ProjectConfigFields `yaml:",inline" bson:",inline"`
}

func CreateProjectConfig

func CreateProjectConfig(yml []byte, identifier string) (*ProjectConfig, error)

CreateProjectConfig marshals the supplied YAML into our intermediate configs representation.

func FindLastKnownGoodProjectConfig

func FindLastKnownGoodProjectConfig(projectId string) (*ProjectConfig, error)

FindLastKnownGoodProjectConfig retrieves the most recent project config for the given project.

func FindProjectConfigById

func FindProjectConfigById(id string) (*ProjectConfig, error)

FindProjectConfigById returns a project config by id.

func FindProjectConfigForProjectOrVersion

func FindProjectConfigForProjectOrVersion(projectId, id string) (*ProjectConfig, error)

FindProjectConfigForProjectOrVersion returns a project config by id, or the most recent project config if id is empty

func ProjectConfigFindOne

func ProjectConfigFindOne(query db.Q) (*ProjectConfig, error)

func (*ProjectConfig) AllAliases

func (pc *ProjectConfig) AllAliases() ProjectAliases

func (*ProjectConfig) Insert

func (pc *ProjectConfig) Insert() error

func (*ProjectConfig) MarshalBSON

func (pc *ProjectConfig) MarshalBSON() ([]byte, error)

func (*ProjectConfig) SetInternalAliases

func (pc *ProjectConfig) SetInternalAliases()

type ProjectConfigFields

type ProjectConfigFields struct {
	// These fields can be set for the ProjectRef struct on the project page, or in the project config yaml.
	// Values for the below fields set on the project page will take precedence over this struct and will
	// be the configs used for a given project during runtime.
	TaskAnnotationSettings   *evergreen.AnnotationsSettings `yaml:"task_annotation_settings,omitempty" bson:"task_annotation_settings,omitempty"`
	BuildBaronSettings       *evergreen.BuildBaronSettings  `yaml:"build_baron_settings,omitempty" bson:"build_baron_settings,omitempty"`
	CommitQueueAliases       []ProjectAlias                 `yaml:"commit_queue_aliases,omitempty" bson:"commit_queue_aliases,omitempty"`
	GitHubPRAliases          []ProjectAlias                 `yaml:"github_pr_aliases,omitempty" bson:"github_pr_aliases,omitempty"`
	GitTagAliases            []ProjectAlias                 `yaml:"git_tag_aliases,omitempty" bson:"git_tag_aliases,omitempty"`
	GitHubChecksAliases      []ProjectAlias                 `yaml:"github_checks_aliases,omitempty" bson:"github_checks_aliases,omitempty"`
	PatchAliases             []ProjectAlias                 `yaml:"patch_aliases,omitempty" bson:"patch_aliases,omitempty"`
	WorkstationConfig        *WorkstationConfig             `yaml:"workstation_config,omitempty" bson:"workstation_config,omitempty"`
	TaskSync                 *TaskSyncOptions               `yaml:"task_sync,omitempty" bson:"task_sync,omitempty"`
	GithubTriggerAliases     []string                       `yaml:"github_trigger_aliases,omitempty" bson:"github_trigger_aliases,omitempty"`
	ContainerSizeDefinitions []ContainerResources           `yaml:"container_size_definitions,omitempty" bson:"container_size_definitions,omitempty"`
}

type ProjectHealthView

type ProjectHealthView string
const (
	ProjectHealthViewAll    ProjectHealthView = "ALL"
	ProjectHealthViewFailed ProjectHealthView = "FAILED"
)

type ProjectInfo

type ProjectInfo struct {
	Ref                 *ProjectRef
	Project             *Project
	IntermediateProject *ParserProject
	Config              *ProjectConfig
}

func GetProjectFromFile

func GetProjectFromFile(ctx context.Context, opts GetProjectOpts) (ProjectInfo, error)

GetProjectFromFile fetches project configuration files from its source (e.g. from a patch diff, GitHub, etc).

func LoadProjectInfoForVersion

func LoadProjectInfoForVersion(ctx context.Context, settings *evergreen.Settings, v *Version, id string) (ProjectInfo, error)

LoadProjectInfoForVersion returns the project info for a version from its parser project.

func (*ProjectInfo) NotPopulated

func (p *ProjectInfo) NotPopulated() bool

type ProjectPageSection

type ProjectPageSection string

type ProjectRef

type ProjectRef struct {
	// Id is the unmodifiable unique ID for the configuration, used internally.
	Id string `bson:"_id" json:"id" yaml:"id"`
	// Identifier must be unique, but is modifiable. Used by users.
	Identifier string `bson:"identifier" json:"identifier" yaml:"identifier"`

	// RemotePath is the path to the Evergreen config file.
	RemotePath             string              `bson:"remote_path" json:"remote_path" yaml:"remote_path"`
	DisplayName            string              `bson:"display_name" json:"display_name,omitempty" yaml:"display_name"`
	Enabled                bool                `bson:"enabled,omitempty" json:"enabled,omitempty" yaml:"enabled"`
	Restricted             *bool               `bson:"restricted,omitempty" json:"restricted,omitempty" yaml:"restricted"`
	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"`
	PatchingDisabled       *bool               `bson:"patching_disabled,omitempty" json:"patching_disabled,omitempty"`
	RepotrackerDisabled    *bool               `bson:"repotracker_disabled,omitempty" json:"repotracker_disabled,omitempty" yaml:"repotracker_disabled"`
	DispatchingDisabled    *bool               `bson:"dispatching_disabled,omitempty" json:"dispatching_disabled,omitempty" yaml:"dispatching_disabled"`
	StepbackDisabled       *bool               `bson:"stepback_disabled,omitempty" json:"stepback_disabled,omitempty" yaml:"stepback_disabled"`
	StepbackBisect         *bool               `bson:"stepback_bisect,omitempty" json:"stepback_bisect,omitempty" yaml:"stepback_bisect"`
	VersionControlEnabled  *bool               `bson:"version_control_enabled,omitempty" json:"version_control_enabled,omitempty" yaml:"version_control_enabled"`
	PRTestingEnabled       *bool               `bson:"pr_testing_enabled,omitempty" json:"pr_testing_enabled,omitempty" yaml:"pr_testing_enabled"`
	ManualPRTestingEnabled *bool               `bson:"manual_pr_testing_enabled,omitempty" json:"manual_pr_testing_enabled,omitempty" yaml:"manual_pr_testing_enabled"`
	GithubChecksEnabled    *bool               `bson:"github_checks_enabled,omitempty" json:"github_checks_enabled,omitempty" yaml:"github_checks_enabled"`
	BatchTime              int                 `bson:"batch_time" json:"batch_time" yaml:"batchtime"`
	DeactivatePrevious     *bool               `bson:"deactivate_previous,omitempty" json:"deactivate_previous,omitempty" yaml:"deactivate_previous"`
	NotifyOnBuildFailure   *bool               `bson:"notify_on_failure,omitempty" json:"notify_on_failure,omitempty"`
	Triggers               []TriggerDefinition `bson:"triggers" json:"triggers"`
	// all aliases defined for the project
	PatchTriggerAliases []patch.PatchTriggerDefinition `bson:"patch_trigger_aliases" json:"patch_trigger_aliases"`
	// all PatchTriggerAliases applied to github patch intents
	GithubTriggerAliases []string `bson:"github_trigger_aliases" json:"github_trigger_aliases"`
	// OldestAllowedMergeBase is the commit hash of the oldest merge base on the target branch
	// that PR patches can be created from.
	OldestAllowedMergeBase string                    `bson:"oldest_allowed_merge_base" json:"oldest_allowed_merge_base"`
	PeriodicBuilds         []PeriodicBuildDefinition `bson:"periodic_builds" json:"periodic_builds"`
	CommitQueue            CommitQueueParams         `bson:"commit_queue" json:"commit_queue" yaml:"commit_queue"`

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

	// SpawnHostScriptPath is a path to a script to optionally be run by users on hosts triggered from tasks.
	SpawnHostScriptPath string `bson:"spawn_host_script_path" json:"spawn_host_script_path" yaml:"spawn_host_script_path"`

	// TracksPushEvents, if true indicates that Repotracker is triggered by Github PushEvents for this project.
	// If a repo is enabled and this is what creates the hook, then TracksPushEvents will be set at the repo level.
	TracksPushEvents *bool `bson:"tracks_push_events" json:"tracks_push_events" yaml:"tracks_push_events"`

	// TaskSync holds settings for synchronizing task directories to S3.
	TaskSync TaskSyncOptions `bson:"task_sync" json:"task_sync" yaml:"task_sync"`

	// GitTagAuthorizedUsers contains a list of users who are able to create versions from git tags.
	GitTagAuthorizedUsers []string `bson:"git_tag_authorized_users" json:"git_tag_authorized_users"`
	GitTagAuthorizedTeams []string `bson:"git_tag_authorized_teams" json:"git_tag_authorized_teams"`
	GitTagVersionsEnabled *bool    `bson:"git_tag_versions_enabled,omitempty" json:"git_tag_versions_enabled,omitempty"`

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

	// Disable task stats caching for this project.
	DisabledStatsCache *bool `bson:"disabled_stats_cache,omitempty" json:"disabled_stats_cache,omitempty"`

	// List of commands
	// Lacks omitempty so that SetupCommands can be identified as either [] or nil in a ProjectSettingsEvent
	WorkstationConfig WorkstationConfig `bson:"workstation_config" json:"workstation_config"`

	// TaskAnnotationSettings holds settings for the file ticket button in the Task Annotations to call custom webhooks when clicked
	TaskAnnotationSettings evergreen.AnnotationsSettings `bson:"task_annotation_settings,omitempty" json:"task_annotation_settings,omitempty"`

	// Plugin settings
	BuildBaronSettings evergreen.BuildBaronSettings `bson:"build_baron_settings,omitempty" json:"build_baron_settings,omitempty" yaml:"build_baron_settings,omitempty"`
	PerfEnabled        *bool                        `bson:"perf_enabled,omitempty" json:"perf_enabled,omitempty" yaml:"perf_enabled,omitempty"`

	// Container settings
	ContainerSizeDefinitions []ContainerResources `` /* 131-byte string literal not displayed */
	ContainerSecrets         []ContainerSecret    `bson:"container_secrets,omitempty" json:"container_secrets,omitempty" yaml:"container_secrets,omitempty"`

	// RepoRefId is the repo ref id that this project ref tracks, if any.
	RepoRefId string `bson:"repo_ref_id" json:"repo_ref_id" yaml:"repo_ref_id"`

	// The following fields are used by Evergreen and are not discoverable.
	// Hidden determines whether or not the project is discoverable/tracked in the UI
	Hidden *bool `bson:"hidden,omitempty" json:"hidden,omitempty"`

	ExternalLinks []ExternalLink `bson:"external_links,omitempty" json:"external_links,omitempty" yaml:"external_links,omitempty"`
	Banner        ProjectBanner  `bson:"banner,omitempty" json:"banner,omitempty" yaml:"banner,omitempty"`

	// Filter/view settings
	ProjectHealthView ProjectHealthView `bson:"project_health_view" json:"project_health_view" yaml:"project_health_view"`
	ParsleyFilters    []parsley.Filter  `bson:"parsley_filters,omitempty" json:"parsley_filters,omitempty"`

	// GitHubDynamicTokenPermissionGroups is a list of permission groups for GitHub dynamic access tokens.
	GitHubDynamicTokenPermissionGroups []GitHubDynamicTokenPermissionGroup `` /* 167-byte string literal not displayed */

	// GitHubPermissionGroupByRequester is a mapping of requester type to the user defined GitHub permission groups above.
	GitHubPermissionGroupByRequester map[string]string `` /* 161-byte string literal not displayed */

	// ParameterStoreEnabled is a temporary feature flag to enable/disable
	// Parameter Store for storing project secrets.
	ParameterStoreEnabled bool `bson:"parameter_store_enabled,omitempty" json:"parameter_store_enabled,omitempty" yaml:"parameter_store_enabled,omitempty"`
	// ParameterStoreVarsSynced is a temporary flag that indicates whether the
	// project's variables have been synced to Parameter Store. If this is true,
	// then the project variables can all be found in Parameter Store.
	ParameterStoreVarsSynced bool `` /* 134-byte string literal not displayed */
	// ParameterStoreGitHubAppSynced is a temporary flag that indicates whether
	// the project's GitHub app's private key have been synced to Parameter
	// Store. If this is true, then the project's GitHub app private key can be
	// found in Parameter Store.
	ParameterStoreGitHubAppSynced bool `` /* 152-byte string literal not displayed */
	// LastAutoRestartedTaskAt is the last timestamp that a task in this project was restarted automatically.
	LastAutoRestartedTaskAt time.Time `bson:"last_auto_restarted_task_at"`
	// NumAutoRestartedTasks is the number of tasks this project has restarted automatically in the past 24-hour period.
	NumAutoRestartedTasks int `bson:"num_auto_restarted_tasks"`
}

ProjectRef contains Evergreen project-related settings which can be set independently of version control. Booleans that can be defined from both the repo and branch must be pointers, so that branch configurations can specify when to default to the repo.

func FindAllMergedEnabledTrackedProjectRefs

func FindAllMergedEnabledTrackedProjectRefs() ([]ProjectRef, error)

FindAllMergedEnabledTrackedProjectRefs returns all enabled project refs in the db that are currently being tracked (i.e. their project files still exist and the project is not hidden).

func FindAllMergedProjectRefs

func FindAllMergedProjectRefs() ([]ProjectRef, error)

FindAllMergedProjectRefs returns all project refs in the db, with repo ref information merged

func FindAllMergedTrackedProjectRefs

func FindAllMergedTrackedProjectRefs() ([]ProjectRef, error)

FindAllMergedTrackedProjectRefs returns all project refs in the db that are currently being tracked (i.e. their project files still exist and the project is not hidden). Can't hide a repo without hiding the branches, so don't need to aggregate here.

func FindAnyRestrictedProjectRef

func FindAnyRestrictedProjectRef() (*ProjectRef, error)

FindAnyRestrictedProjectRef returns an unrestricted project to use as a default for contexts. TODO: Investigate removing this in DEVPROD-10469.

func FindBranchProjectRef

func FindBranchProjectRef(identifier string) (*ProjectRef, error)

FindBranchProjectRef gets a project ref given the project identifier. This returns only branch-level settings; to include repo settings, use FindMergedProjectRef.

func FindDownstreamProjects

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

FindDownstreamProjects finds projects that have that trigger enabled or inherits it from the repo project.

func FindHiddenProjectRefByOwnerRepoAndBranch

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

func FindMergedEnabledProjectRefsByIds

func FindMergedEnabledProjectRefsByIds(ids ...string) ([]ProjectRef, error)

FindMergedEnabledProjectRefsByIds returns all project refs for the provided ids that are currently enabled.

func FindMergedEnabledProjectRefsByOwnerAndRepo

func FindMergedEnabledProjectRefsByOwnerAndRepo(owner, repo string) ([]ProjectRef, error)

func FindMergedEnabledProjectRefsByRepoAndBranch

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

FindMergedEnabledProjectRefsByRepoAndBranch finds ProjectRefs with matching repo/branch that are enabled, and merges repo information.

func FindMergedProjectRef

func FindMergedProjectRef(identifier string, version string, includeProjectConfig bool) (*ProjectRef, error)

FindMergedProjectRef also finds the repo ref settings and merges relevant fields. Relevant fields will also be merged from the parser project with a specified version. If no version is specified, the most recent valid parser project version will be used for merge.

func FindMergedProjectRefsByIds

func FindMergedProjectRefsByIds(ids ...string) ([]ProjectRef, error)

func FindMergedProjectRefsForRepo

func FindMergedProjectRefsForRepo(repoRef *RepoRef) ([]ProjectRef, error)

FindMergedProjectRefsForRepo considers either owner/repo and repo ref ID, in case the owner/repo of the repo ref is going to change. So we get all the branch projects in the new repo, and all the branch projects that might change owner/repo.

func FindMergedProjectRefsThatUseRepoSettingsByRepoAndBranch

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

FindMergedProjectRefsThatUseRepoSettingsByRepoAndBranch finds ProjectRef with matching repo/branch that rely on the repo configuration, and merges that info.

func FindNonHiddenProjects

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

FindNonHiddenProjects returns limit visible project refs starting at project id key in the sortDir direction.

func FindOneProjectRefByRepoAndBranchWithPRTesting

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

FindOneProjectRefByRepoAndBranchWithPRTesting finds a single ProjectRef with matching repo/branch that is enabled and setup for PR testing.

func FindOneProjectRefWithCommitQueueByOwnerRepoAndBranch

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

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

FindPeriodicProjects returns a list of merged projects that have periodic builds defined.

func FindProjectRefsByIds

func FindProjectRefsByIds(ids ...string) ([]ProjectRef, error)

func FindProjectRefsToSync

func FindProjectRefsToSync(ctx context.Context) ([]ProjectRef, error)

FindProjectRefsToSync finds all project refs that have Parameter Sore enabled but don't have their project variables synced to Parameter Store yet. TODO (DEVPROD-11882): remove this function once the rollout is stable.

func GetProjectRefForTask

func GetProjectRefForTask(taskId string) (*ProjectRef, error)

func GetProjectRefMergedWithRepo

func GetProjectRefMergedWithRepo(pRef ProjectRef) (*ProjectRef, error)

GetProjectRefMergedWithRepo merges the project with the repo, if one exists. Otherwise, it will return the project as given.

func (*ProjectRef) Add

func (p *ProjectRef) Add(creator *user.DBUser) error

func (*ProjectRef) AddToRepoScope

func (p *ProjectRef) AddToRepoScope(u *user.DBUser) error

AddToRepoScope validates that the branch can be attached to the matching repo, adds the branch to the unrestricted branches under repo scope, and adds repo view permission for branch admins, and adds branch edit access for repo admins.

func (*ProjectRef) AliasesNeeded

func (p *ProjectRef) AliasesNeeded() bool

func (*ProjectRef) AttachToNewRepo

func (p *ProjectRef) AttachToNewRepo(u *user.DBUser) error

AttachToNewRepo modifies the project's owner/repo, updates the old and new repo scopes (if relevant), and updates the project to point to the new repo. Any Github project conflicts are disabled. If no repo ref currently exists for the new repo, the user attaching it will be added as the repo ref admin.

func (*ProjectRef) AttachToRepo

func (p *ProjectRef) AttachToRepo(ctx context.Context, u *user.DBUser) error

AttachToRepo adds the branch to the relevant repo scopes, and updates the project to point to the repo. Any values that previously were unset will now use the repo value, unless this would introduce a GitHub project conflict. If no repo ref currently exists, the user attaching it will be added as the repo ref admin.

func (*ProjectRef) AuthorizedForGitTag

func (p *ProjectRef) AuthorizedForGitTag(ctx context.Context, githubUser, owner, repo string) bool

func (*ProjectRef) CanEnableCommitQueue

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

func (*ProjectRef) CheckAndUpdateAutoRestartLimit

func (p *ProjectRef) CheckAndUpdateAutoRestartLimit(maxDailyAutoRestarts int) error

CheckAndUpdateAutoRestartLimit checks if auto restarting a task for a project is allowed given the global per-project daily auto restarting limit, and updates relevant timestamp and counter used to track the project's usage.

func (*ProjectRef) CommitQueueIsOn

func (p *ProjectRef) CommitQueueIsOn() error

func (*ProjectRef) DetachFromRepo

func (p *ProjectRef) DetachFromRepo(u *user.DBUser) error

DetachFromRepo removes the branch from the relevant repo scopes, and updates the project to not point to the repo. Any values that previously defaulted to repo will have the repo value explicitly set.

func (*ProjectRef) DoesTrackPushEvents

func (p *ProjectRef) DoesTrackPushEvents() bool

func (*ProjectRef) GetActivationTimeForTask

func (p *ProjectRef) GetActivationTimeForTask(t *BuildVariantTaskUnit, versionCreateTime time.Time, now time.Time) (time.Time, error)

GetActivationTimeForTask returns the time at which this task should next be activated. The version create time is used to determine the next activation time, except in situations where using the version create time would produce conflicts such as duplicate cron runs.

func (*ProjectRef) GetActivationTimeForVariant

func (p *ProjectRef) GetActivationTimeForVariant(variant *BuildVariant, versionCreateTime time.Time, now time.Time) (time.Time, error)

GetActivationTimeForVariant returns the time at which this variant should next be activated. The version create time is used to determine the next activation time, except in situations where using the version create time would produce conflicts such as duplicate cron runs.

func (*ProjectRef) GetGitHubAppAuth

func (p *ProjectRef) GetGitHubAppAuth() (*githubapp.GithubAppAuth, error)

GetGitHubAppAuth returns the App auth for the given project. If the project defaults to the repo and the app is not defined on the project, it will return the app from the repo.

func (*ProjectRef) GetGitHubPermissionGroup

func (p *ProjectRef) GetGitHubPermissionGroup(requester string) (GitHubDynamicTokenPermissionGroup, bool)

GetGitHubPermissionGroup returns the GitHubDynamicTokenPermissionGroup for the given requester. If the requester is not found, it returns the default permission group and a false boolean to indicate not found.

func (*ProjectRef) GetGithubProjectConflicts

func (p *ProjectRef) GetGithubProjectConflicts() (GithubProjectConflicts, error)

GetGithubProjectConflicts returns any potential conflicts; i.e. regardless of whether or not p has something enabled, returns the project identifiers that it _would_ conflict with if it did.

func (*ProjectRef) GetPatchTriggerAlias

func (p *ProjectRef) GetPatchTriggerAlias(aliasName string) (patch.PatchTriggerDefinition, bool)

func (*ProjectRef) GetProjectSetupCommands

func (p *ProjectRef) GetProjectSetupCommands(opts apimodels.WorkstationSetupCommandOptions) ([]*jasper.Command, error)

GetProjectSetupCommands returns jasper commands for the project's configuration commands Stderr/Stdin are passed through to the commands as well as Stdout, when opts.Quiet is false The commands' working directories may not exist and need to be created before running the commands

func (*ProjectRef) Insert

func (projectRef *ProjectRef) Insert() error

func (*ProjectRef) IsAutoPRTestingEnabled

func (p *ProjectRef) IsAutoPRTestingEnabled() bool

func (*ProjectRef) IsDispatchingDisabled

func (p *ProjectRef) IsDispatchingDisabled() bool

func (*ProjectRef) IsGitTagVersionsEnabled

func (p *ProjectRef) IsGitTagVersionsEnabled() bool

func (*ProjectRef) IsGithubChecksEnabled

func (p *ProjectRef) IsGithubChecksEnabled() bool

func (*ProjectRef) IsHidden

func (p *ProjectRef) IsHidden() bool

func (*ProjectRef) IsManualPRTestingEnabled

func (p *ProjectRef) IsManualPRTestingEnabled() bool

func (*ProjectRef) IsPRTestingEnabled

func (p *ProjectRef) IsPRTestingEnabled() bool

func (*ProjectRef) IsPRTestingEnabledByCaller

func (p *ProjectRef) IsPRTestingEnabledByCaller(caller string) bool

func (*ProjectRef) IsPatchingDisabled

func (p *ProjectRef) IsPatchingDisabled() bool

func (*ProjectRef) IsPerfEnabled

func (p *ProjectRef) IsPerfEnabled() bool

func (*ProjectRef) IsRepotrackerDisabled

func (p *ProjectRef) IsRepotrackerDisabled() bool

func (*ProjectRef) IsRestricted

func (p *ProjectRef) IsRestricted() bool

func (*ProjectRef) IsStatsCacheDisabled

func (p *ProjectRef) IsStatsCacheDisabled() bool

func (*ProjectRef) IsStepbackBisect

func (p *ProjectRef) IsStepbackBisect() bool

func (*ProjectRef) IsStepbackDisabled

func (p *ProjectRef) IsStepbackDisabled() bool

func (*ProjectRef) IsVersionControlEnabled

func (p *ProjectRef) IsVersionControlEnabled() bool

func (*ProjectRef) MakeRestricted

func (p *ProjectRef) MakeRestricted() error

func (*ProjectRef) MakeUnrestricted

func (p *ProjectRef) MakeUnrestricted() error

func (*ProjectRef) MergeWithProjectConfig

func (p *ProjectRef) MergeWithProjectConfig(version string) (err error)

MergeWithProjectConfig looks up the project config with the given project ref id and modifies the project ref scanning for any properties that can be set on both project ref and project parser. Any values that are set at the project config level will be set on the project ref IF they are not set on the project ref. If the version isn't specified, we get the latest config.

func (*ProjectRef) RemoveFromRepoScope

func (p *ProjectRef) RemoveFromRepoScope() error

RemoveFromRepoScope removes the branch from the unrestricted branches under repo scope and removes branch edit access for repo admins.

func (*ProjectRef) SetContainerSecrets

func (p *ProjectRef) SetContainerSecrets(secrets []ContainerSecret) error

SetContainerSecrets updates the container secrets for the project ref.

func (*ProjectRef) SetGithubAppCredentials

func (p *ProjectRef) SetGithubAppCredentials(appID int64, privateKey []byte) error

SetGitHubAppCredentials updates or creates an entry in GithubAppAuth for the project ref. If the provided values are empty, the entry is deleted.

func (*ProjectRef) SetRepotrackerError

func (p *ProjectRef) SetRepotrackerError(d *RepositoryErrorDetails) error

SetRepotrackerError updates the repotracker error for the project ref.

func (*ProjectRef) ShouldDeactivatePrevious

func (p *ProjectRef) ShouldDeactivatePrevious() bool

func (*ProjectRef) ShouldNotifyOnBuildFailure

func (p *ProjectRef) ShouldNotifyOnBuildFailure() bool

func (*ProjectRef) UpdateAdminRoles

func (p *ProjectRef) UpdateAdminRoles(toAdd, toRemove []string) (bool, error)

UpdateAdminRoles returns true if any admins have been modified/removed, regardless of errors.

func (*ProjectRef) Upsert

func (p *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, a new one is created.

func (*ProjectRef) UseRepoSettings

func (p *ProjectRef) UseRepoSettings() bool

func (*ProjectRef) ValidateEnabledRepotracker

func (p *ProjectRef) ValidateEnabledRepotracker() error

ValidateEnabledRepotracker checks if the repotracker is being enabled, and if it is, checks to make sure it can be enabled.

func (*ProjectRef) ValidateGitHubPermissionGroups

func (p *ProjectRef) ValidateGitHubPermissionGroups() error

func (*ProjectRef) ValidateGitHubPermissionGroupsByRequester

func (p *ProjectRef) ValidateGitHubPermissionGroupsByRequester() error

func (*ProjectRef) ValidateIdentifier

func (p *ProjectRef) ValidateIdentifier() error

func (*ProjectRef) ValidateOwnerAndRepo

func (p *ProjectRef) ValidateOwnerAndRepo(validOrgs []string) error

ValidateProjectRefAndSetDefaults validates the project ref and sets default values. Should only be called on enabled project refs or repo refs.

type ProjectSettings

type ProjectSettings struct {
	ProjectRef         ProjectRef              `bson:"proj_ref" json:"proj_ref"`
	GitHubAppAuth      githubapp.GithubAppAuth `bson:"github_app_auth" json:"github_app_auth"`
	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"`
}

func GetProjectSettings

func GetProjectSettings(p *ProjectRef) (*ProjectSettings, error)

GetProjectSettings returns the ProjectSettings of the given identifier and ProjectRef

func GetProjectSettingsById

func GetProjectSettingsById(projectId string, isRepo bool) (*ProjectSettings, error)

type ProjectSettingsEvent

type ProjectSettingsEvent struct {
	ProjectSettings `bson:",inline"`

	// The following boolean fields are flags that indicate that a given
	// field is nil instead of [], since this information is lost when
	// casting the event to a generic interface.
	GitTagAuthorizedTeamsDefault bool `bson:"git_tag_authorized_teams_default,omitempty" json:"git_tag_authorized_teams_default,omitempty"`
	GitTagAuthorizedUsersDefault bool `bson:"git_tag_authorized_users_default,omitempty" json:"git_tag_authorized_users_default,omitempty"`
	PatchTriggerAliasesDefault   bool `bson:"patch_trigger_aliases_default,omitempty" json:"patch_trigger_aliases_default,omitempty"`
	PeriodicBuildsDefault        bool `bson:"periodic_builds_default,omitempty" json:"periodic_builds_default,omitempty"`
	TriggersDefault              bool `bson:"triggers_default,omitempty" json:"triggers_default,omitempty"`
	WorkstationCommandsDefault   bool `bson:"workstation_commands_default,omitempty" json:"workstation_commands_default,omitempty"`
}

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"`
	Commands        []PluginCommandConf  `yaml:"commands,omitempty" bson:"commands"`
	Tags            []string             `yaml:"tags,omitempty" bson:"tags"`
	RunOn           []string             `yaml:"run_on,omitempty" bson:"run_on"`
	// 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"`
	PatchOnly         *bool                     `yaml:"patch_only,omitempty" bson:"patch_only,omitempty"`
	Disable           *bool                     `yaml:"disable,omitempty" bson:"disable,omitempty"`
	AllowForGitTag    *bool                     `yaml:"allow_for_git_tag,omitempty" bson:"allow_for_git_tag,omitempty"`
	GitTagOnly        *bool                     `yaml:"git_tag_only,omitempty" bson:"git_tag_only,omitempty"`
	AllowedRequesters []evergreen.UserRequester `yaml:"allowed_requesters,omitempty" bson:"allowed_requesters,omitempty"`
	Stepback          *bool                     `yaml:"stepback,omitempty" bson:"stepback,omitempty"`
	MustHaveResults   *bool                     `yaml:"must_have_test_results,omitempty" bson:"must_have_test_results,omitempty"`
}

Unmarshalled from the "tasks" list in the project file

type ProjectTasksByName

type ProjectTasksByName []ProjectTask

ProjectTasksByName represents a slice of project config tasks that can be sorted by name.

func (ProjectTasksByName) Len

func (pt ProjectTasksByName) Len() int

func (ProjectTasksByName) Less

func (pt ProjectTasksByName) Less(i, j int) bool

func (ProjectTasksByName) Swap

func (pt ProjectTasksByName) Swap(i, j int)

type ProjectVars

type ProjectVars struct {

	// Id is the ID of the project.
	Id string `bson:"_id" json:"_id"`

	// Vars is the actual mapping of variable names to values for this project.
	// TODO (DEVPROD-9440): after all project vars are migrated to Parameter
	// Store, remove the BSON tags on this field to ensure project var values
	// are not put in the DB anymore.
	Vars map[string]string `bson:"vars" json:"vars"`

	// Parameters contains the mappings between user-defined project variable
	// names and the parameter name where the variable's value can be found in
	// Parameter Store.
	Parameters ParameterMappings `bson:"parameters,omitempty" json:"parameters,omitempty"`

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

	// AdminOnlyVars keeps track of variables that are only accessible by project admins.
	AdminOnlyVars map[string]bool `bson:"admin_only_vars" json:"admin_only_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 FindMergedProjectVars

func FindMergedProjectVars(projectID string) (*ProjectVars, error)

FindMergedProjectVars merges vars from the target project's ProjectVars and its parent repo's vars

func FindOneProjectVars

func FindOneProjectVars(projectId string) (*ProjectVars, error)

FindOneProjectVars finds the project variables document for a given project ID.

func (*ProjectVars) Clear

func (projectVars *ProjectVars) Clear() error

Clears clears all variables for a project.

func (*ProjectVars) FindAndModify

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

FindAndModify is almost the same functionally as Upsert, except that it only deletes project vars that are explicitly provided in varsToDelete. In other words, even if a project variable is omitted from projectVars, it won't be deleted unless that variable is explicitly listed in varsToDelete.

func (*ProjectVars) GetVars

func (projectVars *ProjectVars) GetVars(t *task.Task) map[string]string

func (*ProjectVars) Insert

func (projectVars *ProjectVars) Insert() error

Insert creates a new project vars document and stores all the project variables in the DB. If Parameter Store is enabled for the project, it also stores the variables in Parameter Store.

func (*ProjectVars) MergeWithRepoVars

func (projectVars *ProjectVars) MergeWithRepoVars(repoVars *ProjectVars)

MergeWithRepoVars merges the project and repo variables

func (*ProjectVars) RedactPrivateVars

func (projectVars *ProjectVars) RedactPrivateVars() *ProjectVars

RedactPrivateVars redacts private variable plaintext values and replaces them with the empty string.

func (*ProjectVars) SetParamMappings

func (projectVars *ProjectVars) SetParamMappings(pm ParameterMappings) error

SetParamMappings sets the parameter mappings for project variables. TODO (DEVPROD-11882): remove this function once the rollout is stable.

func (*ProjectVars) Upsert

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

Upsert creates or updates a project vars document and stores all the project variables in the DB. If Parameter Store is enabled for the project, it also stores the variables in Parameter Store.

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 (pl *PushLog) Insert() error

func (*PushLog) UpdateStatus

func (pl *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 RepoRef

type RepoRef struct {
	ProjectRef `yaml:",inline" bson:",inline"`
}

RepoRef is a wrapper for ProjectRef, as many settings in the project ref can be defined at both the branch and repo level.

func FindOneRepoRef

func FindOneRepoRef(identifier string) (*RepoRef, error)

FindOneRepoRef gets a project ref given the owner name, the repo name and the project name

func FindRepoRefByOwnerAndRepo

func FindRepoRefByOwnerAndRepo(owner, repoName string) (*RepoRef, error)

FindRepoRefsByRepoAndBranch finds RepoRefs with matching repo/branch that are enabled and setup for PR testing

func FindRepoRefsToSync

func FindRepoRefsToSync(ctx context.Context) ([]RepoRef, error)

FindRepoRefsToSync finds all repo refs that have Parameter Sore enabled but don't have their project variables synced to Parameter Store yet. TODO (DEVPROD-11882): remove this function once the rollout is stable.

func (*RepoRef) Add

func (r *RepoRef) Add(creator *user.DBUser) error

func (*RepoRef) Insert

func (r *RepoRef) Insert() error

Insert is included here so ProjectRef.Insert() isn't mistakenly used.

func (*RepoRef) MakeRestricted

func (r *RepoRef) MakeRestricted(branchProjects []ProjectRef) error

func (*RepoRef) MakeUnrestricted

func (r *RepoRef) MakeUnrestricted(branchProjects []ProjectRef) error

func (*RepoRef) UpdateAdminRoles

func (r *RepoRef) UpdateAdminRoles(toAdd, toRemove []string) error

func (*RepoRef) Upsert

func (r *RepoRef) 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. Ensures that fields that aren't relevant to repos aren't set.

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 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(ctx context.Context, opts RestartOptions) (RestartResults, error)

RestartFailedTasks attempts to restart failed tasks that started or failed 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 set to 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
	AuthorID        string
	AuthorGithubUID int
	AuthorEmail     string
	RevisionMessage string
	Revision        string
	CreateTime      time.Time
}

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 Suggester

type Suggester interface {
	Suggest(context.Context, *task.Task) ([]thirdparty.JiraTicket, error)
	GetTimeout() time.Duration
}

type TVPair

type TVPair struct {
	Variant  string `json:"variant"`
	TaskName string `json:"task_name"`
}

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

func IncludeDependencies

func IncludeDependencies(project *Project, tvpairs []TVPair, requester string, activationInfo *specificActivationInfo) ([]TVPair, error)

IncludeDependencies 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. This function can return an error, but it should be treated as an informational warning.

func IncludeDependenciesWithGenerated

func IncludeDependenciesWithGenerated(project *Project, tvpairs []TVPair, requester string, activationInfo *specificActivationInfo, generatedVariants []parserBV) ([]TVPair, error)

IncludeDependenciesWithGenerated performs the same function as IncludeDependencies for generated projects. activationInfo and generatedVariants are required in the case for generate tasks to detect if new generated dependency's task/variant pairs are depended on by inactive tasks. If so, we also set these new dependencies to inactive.

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 TaskCreationInfo

type TaskCreationInfo struct {
	Version             *Version
	Project             *Project
	ProjectRef          *ProjectRef
	BuildVariant        *BuildVariant           // If creating tasks in a specific BV, the BV definition
	Build               *build.Build            // If creating tasks in an existing build, the build itself
	Pairs               TaskVariantPairs        // New variant-tasks to be created
	BuildVariantName    string                  // If creating tasks in a specific BV, the name of the BV
	TaskIDs             TaskIdConfig            // Pre-generated IDs for the tasks to be created
	ActivateBuild       bool                    // True if the build should be scheduled
	ActivationInfo      specificActivationInfo  // Indicates if the task has a specific activation or is a stepback task
	TasksInBuild        []task.Task             // The set of task names that already exist for the given build, including display tasks
	TaskNames           []string                // Names of tasks to create (used in patches). Will create all if empty
	DisplayNames        []string                // Names of display tasks to create (used in patches). Will create all if empty
	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
	DistroAliases       distro.AliasLookupTable // Map of distro aliases to names of distros
	TaskCreateTime      time.Time               // Create time of tasks in the build
	GithubChecksAliases ProjectAliases          // Project aliases to use to filter tasks to count towards the github checks, if any
	SyncAtEndOpts       patch.SyncAtEndOptions  // Describes how tasks should sync upon the end of a task
	// ActivatedTasksAreEssentialToSucceed indicates whether or not all tasks
	// that are being created and activated immediately are required to finish
	// in order for the build/version to be finished. Tasks with specific
	// activation conditions (e.g. cron, activate) are not considered essential.
	ActivatedTasksAreEssentialToSucceed bool
}

TaskCreationInfo contains the needed parameters to construct new builds and tasks for a given version.

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"`
	SetupGroup               *YAMLCommandSet `yaml:"setup_group" bson:"setup_group"`
	SetupGroupCanFailTask    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"`
	TeardownGroup            *YAMLCommandSet `yaml:"teardown_group" bson:"teardown_group"`
	TeardownGroupTimeoutSecs int             `yaml:"teardown_group_timeout_secs" bson:"teardown_group_timeout_secs"`
	SetupTask                *YAMLCommandSet `yaml:"setup_task" bson:"setup_task"`
	SetupTaskCanFailTask     bool            `yaml:"setup_task_can_fail_task,omitempty" bson:"setup_task_can_fail_task,omitempty"`
	SetupTaskTimeoutSecs     int             `yaml:"setup_task_timeout_secs,omitempty" bson:"setup_task_timeout_secs,omitempty"`
	TeardownTask             *YAMLCommandSet `yaml:"teardown_task" bson:"teardown_task"`
	TeardownTaskCanFailTask  bool            `yaml:"teardown_task_can_fail_task" bson:"teardown_task_can_fail_task"`
	TeardownTaskTimeoutSecs  int             `yaml:"teardown_task_timeout_secs,omitempty" bson:"teardown_task_timeout_secs,omitempty"`
	Timeout                  *YAMLCommandSet `yaml:"timeout,omitempty" bson:"timeout"`
	CallbackTimeoutSecs      int             `yaml:"callback_timeout_secs,omitempty" bson:"callback_timeout_secs,omitempty"`
	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 (*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"`
	CountFree                  int           `bson:"count_free" json:"count_free"`
	CountRequired              int           `bson:"count_required" json:"count_required"`
	MaxHosts                   int           `bson:"max_hosts" json:"max_hosts"`
	ExpectedDuration           time.Duration `bson:"expected_duration" json:"expected_duration"`
	CountDurationOverThreshold int           `bson:"count_over_threshold" json:"count_over_threshold"`
	CountWaitOverThreshold     int           `bson:"count_wait_over_threshold" json:"count_wait_over_threshold"`
	DurationOverThreshold      time.Duration `bson:"duration_over_threshold" json:"duration_over_threshold"`
}

type TaskGroupsByName

type TaskGroupsByName []TaskGroup

TaskGroupsByName represents a slice of project config task grups that can be sorted by name.

func (TaskGroupsByName) Len

func (tg TaskGroupsByName) Len() int

func (TaskGroupsByName) Less

func (tg TaskGroupsByName) Less(i, j int) bool

func (TaskGroupsByName) Swap

func (tg TaskGroupsByName) Swap(i, j int)

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][]string
	Exhausted   ExhaustedIterator
}

type TaskHistoryIterator

type TaskHistoryIterator interface {
	GetChunk(version *Version, numBefore, numAfter int, include bool) (TaskHistoryChunk, error)
}

func NewTaskHistoryIterator

func NewTaskHistoryIterator(name string, buildVariants []string, projectName string) TaskHistoryIterator

type TaskIdConfig

type TaskIdConfig struct {
	ExecutionTasks TaskIdTable
	DisplayTasks   TaskIdTable
}

TaskIdConfig stores TaskIdTables split by execution and display tasks.

func NewTaskIdConfig

func NewTaskIdConfig(proj *Project, v *Version, tasks TaskVariantPairs, projectIdentifier string) (TaskIdConfig, error)

NewTaskIdConfig constructs a new set of TaskIdTables (map of [variant, task display name]->[task id]) split by display and execution tasks.

func NewTaskIdConfigForRepotrackerVersion

func NewTaskIdConfigForRepotrackerVersion(p *Project, v *Version, pairsToCreate TVPairSet, sourceRev, defID string) TaskIdConfig

NewTaskIdConfigForRepotrackerVersion creates a special TaskIdTable for a repotracker version. If pairsToCreate is not empty, that means only some of the tasks will be created for this version so only create task IDs for those tasks that actually will be created; otherwise, it will create task IDs for all possible tasks in the version.

func (TaskIdConfig) Length

func (t TaskIdConfig) Length() int

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

GetIdsForAllTasks returns every id in the table

func (TaskIdTable) GetIdsForAllTasksInVariant

func (tt TaskIdTable) GetIdsForAllTasksInVariant(variantName string) []string

GetIdsForAllTasksInVariant returns all task Ids for all tasks on a variant

func (TaskIdTable) GetIdsForTaskInAllVariants

func (tt TaskIdTable) GetIdsForTaskInAllVariants(taskName string) []string

GetIdsForTaskInAllVariants returns all task Ids for taskName on all variants

type TaskQueue

type TaskQueue struct {
	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"`
}

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

func FindAllTaskQueues

func FindAllTaskQueues() ([]TaskQueue, error)

func FindDistroSecondaryTaskQueue

func FindDistroSecondaryTaskQueue(distroID string) (TaskQueue, error)

func FindDistroTaskQueue

func FindDistroTaskQueue(distroID string) (TaskQueue, error)

func LoadDistroSecondaryTaskQueue

func LoadDistroSecondaryTaskQueue(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 (tq *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) Length

func (tq *TaskQueue) Length() int

func (*TaskQueue) Save

func (tq *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"`
	PriorityRankValue   int64         `bson:"priority_rank_value" json:"priority_rank_value"`
	Dependencies        []string      `bson:"dependencies" json:"dependencies"`
	DependenciesMet     bool          `bson:"dependencies_met" json:"dependencies_met"`
	ActivatedBy         string        `bson:"activated_by" json:"activated_by"`
}

type TaskQueueItemDispatcher

type TaskQueueItemDispatcher interface {
	RefreshFindNextTask(context.Context, string, TaskSpec, time.Time) (*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.

type TaskSyncOptions

type TaskSyncOptions struct {
	ConfigEnabled *bool `bson:"config_enabled" json:"config_enabled" yaml:"config_enabled"`
	PatchEnabled  *bool `bson:"patch_enabled" json:"patch_enabled" yaml:"patch_enabled"`
}

TaskSyncOptions contains information about which features are allowed for syncing task directories to S3.

func (*TaskSyncOptions) IsConfigEnabled

func (ts *TaskSyncOptions) IsConfigEnabled() bool

func (*TaskSyncOptions) IsPatchEnabled

func (ts *TaskSyncOptions) IsPatchEnabled() bool

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"`
	OmitGeneratedTasks bool   `yaml:"omit_generated_tasks,omitempty" bson:"omit_generated_tasks,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 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 returns all the variant groups as a set of patch.VariantTasks.

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.

func StatusDiffTests

func StatusDiffTests(original, patch []testresult.TestResult) []TestStatusDiff

StatusDiffTests takes two sets of tests and returns a diff of their results for easy comparison and analysis.

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"`
	Alias                        string `bson:"alias,omitempty" json:"alias,omitempty"`
	UnscheduleDownstreamVersions bool   `bson:"unschedule_downstream_versions,omitempty" json:"unschedule_downstream_versions,omitempty"`
}

func (*TriggerDefinition) Validate

func (t *TriggerDefinition) Validate(downstreamProject string) error

type VariantsAndTasksFromProject

type VariantsAndTasksFromProject struct {
	Variants map[string]BuildVariant
	Tasks    []struct{ Name string }
	Project  Project
}

func GetVariantsAndTasksFromPatchProject

func GetVariantsAndTasksFromPatchProject(ctx context.Context, settings *evergreen.Settings, p *patch.Patch) (*VariantsAndTasksFromProject, error)

GetVariantsAndTasksFromPatchProject formats variants and tasks as used by the UI pages.

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"`
	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"`
	BuildVariants       []VersionBuildStatus `bson:"build_variants_status,omitempty" json:"build_variants_status,omitempty"`
	PeriodicBuildID     string               `bson:"periodic_build_id,omitempty" json:"periodic_build_id,omitempty"`
	Aborted             bool                 `bson:"aborted,omitempty" json:"aborted,omitempty"`

	// This stores whether or not a version has tasks which were activated.
	// We use a bool ptr in order to to distinguish the unset value from the default value
	Activated *bool `bson:"activated,omitempty" json:"activated,omitempty"`

	// GitTags stores tags that were pushed to this version, while TriggeredByGitTag is for versions created by tags
	GitTags           []GitTag `bson:"git_tags,omitempty" json:"git_tags,omitempty"`
	TriggeredByGitTag GitTag   `bson:"triggered_by_git_tag,omitempty" json:"triggered_by_git_tag,omitempty"`

	// Parameters stores user-defined parameters
	Parameters []patch.Parameter `bson:"parameters,omitempty" json:"parameters,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"`

	// child patches will store the id of the parent patch
	ParentPatchID     string `bson:"parent_patch_id" json:"parent_patch_id,omitempty"`
	ParentPatchNumber int    `bson:"parent_patch_number" json:"parent_patch_number,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 is the ID of the entity that triggered the downstream version. Depending on the trigger type, this
	// could be a build ID, a task ID, or a project ID, for build, task, and push triggers respectively.
	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"`
	// TriggerSHA is the SHA of the untracked commit that triggered the downstream version,
	// this field is only populated for push level triggers.
	TriggerSHA string `bson:"trigger_sha,omitempty" json:"trigger_sha,omitempty"`

	// this is only used for aggregations, and is not stored in the DB
	Builds []build.Build `bson:"build_variants,omitempty" json:"build_variants,omitempty"`

	// ProjectStorageMethod describes how the parser project for this version is
	// stored. If this is empty, the default storage method is StorageMethodDB.
	ProjectStorageMethod evergreen.ParserProjectStorageMethod `bson:"storage_method" json:"storage_method,omitempty"`
	// PreGenerationProjectStorageMethod describes how the cached parser project from before it was modified
	// by generate.tasks for this version is stored. If this is empty, the default storage method is StorageMethodDB.
	PreGenerationProjectStorageMethod evergreen.ParserProjectStorageMethod `bson:"pre_generation_storage_method" json:"pre_generation_storage_method,omitempty"`
}

func FetchVersionsBuildsAndTasks

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

FetchVersionsBuildsAndTasks is a helper function to fetch a group of versions and their associated builds and tasks. Returns the versions themselves, a map of version id -> the builds that are a part of the version (unsorted) and a map of build ID -> each build's tasks

func FinalizePatch

func FinalizePatch(ctx context.Context, p *patch.Patch, requester string) (*Version, error)

FinalizePatch 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 Creates a manifest based on the Version

func FindBaseVersionForVersion

func FindBaseVersionForVersion(versionID string) (*Version, error)

FindBaseVersionForVersion finds the base version for a given version ID. If the version is a patch, it will return the base version. If the version is a mainline commit, it will return the previously run mainline commit.

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 FindVersionByLastKnownGoodConfig

func FindVersionByLastKnownGoodConfig(projectId string, revisionOrderNumber int) (*Version, error)

FindVersionByLastKnownGoodConfig filters on versions with valid (i.e., have no errors) config for the given project.

func GetActiveWaterfallVersions

func GetActiveWaterfallVersions(ctx context.Context, projectId string, opts WaterfallOptions) ([]Version, error)

GetActiveWaterfallVersions returns at most `opts.limit` activated versions for a given project.

func GetAllWaterfallVersions

func GetAllWaterfallVersions(ctx context.Context, projectId string, minOrder int, maxOrder int) ([]Version, error)

GetAllWaterfallVersions returns all of a project's versions within an inclusive range of orders.

func GetMainlineCommitVersionsWithOptions

func GetMainlineCommitVersionsWithOptions(ctx context.Context, projectId string, opts MainlineCommitVersionOptions) ([]Version, error)

func GetMostRecentWaterfallVersion

func GetMostRecentWaterfallVersion(ctx context.Context, projectId string) (*Version, error)

GetMostRecentWaterfallVersion returns the most recent version, activated or unactivated, on the waterfall.

func GetNextRecentActiveWaterfallVersion

func GetNextRecentActiveWaterfallVersion(ctx context.Context, projectId string, minOrder int) (*Version, error)

GetNextRecentActiveWaterfallVersion returns the next recent active version on the waterfall, i.e. a newer activated version than the version with the given minOrder.

func GetVersionForCommitQueueItem

func GetVersionForCommitQueueItem(cq *commitqueue.CommitQueue, issue string) (*Version, error)

func GetVersionsToModify

func GetVersionsToModify(projectName string, opts ModifyVersionsOptions, startTime, endTime time.Time) ([]Version, error)

GetVersionsToModify returns a slice of versions intended to be modified that satisfy the given ModifyVersionsOptions.

func GetVersionsWithOptions

func GetVersionsWithOptions(projectName string, opts GetVersionsOptions) ([]Version, error)

GetVersionsWithOptions returns versions for a project, that satisfy a set of query parameters defined by the input GetVersionsOptions.

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

func (v *Version) ActivateAndSetBuildVariants() error

ActivateAndSetBuildVariants activates the version and sets its build variants.

func (*Version) AddSatisfiedTrigger

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

func (*Version) GetParentVersion

func (v *Version) GetParentVersion() (*Version, 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 (v *Version) Insert() error

func (*Version) IsChild

func (v *Version) IsChild() bool

func (*Version) IsFinished

func (v *Version) IsFinished() bool

IsFinished returns whether or not the version has finished based on its status.

func (*Version) LastSuccessful

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

func (*Version) MarkFinished

func (v *Version) MarkFinished(status string, finishTime time.Time) error

func (*Version) MarshalBSON

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

func (*Version) SetAborted

func (v *Version) SetAborted(aborted bool) error

SetAborted sets the version as aborted.

func (*Version) SetActivated

func (v *Version) SetActivated(activated bool) error

SetActivated sets version activated field to specified boolean.

func (*Version) UnmarshalBSON

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

func (*Version) UpdatePreGenerationProjectStorageMethod

func (v *Version) UpdatePreGenerationProjectStorageMethod(method evergreen.ParserProjectStorageMethod) error

UpdatePreGenerationProjectStorageMethod updates the version's pre-generation parser project storage method.

func (*Version) UpdateProjectStorageMethod

func (v *Version) UpdateProjectStorageMethod(method evergreen.ParserProjectStorageMethod) error

UpdateProjectStorageMethod updates the version's parser project storage method.

func (*Version) UpdateStatus

func (v *Version) UpdateStatus(newStatus string) error

type VersionBuildStatus

type VersionBuildStatus struct {
	BuildVariant     string                `bson:"build_variant" json:"id"`
	BuildId          string                `bson:"build_id,omitempty" json:"build_id,omitempty"`
	BatchTimeTasks   []BatchTimeTaskStatus `bson:"batchtime_tasks,omitempty" json:"batchtime_tasks,omitempty"`
	ActivationStatus `bson:",inline"`
}

VersionBuildStatus stores metadata relating to each build

type VersionMetadata

type VersionMetadata struct {
	Revision            Revision
	TriggerID           string
	TriggerType         string
	EventID             string
	TriggerDefinitionID string
	SourceVersion       *Version
	SourceCommit        string
	IsAdHoc             bool
	Activate            bool
	User                *user.DBUser
	Message             string
	Alias               string
	PeriodicBuildID     string
	RemotePath          string
	GitTag              GitTag
}

VersionMetadata is used to pass information about version creation

type VersionModification

type VersionModification struct {
	Action            evergreen.ModificationAction `json:"action"`
	Active            bool                         `json:"active"`
	Abort             bool                         `json:"abort"`
	Priority          int64                        `json:"priority"`
	VersionsToRestart []*VersionToRestart          `json:"versions_to_restart"`
}

type VersionToRestart

type VersionToRestart struct {
	VersionId *string  `json:"version_id"`
	TaskIds   []string `json:"task_ids"`
}

type VersionsByCreateTime

type VersionsByCreateTime []Version

func (VersionsByCreateTime) Len

func (v VersionsByCreateTime) Len() int

func (VersionsByCreateTime) Less

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

func (VersionsByCreateTime) Swap

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

type WaterfallBuild

type WaterfallBuild struct {
	Id          string          `bson:"_id" json:"_id"`
	Activated   bool            `bson:"activated" json:"activated"`
	DisplayName string          `bson:"display_name" json:"display_name"`
	Version     string          `bson:"version" json:"version"`
	Tasks       []WaterfallTask `bson:"tasks" json:"tasks"`
}

type WaterfallBuildVariant

type WaterfallBuildVariant struct {
	Id          string           `bson:"_id" json:"_id"`
	DisplayName string           `bson:"display_name" json:"display_name"`
	Builds      []WaterfallBuild `bson:"builds" json:"builds"`
	Version     string           `bson:"version" json:"version"`
}

func GetWaterfallBuildVariants

func GetWaterfallBuildVariants(ctx context.Context, versionIds []string) ([]WaterfallBuildVariant, error)

GetWaterfallBuildVariants returns all build variants associated with the specified versions. Each build variant contains an array of builds sorted by revision and their tasks.

type WaterfallOptions

type WaterfallOptions struct {
	Limit      int      `bson:"-" json:"-"`
	MaxOrder   int      `bson:"-" json:"-"`
	MinOrder   int      `bson:"-" json:"-"`
	Requesters []string `bson:"-" json:"-"`
}

type WaterfallTask

type WaterfallTask struct {
	Id            string `bson:"_id" json:"_id"`
	DisplayName   string `bson:"display_name" json:"display_name"`
	DisplayStatus string `bson:"display_status" json:"display_status"`
	Execution     int    `bson:"execution" json:"execution"`
	Status        string `bson:"status" json:"status"`
}

type WorkstationConfig

type WorkstationConfig struct {
	SetupCommands []WorkstationSetupCommand `bson:"setup_commands" json:"setup_commands" yaml:"setup_commands"`
	GitClone      *bool                     `bson:"git_clone" json:"git_clone" yaml:"git_clone"`
}

func (*WorkstationConfig) ShouldGitClone

func (c *WorkstationConfig) ShouldGitClone() bool

type WorkstationSetupCommand

type WorkstationSetupCommand struct {
	Command   string `bson:"command" json:"command" yaml:"command"`
	Directory string `bson:"directory" json:"directory" yaml:"directory"`
}

type YAMLCommandSet

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

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 alertrecord contains complex alert types, like the first failure in a version.
Package alertrecord contains complex alert types, like the first failure in a version.
Package annotations defines a data model for a feature that allows users to add metadata to tasks.
Package annotations defines a data model for a feature that allows users to add metadata to tasks.
Package artifact models links to files created during task execution.
Package artifact models links to files created during task execution.
Package build models a build, a set of tasks that run on a variant.
Package build models a build, a set of tasks that run on a variant.
Package commitqueue models the commit queue, which merges code automatically after testing.
Package commitqueue models the commit queue, which merges code automatically after testing.
Package distro models an environment configuration for a host.
Package distro models an environment configuration for a host.
Package event models events in the system, which trigger actions to occur.
Package event models events in the system, which trigger actions to occur.
Package githubapp contains the data model for GitHub app installation information and GitHub app credentials.
Package githubapp contains the data model for GitHub app installation information and GitHub app credentials.
Package host models a single host managed by Evergreen's application server.
Package host models a single host managed by Evergreen's application server.
Log Chunk
Log Chunk
Package manifest records the git hashes of modules for versions.
Package manifest records the git hashes of modules for versions.
Package notification models notifications sent to users.
Package notification models notifications sent to users.
Package patch models an intent to patch test code in a particular state.
Package patch models an intent to patch test code in a particular state.
pod
Package pod models a single pod (a group of containers), which can run container tasks.
Package pod models a single pod (a group of containers), which can run container tasks.
definition
Package definition contains the data model for the pod definition cache.
Package definition contains the data model for the pod definition cache.
dispatcher
Package dispatcher models a queue of tasks that are dispatched to a group of pods.
Package dispatcher models a queue of tasks that are dispatched to a group of pods.
Package reliability models task reliability statistics.
Package reliability models task reliability statistics.
Package task models the task, the simplest unit of execution for Evergreen.
Package task models the task, the simplest unit of execution for Evergreen.
Package taskstats provides functions to generate and query pre-computed and task statistics.
Package taskstats provides functions to generate and query pre-computed and task statistics.
Package testresult models test results, which are posted by tasks during execution.
Package testresult models test results, which are posted by tasks during execution.
Package user represents users of Evergreen.
Package user represents users of Evergreen.

Jump to

Keyboard shortcuts

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