repotracker

package
v0.0.0-...-1d50e38 Latest Latest
Warning

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

Go to latest
Published: May 30, 2017 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// determines the default maximum number of revisions to fetch for a newly tracked repo
	// if not specified in configuration file
	DefaultNumNewRepoRevisionsToFetch = 200
	DefaultMaxRepoRevisionsToSearch   = 50
)
View Source
const (
	RunnerName  = "repotracker"
	Description = "poll version control for new commits"
)

Variables

This section is empty.

Functions

func NewMockRepoPoller

func NewMockRepoPoller(mockProject *model.Project, mockRevisions []model.Revision) *mockRepoPoller

Creates a new MockRepo poller with the given project settings

func NewVersionFromRevision

func NewVersionFromRevision(ref *model.ProjectRef, rev model.Revision) (*version.Version, error)

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

func (gRepoPoller *GithubRepositoryPoller) GetChangedFiles(commitRevision string) ([]string, error)

GetRemoteConfig fetches the contents of a remote github repository's configuration data as at a given revision

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) ([]model.Revision, 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 a list of all filepaths modified by a given revision.
	GetChangedFiles(revision string) ([]string, 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) 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) (*model.Project, 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. An erroneous project file may be returned along with an error.

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.

type Runner

type Runner struct{}

func (*Runner) Description

func (r *Runner) Description() string

func (*Runner) Name

func (r *Runner) Name() string

func (*Runner) Run

func (r *Runner) Run(config *evergreen.Settings) error

Jump to

Keyboard shortcuts

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