git

package
v0.16.4 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNothingToCommit    = errors.New("nothing to commit")
	ErrReleaseNotFound    = errors.New("release not found")
	ErrBranchBehindOrigin = errors.New("branch behind origin")
	ErrUnknownGit         = errors.New("unknown git error")
)

Functions

func CommitterDetails

func CommitterDetails() (string, string, error)

CommitterDetails returns name and email read for a Git configuration file.

Fetching the configuration values are delegated to the git CLI and follows precedence rules defined by Git.

func TempDir added in v0.0.26

func TempDir(ctx context.Context, tracer tracing.Tracer, prefix string) (string, func(context.Context), error)

TempDir returns a temporary directory with provided prefix. The first return argument is the path. The second is a close function to remove the path.

func TempDirAsync added in v0.0.44

func TempDirAsync(ctx context.Context, tracer tracing.Tracer, prefix string) (string, func(context.Context), error)

TempDirSync returns a temporary directory with provided prefix. The first return argument is the path. The second is a close function to remove the path asynchronously.

Types

type GitConfig added in v0.5.4

type GitConfig struct {
	User       string
	Email      string
	SigningKey string
}

type Service added in v0.0.27

type Service struct {
	Tracer            tracing.Tracer
	SSHPrivateKeyPath string
	ConfigRepoURL     string
	Config            *GitConfig
	ArtifactFileName  string
	// contains filtered or unexported fields
}

func (*Service) Checkout added in v0.0.27

func (s *Service) Checkout(ctx context.Context, rootPath string, hash plumbing.Hash) error

func (*Service) Clone added in v0.0.27

func (s *Service) Clone(ctx context.Context, destination string) (*git.Repository, error)

Clone returns a Git repository copy from the master repository.

func (*Service) Commit added in v0.0.27

func (s *Service) Commit(ctx context.Context, rootPath, changesPath, msg string) error

func (*Service) InitMasterRepo added in v0.0.27

func (s *Service) InitMasterRepo(ctx context.Context) (func(context.Context), error)

InitMasterRepo clones the configuration repository into a master directory.

func (*Service) LocateEnvRelease added in v0.0.27

func (s *Service) LocateEnvRelease(ctx context.Context, r *git.Repository, env, artifactID string) (plumbing.Hash, error)

LocateEnvRelease traverses the git log to find a release commit for a specified environment and artifactID.

It expects the commit to have a commit messages as the one returned by ReleaseCommitMessage.

func (*Service) LocateRelease added in v0.0.27

func (s *Service) LocateRelease(ctx context.Context, r *git.Repository, artifactID string) (plumbing.Hash, error)

LocateRelease traverses the git log to find a release commit with id artifactID.

It expects the commit to have a commit messages as the one returned by ReleaseCommitMessage.

func (*Service) LocateServiceRelease added in v0.0.27

func (s *Service) LocateServiceRelease(ctx context.Context, r *git.Repository, env, service string) (plumbing.Hash, error)

LocateServiceRelease traverses the git log to find a release commit for a specified service and environment.

It expects the commit to have a commit messages as the one returned by ReleaseCommitMessage.

func (*Service) LocateServiceReleaseRollbackSkip added in v0.0.27

func (s *Service) LocateServiceReleaseRollbackSkip(ctx context.Context, r *git.Repository, env, service string, n uint) (plumbing.Hash, error)

LocateServiceReleaseRollbackSkip traverses the git log to find the nth release or rollback commit for a specified service and environment.

It expects the commit to have a commit messages as the one returned by ReleaseCommitMessage or RollbackCommitMessage.

func (*Service) MasterPath added in v0.0.53

func (s *Service) MasterPath() string

func (*Service) SignedCommit added in v0.5.2

func (s *Service) SignedCommit(ctx context.Context, rootPath, changesPath, authorName, authorEmail, msg string) error

func (*Service) SyncMaster added in v0.0.27

func (s *Service) SyncMaster(ctx context.Context) error

SyncMaster pulls latest changes from master repo.

Jump to

Keyboard shortcuts

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