Documentation ¶
Index ¶
- Constants
- func NewMockRepoPoller(mockProject *model.Project, mockRevisions []model.Revision) *mockRepoPoller
- func NewVersionFromRevision(ref *model.ProjectRef, rev model.Revision) (*version.Version, error)
- type GithubRepositoryPoller
- func (gRepoPoller *GithubRepositoryPoller) GetRecentRevisions(maxRevisions int) (revisions []model.Revision, err error)
- func (gRepoPoller *GithubRepositoryPoller) GetRemoteConfig(projectFileRevision string) (projectConfig *model.Project, err error)
- func (gRepoPoller *GithubRepositoryPoller) GetRevisionsSince(revision string, maxRevisionsToSearch int) (revisions []model.Revision, err error)
- type RepoPoller
- type RepoTracker
- func (repoTracker *RepoTracker) FetchRevisions(numNewRepoRevisionsToFetch int) (err error)
- func (repoTracker *RepoTracker) GetProjectConfig(revision string) (project *model.Project, err error)
- func (repoTracker *RepoTracker) StoreRevisions(revisions []model.Revision) (newestVersion *version.Version, err error)
- type Runner
Constants ¶
const ( RunnerName = "repotracker" Description = "poll version control for new commits" )
const ( // determines the default maximum number of revisions to fetch for a newly tracked repo // if not specified in configuration file DefaultNumNewRepoRevisionsToFetch = 50 )
Variables ¶
This section is empty.
Functions ¶
func NewMockRepoPoller ¶
Creates a new MockRepo poller with the given project settings
func NewVersionFromRevision ¶
NewVersionFromRevision populates a new Version with metadata from a model.Revision. Does not populate its config or store anything in the database.
Types ¶
type GithubRepositoryPoller ¶
type GithubRepositoryPoller struct { ProjectRef *model.ProjectRef OauthToken string }
GithubRepositoryPoller is a struct that implements Github specific behavior required of a RepoPoller
func NewGithubRepositoryPoller ¶
func NewGithubRepositoryPoller(projectRef *model.ProjectRef, oauthToken string) *GithubRepositoryPoller
NewGithubRepositoryPoller constructs and returns a pointer to a GithubRepositoryPoller struct
func (*GithubRepositoryPoller) GetRecentRevisions ¶
func (gRepoPoller *GithubRepositoryPoller) GetRecentRevisions(maxRevisions int) ( revisions []model.Revision, err error)
GetRecentRevisions fetches the most recent 'numRevisions'
func (*GithubRepositoryPoller) GetRemoteConfig ¶
func (gRepoPoller *GithubRepositoryPoller) GetRemoteConfig( projectFileRevision string) (projectConfig *model.Project, err error)
GetRemoteConfig fetches the contents of a remote github repository's configuration data as at a given revision
func (*GithubRepositoryPoller) GetRevisionsSince ¶
func (gRepoPoller *GithubRepositoryPoller) GetRevisionsSince(revision string, maxRevisionsToSearch int) (revisions []model.Revision, err error)
GetRevisionsSince fetches the all commits from the corresponding Github ProjectRef that were made after 'revision'
type RepoPoller ¶
type RepoPoller interface { // Fetches the contents of a remote repository's configuration data as at // the given revision GetRemoteConfig(revision string) (*model.Project, error) // Fetches all changes since the 'revision' specified - with the most recent // revision appearing as the first element in the slice. // // 'maxRevisionsToSearch' determines the maximum number of revisions we // allow to search through - in order to find 'revision' - before we give // up. A value <= 0 implies we allow to search through till we hit the first // revision for the project. GetRevisionsSince(sinceRevision string, maxRevisions int) ([]model.Revision, error) // Fetches the most recent 'numNewRepoRevisionsToFetch' revisions for a // project - with the most recent revision appearing as the first element in // the slice. GetRecentRevisions(numNewRepoRevisionsToFetch int) ([]model.Revision, error) }
The RepoPoller interface specifies behavior required of all repository poller implementations
type RepoTracker ¶
type RepoTracker struct { *evergreen.Settings *model.ProjectRef RepoPoller }
RepoTracker is used to manage polling repository changes and storing such changes. It contains a number of interfaces that specify behavior required by client implementations
func (*RepoTracker) FetchRevisions ¶
func (repoTracker *RepoTracker) FetchRevisions(numNewRepoRevisionsToFetch int) ( err error)
The FetchRevisions method is used by a RepoTracker to run the pipeline for tracking repositories. It performs everything from polling the repository to persisting any changes retrieved from the repository reference.
func (*RepoTracker) GetProjectConfig ¶
func (repoTracker *RepoTracker) GetProjectConfig(revision string) ( project *model.Project, err error)
GetProjectConfig fetches the project configuration for a given repository returning a remote config if the project references a remote repository configuration file - via the Identifier. Otherwise it defaults to the local project file
func (*RepoTracker) StoreRevisions ¶
func (repoTracker *RepoTracker) StoreRevisions(revisions []model.Revision) (newestVersion *version.Version, err error)
Constructs all versions stored from recent repository revisions The additional complexity is due to support for project modifications on patch builds. We need to parse the remote config as it existed when each revision was created. The return value is the most recent version created as a result of storing the revisions. This function is idempotent with regard to storing the same version multiple times.