gitexporter

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReportTypeWebhooks    = "webhook"
	ReportTypePRs         = "pull requests"
	ReportTypeBranchRules = "branch rules"
	ReportTypeLabels      = "labels"
	ReportTypeUsers       = "users"
)
View Source
const (
	UnknownEmailSuffix = "@unknownemail.harness.io"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Exporter

type Exporter struct {
	ScmLogin string
	ScmToken string

	Tracer tracer.Tracer
	Report map[string]*report.Report
	// contains filtered or unexported fields
}

func NewExporter

func NewExporter(
	exporter Interface,
	location string,
	scmLogin string,
	scmToken string,
	tracer tracer.Tracer,
	report map[string]*report.Report,
	flags Flags,
) Exporter

func (*Exporter) CloneRepository

func (e *Exporter) CloneRepository(
	ctx context.Context,
	repoData scm.Repository,
	repoPath string,
	repoSlug string,
	pullreqRef []config.RefSpec,
	tracer tracer.Tracer,
) (bool, error)

func (*Exporter) Export

func (e *Exporter) Export(ctx context.Context) error

Export calls exporter methods in order and serialize an object for import.

type FileLogger

type FileLogger struct {
	Location string
}

func (*FileLogger) Log

func (f *FileLogger) Log(format string, args ...any) error

Log writes the exporters' logs at the top level

type Flags

type Flags struct {
	NoPR      bool // to not export pull requests and comments
	NoWebhook bool // to not export webhooks
	NoRule    bool // to not export branch protection rules
	NoComment bool // to not export pull request comments
	NoLabel   bool // to not export repo/space labels
}

type Interface

type Interface interface {
	ListRepositories(ctx context.Context, opts types.ListOptions) ([]types.RepoResponse, error)

	ListPullRequests(ctx context.Context, repoSlug string, opts types.PullRequestListOptions) ([]types.PRResponse, error)

	ListPullRequestComments(ctx context.Context, repoSlug string, prNumber int, opts types.ListOptions) ([]*types.PRComment, error)

	PullRequestReviewers(ctx context.Context, prNumber int) error

	PullRequestRefs() []config.RefSpec

	ListWebhooks(ctx context.Context, repoSlug string, opts types.ListOptions) (types.WebhookData, error)

	ListBranchRules(ctx context.Context, repoSlug string, opts types.ListOptions) ([]*types.BranchRule, error)

	ListLabels(ctx context.Context, repoSlug string, opts types.ListOptions) (map[string]externalTypes.Label, error)
}

Interface helps to support a generic way of doing export for all git providers

type Logger

type Logger interface {
	Log(format string, args ...any) error
}

Jump to

Keyboard shortcuts

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