exportrepo

package
v3.1.12+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRevParseFailed = errors.New("git rev-parse HEAD failed")

Functions

func CommitIdentifier

func CommitIdentifier(repoUniqueName string, sha string) string

CommitIdentifier creates the unique identifier as a combination of the unique repo name and a short sha for display purposes

Types

type Export

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

func New

func New(opts Opts, locs fsconf.Locs) *Export

func (*Export) Run

func (s *Export) Run(ctx context.Context) (res Result)

type ExportDuration

type ExportDuration struct {
	Clone  time.Duration
	Ripsrc time.Duration
}

type Opts

type Opts struct {
	Logger     hclog.Logger
	CustomerID string
	RepoID     string

	// UniqueName is a name that will be used in the cache folder name. It should include the all info needed to find the repo in customer org. For example for github it should be NameWithOwner. It's preferrable to have a unique name for integration, but not required since we add id (and also refType) when storing in cache dir.
	UniqueName string

	// RefType to use when creating objects.
	// For example:
	// github, tfs
	RefType string

	LastProcessed *jsonstore.Store
	RepoAccess    gitclone.AccessDetails

	// LocalRepo is a path to local repo for easier testing with agent-dev export-repo
	LocalRepo string

	// CommitURLTemplate is a template for building commit url
	// https://example.com/repo1/@@@sha@@@
	CommitURLTemplate string
	// BranchURLTemplate is a template for building branch url
	// https://example.com/repo1/@@@branch@@@
	BranchURLTemplate string

	Sessions      SessionManger
	SessionRootID expsessions.ID

	// PRs to process similar to branches.
	PRs []PR

	CommitUsers *process.CommitUsers
}

type PR

type PR struct {
	ID            string
	RefID         string
	BranchName    string
	URL           string
	LastCommitSHA string
}

type Result

type Result struct {
	// RepoNameUsedInCacheDir name suitable for file system.
	RepoNameUsedInCacheDir string
	// Duration is the information on time taken.
	Duration ExportDuration
	// SessionErr contains an error if it was not possible to open/close sessions.
	// We fail full export on these errors, since these would be related to fs errors
	// and would lead to invalid session files.
	SessionErr error
	// OtherErr is mostly risprc error or other errors in processing that is not related to closing sessions properly.
	OtherErr error
}

Result is the result of the export run.

type SessionManger

type SessionManger interface {
	Session(modelType string, parentSessionID expsessions.ID, parentObjectID, parentObjectName string) (_ expsessions.ID, lastProcessed interface{}, _ error)
	Write(id expsessions.ID, objs []map[string]interface{}) error
	// lastProcessed is not used in this package
	Done(id expsessions.ID, lastProcessed interface{}) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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