gitrepo

package
v0.5.1-rc0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2021 License: MPL-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneRepo

func CloneRepo(ctx context.Context, client git.Git, url gitproviders.RepoURL, branch string) (func(), string, error)

CloneRepo uses the git client to clone the reop from the URL and branch. It clones into a temp directory and returns a function to use by the caller for cleanup. The temp directory is also returned.

func CommitAndPush

func CommitAndPush(ctx context.Context, client git.Git, commitMsg string, logger logger.Logger, filters ...func(string) bool) error

Types

type RepoWriter

type RepoWriter interface {
	CreatePullRequest(ctx context.Context, info gitproviders.PullRequestInfo) error
	WriteAndMerge(ctx context.Context, repoDir, commitMsg string, manifests []automation.AutomationManifest) error
	CloneRepo(ctx context.Context, branch string) (func(), string, error)
	GetDefaultBranch(ctx context.Context) (string, error)
	CommitAndPush(ctx context.Context, commitMsg string, filters ...func(string) bool) error
	Write(ctx context.Context, path string, content []byte) error
	Remove(ctx context.Context, path string) error
}

func NewRepoWriter

func NewRepoWriter(url gitproviders.RepoURL, gitProvider gitproviders.GitProvider, gitClient git.Git, logger logger.Logger) RepoWriter

type RepoWriterSvc

type RepoWriterSvc struct {
	URL         gitproviders.RepoURL
	GitProvider gitproviders.GitProvider
	GitClient   git.Git
	Logger      logger.Logger
}

func (*RepoWriterSvc) CloneRepo

func (rw *RepoWriterSvc) CloneRepo(ctx context.Context, branch string) (func(), string, error)

func (*RepoWriterSvc) CommitAndPush

func (rw *RepoWriterSvc) CommitAndPush(ctx context.Context, commitMsg string, filters ...func(string) bool) error

func (*RepoWriterSvc) CreatePullRequest

func (rw *RepoWriterSvc) CreatePullRequest(ctx context.Context, info gitproviders.PullRequestInfo) error

func (*RepoWriterSvc) GetDefaultBranch

func (rw *RepoWriterSvc) GetDefaultBranch(ctx context.Context) (string, error)

func (*RepoWriterSvc) Remove

func (rw *RepoWriterSvc) Remove(ctx context.Context, path string) error

func (*RepoWriterSvc) Write

func (rw *RepoWriterSvc) Write(ctx context.Context, path string, content []byte) error

func (*RepoWriterSvc) WriteAndMerge

func (rw *RepoWriterSvc) WriteAndMerge(ctx context.Context, repoDir, commitMsg string, manifests []automation.AutomationManifest) error

Jump to

Keyboard shortcuts

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