data

package
v0.0.0-...-7dc4ea3 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: 58 Imported by: 11

Documentation

Overview

Package data provides database access for API requests to the server.

Adding to the Connector

The Connector is an interface to define how to access methods that access the database and also have special mocking needs for testing (e.g. access to an external service). Methods that have no needs other than access to the database do not need to be put in the Connector interface.

To add to the Connector, add the method signature into the Connector interface. rest/data/interface.go. Next, add the implementation that interacts with the database to the database backed Connector implementation. Finally, add a mock implementation to the mock Connector implementation.

Implementing database backed methods requires using methods in Evergreen's model package. As much database specific information as possible should be kept out of these methods. For example, if a new aggregation pipeline is needed to complete the request, it should be defined in the Evergreen model package or relevant subpackage.

Index

Constants

View Source
const EventLogLimit = 10

Variables

This section is empty.

Functions

func AbortPatch

func AbortPatch(ctx context.Context, patchId string, user string) error

AbortPatch uses the service level CancelPatch method to abort a single patch with matching Id.

func AbortPatchesFromPullRequest

func AbortPatchesFromPullRequest(ctx context.Context, event *github.PullRequestEvent) error

AbortPatchesFromPullRequest aborts patches with the same PR Number, in the same repository, at the pull request's close time. This returns whether or not one of the GitHub patches is a commit queue item and is currently merging the PR.

func AddGithubMergeIntent

func AddGithubMergeIntent(intent patch.Intent, queue amboy.Queue) error

func AddOrUpdateServiceUser

func AddOrUpdateServiceUser(toUpdate restModel.APIDBUser) error

func AddPRPatchIntent

func AddPRPatchIntent(intent patch.Intent, queue amboy.Queue) error

AddPRPatchIntent inserts the intent and adds it to the queue if PR testing is enabled for the branch.

func BbFileTicket

func BbFileTicket(ctx context.Context, taskId string, execution int) (int, error)

BbFileTicket creates a JIRA ticket for a task with the given test failures.

func BuildProjectParameterMapForGraphQL

func BuildProjectParameterMapForGraphQL(args map[string]interface{}) (map[string]string, error)

BuildProjectParameterMapForGraphQL builds the parameters map that can be used as an input to GetProjectIdFromParams. It is used by the GraphQL @requireProjectAccess directive.

func BuildProjectParameterMapForLegacy

func BuildProjectParameterMapForLegacy(query url.Values, vars map[string]string) map[string]string

BuildProjectParameterMapForLegacy builds the parameters map that can be used as an input to GetProjectIdFromParams. It is used by the legacy middleware.

func CheckCanRemoveCommitQueueItem

func CheckCanRemoveCommitQueueItem(ctx context.Context, sc Connector, usr *user.DBUser, project *model.ProjectRef, itemId string) error

CheckCanRemoveCommitQueueItem checks if a patch can be removed from the commit queue by the given user.

func CheckPodSecret

func CheckPodSecret(id, secret string) error

CheckPodSecret checks for a pod with a matching ID and secret in the database. It returns an error if the secret does not match the one assigned to the pod.

func CheckTaskSecret

func CheckTaskSecret(taskID string, r *http.Request) (*task.Task, int, error)

func CompareTasks

func CompareTasks(ctx context.Context, taskIds []string, useLegacy bool) ([]string, map[string]map[string]string, error)

CompareTasks returns the order that the given tasks would be scheduled, along with the scheduling logic.

func ConcludeMerge

func ConcludeMerge(ctx context.Context, patchID, status string) error

func CopyDistro

func CopyDistro(ctx context.Context, u *user.DBUser, opts CopyDistroOpts) error

CopyDistro duplicates a given distro in the database given options specifying the existing and new distro ID. It returns an error if one is encountered.

func CopyProject

CopyProject copies the passed in project with the given project identifier, and returns the new project.

func CreateDistro

func CreateDistro(ctx context.Context, u *user.DBUser, newDistroId string) error

CreateDistro creates a new distro with the provided ID using the default settings specified here. It returns an error if one is encountered.

func CreateHostsFromTask

func CreateHostsFromTask(ctx context.Context, env evergreen.Environment, t *task.Task, user user.DBUser, keyNameOrVal string) error

CreateHostsFromTask creates intent hosts for those requested by the host.create command in a task.

func CreatePatchForMerge

func CreatePatchForMerge(ctx context.Context, settings *evergreen.Settings, existingPatchID, commitMessage string) (*restModel.APIPatch, error)

CreatePatchForMerge creates a merge patch from an existing patch and enqueues it in the commit queue.

func CreatePod

func CreatePod(apiPod model.APICreatePod) (*model.APICreatePodResponse, error)

CreatePod creates a new pod from the given REST model and returns its ID.

func CreateProject

func CreateProject(ctx context.Context, env evergreen.Environment, projectRef *model.ProjectRef, u *user.DBUser) (bool, error)

CreateProject creates a new project ref from the given one and performs other initial setup for new projects such as populating initial project variables and creating new webhooks. If the given project ref already has container secrets, the new project ref receives copies of the existing ones. Returns true if the project was successfully created.

func DeleteContainerSecrets

func DeleteContainerSecrets(ctx context.Context, v cocoa.Vault, pRef *model.ProjectRef, namesToDelete []string) ([]model.ContainerSecret, error)

DeleteContainerSecrets deletes existing container secrets in the project ref from the secrets storage service. This returns the remaining secrets after deletion.

func DeleteDistroById

func DeleteDistroById(ctx context.Context, u *user.DBUser, distroId string) error

DeleteDistroById removes a given distro from the database based on its id.

func DeleteSubscriptions

func DeleteSubscriptions(owner string, ids []string) error

func EnqueueItem

func EnqueueItem(projectID string, item restModel.APICommitQueueItem, enqueueNext bool) (int, error)

EnqueueItem will enqueue an item to a project's commit queue. If enqueueNext is true, move the commit queue item to be processed next.

func EnqueuePRToCommitQueue

func EnqueuePRToCommitQueue(ctx context.Context, env evergreen.Environment, sc Connector, info commitqueue.EnqueuePRInfo) (*restModel.APIPatch, error)

EnqueuePRToCommitQueue enqueues an item to the commit queue to test and merge a PR.

func FindAPIPodByID

func FindAPIPodByID(id string) (*model.APIPod, error)

FindAPIPodByID finds a pod by the given ID and returns its equivalent API model. It returns a nil result if no such pod is found.

func FindAndRemoveCommitQueueItem

func FindAndRemoveCommitQueueItem(ctx context.Context, cqId, issue, user, reason string) (*restModel.APICommitQueueItem, error)

FindAndRemoveCommitQueueItem 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 FindCommitQueueForProject

func FindCommitQueueForProject(name string) (*restModel.APICommitQueue, error)

func FindGeneratedTasksFromID

func FindGeneratedTasksFromID(generatorID string) ([]task.GeneratedTaskInfo, error)

FindGeneratedTasksFromID finds info about all tasks that were generated by the given generator task.

func FindHostByIdWithOwner

func FindHostByIdWithOwner(ctx context.Context, hostID string, user gimlet.User) (*host.Host, error)

FindHostByIdWithOwner finds a host with given host ID that was started by the given user. If the given user is a super-user, the host will also be returned regardless of who the host was started by

func FindHostsInRange

func FindHostsInRange(ctx context.Context, apiParams restmodel.APIHostParams, username string) ([]host.Host, error)

func FindMergedProjectAliases

func FindMergedProjectAliases(projectId, repoId string, aliasesToAdd []restModel.APIProjectAlias, includeProjectConfig bool) ([]restModel.APIProjectAlias, error)

FindMergedProjectAliases returns a merged list of aliases, with the order of precedence being: 1. aliases defined on the project page 2. aliases defined on the repo page 3. aliases defined in the project config YAML The includeProjectConfig flag determines whether to include aliases defined in the project config YAML. If the aliasesToAdd parameter is defined, we fold those aliases in and remove any that are marked as deleted.

func FindPatchById

func FindPatchById(patchId string) (*restModel.APIPatch, error)

FindPatchById queries the backing database for the patch matching patchId.

func FindPatchesByProject

func FindPatchesByProject(projectId string, ts time.Time, limit int) ([]restModel.APIPatch, error)

FindPatchesByProject uses the service layer's patches type to query the backing database for the patches.

func FindPatchesByUser

func FindPatchesByUser(user string, ts time.Time, limit int) ([]restModel.APIPatch, error)

FindPatchesByUser finds patches for the input user as ordered by creation time

func FindPodByID

func FindPodByID(podID string) (*pod.Pod, error)

FindPodByID finds the pod by the given ID.

func FindProjectById

func FindProjectById(id string, includeRepo bool, includeProjectConfig bool) (*model.ProjectRef, error)

FindProjectById queries the database for the project matching the projectRef.Id. If the bool flag is set, the project config properties in the project YAML will be merged into the result if the properties are not set on the project page.

func FindProjectVarsById

func FindProjectVarsById(id string, repoId string, redact bool) (*restModel.APIProjectVars, error)

FindProjectVarsById returns the variables associated with the project and repo (if given).

func FindRecentTaskList

func FindRecentTaskList(minutes int, key string) (*model.APIRecentTaskStatsList, error)

func FindRecentTaskListAgentVersion

func FindRecentTaskListAgentVersion(minutes int) (*model.APIRecentTaskStatsList, error)

func FindRecentTaskListDistro

func FindRecentTaskListDistro(minutes int) (*model.APIRecentTaskStatsList, error)

func FindRecentTaskListProject

func FindRecentTaskListProject(minutes int) (*model.APIRecentTaskStatsList, error)

func FindRecentTasks

func FindRecentTasks(minutes int) ([]task.Task, *task.ResultCounts, error)

FindRecentTasks finds tasks that have recently finished.

func FindTask

func FindTask(taskID string) (*task.Task, error)

func FindTasksByBuildId

func FindTasksByBuildId(buildId, taskId, status string, limit int, sortDir int) ([]task.Task, error)

FindTasksByBuildId uses the service layer's task type to query the backing database for a list of task that matches buildId. It accepts the startTaskId and a limit to allow for pagination of the queries. It returns results sorted by taskId.

func FindTasksByProjectAndCommit

func FindTasksByProjectAndCommit(opts task.GetTasksByProjectAndCommitOptions) ([]task.Task, error)

FindTasksByProjectAndCommit is a method to find a set of tasks which ran as part of certain version in a project. It takes the projectId, commit hash, and a taskId for paginating through the results.

func GenerateHostProvisioningScript

func GenerateHostProvisioningScript(ctx context.Context, env evergreen.Environment, hostID string) (string, error)

GenerateHostProvisioningScript generates and returns the script to provision the host given by host ID.

func GeneratePoll

func GeneratePoll(ctx context.Context, taskID string) (bool, string, error)

GeneratePoll checks to see if a `generate.tasks` job has finished.

func GenerateTasks

func GenerateTasks(ctx context.Context, settings *evergreen.Settings, taskID string, jsonFiles []json.RawMessage) error

GenerateTasks parses JSON files for `generate.tasks` and creates the new builds and tasks.

func GetAdditionalPatches

func GetAdditionalPatches(patchId string) ([]string, error)

func GetAdminEventLog

func GetAdminEventLog(before time.Time, n int) ([]restModel.APIAdminEvent, error)

func GetBanner

func GetBanner(ctx context.Context) (string, string, error)

func GetCLIUpdate

func GetCLIUpdate(ctx context.Context, env evergreen.Environment) (*model.APICLIUpdate, error)

GetCLIUpdate fetches the current cli version and the urls to download

func GetDockerLogs

func GetDockerLogs(ctx context.Context, containerId string, parent *host.Host,
	settings *evergreen.Settings, options types.ContainerLogsOptions) (io.Reader, error)

GetDockerLogs retrieves the logs for the given container.

func GetDockerStatus

func GetDockerStatus(ctx context.Context, containerId string, parent *host.Host, settings *evergreen.Settings) (*cloud.ContainerStatus, error)

GetDockerStatus returns the status of the given Docker container.

func GetEventsById

func GetEventsById(id string, before time.Time, n int) ([]restModel.APIProjectEvent, error)

func GetManifestByTask

func GetManifestByTask(taskId string) (*manifest.Manifest, error)

GetManifestByTask finds the version manifest corresponding to the given task.

func GetNotificationsStats

func GetNotificationsStats() (*restModel.APIEventStats, error)

func GetProjectAliasResults

func GetProjectAliasResults(p *model.Project, alias string, includeDeps bool) ([]restModel.APIVariantTasks, error)

func GetProjectEventLog

func GetProjectEventLog(project string, before time.Time, n int) ([]restModel.APIProjectEvent, error)

func GetProjectIdFromParams

func GetProjectIdFromParams(ctx context.Context, paramsMap map[string]string) (string, int, error)

GetProjectIdFromParams queries for a project and returns its projectId as a string. It performs different queries based on the keys that exist in the paramsMap input. If an error occurs, it will return an empty string, a status code, and the error itself.

func GetProjectTasksWithOptions

func GetProjectTasksWithOptions(ctx context.Context, projectName string, taskName string, opts model.GetProjectTasksOpts) ([]restModel.APITask, error)

GetProjectTasksWithOptions finds the previous tasks that have run on a project that adhere to the passed in options.

func GetProjectVersionsWithOptions

func GetProjectVersionsWithOptions(projectName string, opts model.GetVersionsOptions) ([]restModel.APIVersion, error)

GetProjectVersionsWithOptions returns the versions that fit the given constraint.

func GetRawPatches

func GetRawPatches(patchID string) (*restModel.APIRawPatch, error)

GetRawPatches fetches the raw patches for a patch.

func GetServiceUsers

func GetServiceUsers() ([]restModel.APIDBUser, error)

func GetSubscriptions

func GetSubscriptions(owner string, ownerType event.OwnerType) ([]restModel.APISubscription, error)

GetSubscriptions returns the subscriptions that belong to a user

func GetTaskReliabilityScores

func GetTaskReliabilityScores(filter reliability.TaskReliabilityFilter) ([]restModel.APITaskReliability, error)

GetTaskReliabilityScores queries the service backend to retrieve the task reliability scores that match the given filter.

func GetTaskStats

func GetTaskStats(filter taskstats.StatsFilter) ([]restModel.APITaskStats, error)

GetTaskStats queries the service backend to retrieve the task stats that match the given filter.

func GetVersionsAndVariants

func GetVersionsAndVariants(skip, numVersionElements int, project *model.Project) (*restModel.VersionVariantData, error)

GetVersionsAndVariants Fetch versions until 'numVersionElements' elements are created, including elements consisting of multiple versions rolled-up into one. The skip value indicates how many versions back in time should be skipped before starting to fetch versions, the project indicates which project the returned versions should be a part of.

func HideBranch

func HideBranch(projectID string) error

HideBranch is used to "delete" a project via the rest route or the UI. It overwrites the project with a skeleton project. It also clears project admin roles, project aliases, and project vars.

func ListHostsForTask

func ListHostsForTask(ctx context.Context, taskID string) ([]host.Host, error)

ListHostsForTask lists running hosts scoped to the task or the task's build.

func LogConfigChanges

func LogConfigChanges(newSettings *evergreen.Settings, oldSettings *evergreen.Settings, u *user.DBUser) error

func MakeHost

func MakeHost(ctx context.Context, env evergreen.Environment, taskID, userID, publicKey string, createHost apimodels.CreateHost, distro distro.Distro) (*host.Host, error)

MakeHost creates a host or container to run for host.create.

func MigrateVolume

func MigrateVolume(ctx context.Context, volumeID string, options *restModel.HostRequestOptions, user *user.DBUser,
	env evergreen.Environment) (bool, error)

func ModifySpawnHost

func ModifySpawnHost(ctx context.Context, env evergreen.Environment, h *host.Host, opts host.HostModifyOptions) (int, error)

StartSpawnHost enqueues a job to modify a spawn host.

func NewIntentHost

func NewIntentHost(ctx context.Context, options *restmodel.HostRequestOptions, user *user.DBUser,
	env evergreen.Environment) (*host.Host, error)

NewIntentHost is a method to insert an intent host given a distro and a public key The public key can be the name of a saved key or the actual key string

func PostHostIsUp

PostHostIsUp indicates to the app server that a host is up.

func PromoteVarsToRepo

func PromoteVarsToRepo(projectIdentifier string, varNames []string, userId string) error

PromoteVarsToRepo moves variables from an attached project to its repo. Promoted vars are removed from the project as part of this operation. Variables whose names already appear in the repo settings will be overwritten.

func RequestS3Creds

func RequestS3Creds(ctx context.Context, projectIdentifier, userEmail string) error

RequestS3Creds creates a JIRA ticket that requests S3 credentials to be added for the specified project. TODO DEVPROD-5553: Remove the function after project completion.

func RestartFailedCommitQueueVersions

func RestartFailedCommitQueueVersions(opts model.RestartOptions) (*restModel.RestartResponse, error)

RestartFailedCommitQueueVersions takes in a time range

func RestartFailedTasks

func RestartFailedTasks(ctx context.Context, queue amboy.Queue, opts model.RestartOptions) (*restModel.RestartResponse, error)

RestartFailedTasks attempts to restart failed tasks that started between 2 times

func SaveProjectSettingsForSection

func SaveProjectSettingsForSection(ctx context.Context, projectId string, changes *restModel.APIProjectSettings,
	section model.ProjectPageSection, isRepo bool, userId string) (*restModel.APIProjectSettings, error)

SaveProjectSettingsForSection saves the given UI page section and logs it for the given user. If isRepo is true, uses RepoRef related functions and collection instead of ProjectRef.

func SaveSubscriptions

func SaveSubscriptions(owner string, subscriptions []restModel.APISubscription, isProjectOwner bool) error

func SetBannerTheme

func SetBannerTheme(ctx context.Context, themeString string) error

SetBannerTheme sets the banner theme in the DB and event logs it

func SetEvergreenSettings

func SetEvergreenSettings(ctx context.Context, changes *restModel.APIAdminSettings,
	oldSettings *evergreen.Settings, u *user.DBUser, persist bool) (*evergreen.Settings, error)

SetEvergreenSettings sets the admin settings document in the DB and event logs it

func SetPatchActivated

func SetPatchActivated(ctx context.Context, patchId string, user string, activated bool, settings *evergreen.Settings) error

SetPatchActivated attempts to activate the patch and create a new version (if activated is set to true)

func StartSpawnHost

func StartSpawnHost(ctx context.Context, env evergreen.Environment, u *user.DBUser, h *host.Host) (int, error)

StartSpawnHost enqueues a job to start a stopped spawn host.

func StopSpawnHost

func StopSpawnHost(ctx context.Context, env evergreen.Environment, u *user.DBUser, h *host.Host, shouldKeepOff bool) (int, error)

StopSpawnHost enqueues a job to stop a running spawn host.

func SubmitFeedback

func SubmitFeedback(in restModel.APIFeedbackSubmission) error

func TerminateSpawnHost

func TerminateSpawnHost(ctx context.Context, env evergreen.Environment, u *user.DBUser, h *host.Host) (int, error)

TerminateSpawnHost enqueues a job to terminate a spawn host.

func TriggerRepotracker

func TriggerRepotracker(ctx context.Context, q amboy.Queue, msgID string, event *github.PushEvent) error

TriggerRepotracker creates an amboy job to get the commits from a Github Push Event

func UpdateDistro

func UpdateDistro(ctx context.Context, old, new *distro.Distro) error

UpdateDistro updates the given distro.Distro.

func UpdateProjectAliases

func UpdateProjectAliases(projectId string, aliases []restModel.APIProjectAlias) error

UpdateProjectAliases upserts/deletes aliases for the given project

func UpdateProjectVars

func UpdateProjectVars(projectId string, varsModel *restModel.APIProjectVars, overwrite bool) error

UpdateProjectVars adds new variables, overwrites variables, and deletes variables for the given project. If overwrite is true, the project variables will be fully replaced by those in varsModel. Otherwise, it will only set the value for variables that are explicitly present in varsModel and will not delete variables that are omitted.

func UpdateSettings

func UpdateSettings(dbUser *user.DBUser, settings user.UserSettings) error

func UpsertContainerSecrets

func UpsertContainerSecrets(ctx context.Context, v cocoa.Vault, updatedSecrets []model.ContainerSecret) error

UpsertContainerSecrets adds new secrets or updates the value of existing container secrets in the secrets storage service for a project. Each container secret to upsert must already be stored in the project ref.

func ValidatePatchID

func ValidatePatchID(patchId string) error

func ValidateProjectName

func ValidateProjectName(name string) error

ValidateProjectName checks that a project ID / identifier is not already in use and has only valid characters.

Types

type Connector

type Connector interface {
	// Get and Set URL provide access to the main url string of the API.
	GetURL() string
	SetURL(string)
	GetProjectFromFile(context.Context, model.ProjectRef, string) (model.ProjectInfo, error)
	CreateVersionFromConfig(context.Context, *model.ProjectInfo, model.VersionMetadata) (*model.Version, error)
	GetGitHubPR(context.Context, string, string, int) (*github.PullRequest, error)
	AddPatchForPR(context.Context, model.ProjectRef, int, []restModel.APIModule, string) (*patch.Patch, error)
	AddCommentToPR(context.Context, string, string, int, string) error
	IsAuthorizedToPatchAndMerge(context.Context, *evergreen.Settings, UserRepoInfo) (bool, error)
}

Connector is an interface that contains all of the methods which connect to the service layer of evergreen. These methods abstract the link between the service and the API layers, allowing for changes in the service architecture without forcing changes to the API.

type CopyDistroOpts

type CopyDistroOpts struct {
	DistroIdToCopy string
	NewDistroId    string
}

CopyDistroOpts is input for the CopyDistro function. It includes the ID of the distro to be copied and the new distro's ID.

type CopyProjectOpts

type CopyProjectOpts struct {
	ProjectIdToCopy      string
	NewProjectIdentifier string
	NewProjectId         string
}

type DBCommitQueueConnector

type DBCommitQueueConnector struct{}

func (*DBCommitQueueConnector) AddPatchForPR

func (pc *DBCommitQueueConnector) AddPatchForPR(ctx context.Context, projectRef model.ProjectRef, prNum int, modules []restModel.APIModule, messageOverride string) (*patch.Patch, error)

func (*DBCommitQueueConnector) IsAuthorizedToPatchAndMerge

func (pc *DBCommitQueueConnector) IsAuthorizedToPatchAndMerge(ctx context.Context, settings *evergreen.Settings, args UserRepoInfo) (bool, error)

type DBConnector

DBConnector is a struct that implements all of the methods which connect to the service layer of evergreen. These methods abstract the link between the service and the API layers, allowing for changes in the service architecture without forcing changes to the API. This is only required for the methods that must be mocked in unit tests, since they need a mocked implementation and a real DB implementation of the interface.

func (*DBConnector) GetPrefix

func (ctx *DBConnector) GetPrefix() string

func (*DBConnector) GetURL

func (ctx *DBConnector) GetURL() string

func (*DBConnector) SetPrefix

func (ctx *DBConnector) SetPrefix(prefix string)

func (*DBConnector) SetURL

func (ctx *DBConnector) SetURL(url string)

type DBGithubConnector

type DBGithubConnector struct{}

func (*DBGithubConnector) AddCommentToPR

func (gc *DBGithubConnector) AddCommentToPR(ctx context.Context, owner, repo string, prNum int, comment string) error

AddCommentToPR adds the given comment to the associated PR.

func (*DBGithubConnector) GetGitHubPR

func (gc *DBGithubConnector) GetGitHubPR(ctx context.Context, owner, repo string, prNum int) (*github.PullRequest, error)

GetGitHubPR takes the owner, repo, and PR number, and returns the associated GitHub PR.

type DBProjectConnector

type DBProjectConnector struct{}

DBProjectConnector is a struct that implements the Project related methods from the Connector through interactions with the backing database.

func (*DBProjectConnector) GetProjectFromFile

func (pc *DBProjectConnector) GetProjectFromFile(ctx context.Context, pRef model.ProjectRef, file string) (model.ProjectInfo, error)

type DBVersionConnector

type DBVersionConnector struct{}

DBVersionConnector is a struct that implements Version related methods from the Connector through interactions with the backing database.

func (*DBVersionConnector) CreateVersionFromConfig

func (vc *DBVersionConnector) CreateVersionFromConfig(ctx context.Context, projectInfo *model.ProjectInfo,
	metadata model.VersionMetadata) (*model.Version, error)

type FailingTaskData

type FailingTaskData struct {
	TaskId    string `bson:"task_id"`
	Execution int    `bson:"execution"`
}

type MockGitHubConnector

type MockGitHubConnector struct {
	URL string
	DBConnector
	MockGitHubConnectorImpl
}

func (*MockGitHubConnector) GetURL

func (ctx *MockGitHubConnector) GetURL() string

type MockGitHubConnectorImpl

type MockGitHubConnectorImpl struct {
	Queue           map[string][]restModel.APICommitQueueItem
	UserPermissions map[UserRepoInfo]string // map user to permission level in lieu of the Github API
	CachedPatches   []restModel.APIPatch
	Aliases         []restModel.APIProjectAlias
	CachedTests     []testresult.TestResult
	StoredError     error
}

func (*MockGitHubConnectorImpl) AddCommentToPR

func (pc *MockGitHubConnectorImpl) AddCommentToPR(ctx context.Context, owner, repo string, prNum int, comment string) error

func (*MockGitHubConnectorImpl) AddPatchForPR

func (pc *MockGitHubConnectorImpl) AddPatchForPR(ctx context.Context, projectRef model.ProjectRef, prNum int, modules []restModel.APIModule, messageOverride string) (*patch.Patch, error)

func (*MockGitHubConnectorImpl) CreateVersionFromConfig

func (mvc *MockGitHubConnectorImpl) CreateVersionFromConfig(ctx context.Context, projectInfo *model.ProjectInfo, metadata model.VersionMetadata) (*model.Version, error)

func (*MockGitHubConnectorImpl) GetGitHubPR

func (pc *MockGitHubConnectorImpl) GetGitHubPR(ctx context.Context, owner, repo string, prNum int) (*github.PullRequest, error)

func (*MockGitHubConnectorImpl) GetProjectFromFile

func (pc *MockGitHubConnectorImpl) GetProjectFromFile(ctx context.Context, pRef model.ProjectRef, file string) (model.ProjectInfo, error)

func (*MockGitHubConnectorImpl) IsAuthorizedToPatchAndMerge

func (pc *MockGitHubConnectorImpl) IsAuthorizedToPatchAndMerge(ctx context.Context, settings *evergreen.Settings, args UserRepoInfo) (bool, error)

type UserRepoInfo

type UserRepoInfo struct {
	Username string
	Owner    string
	Repo     string
}

func NewUserRepoInfo

func NewUserRepoInfo(info commitqueue.EnqueuePRInfo) UserRepoInfo

NewUserRepoInfo creates UserRepoInfo from PR information.

Jump to

Keyboard shortcuts

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