git

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: May 6, 2019 License: Apache-2.0 Imports: 16 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")
	ErrArtifactNotFound = errors.New("artifact not found")
)

Functions

func ArtifactCommitMessage added in v0.0.4

func ArtifactCommitMessage(service, artifactID, author string) string

ArtifactCommitMessage returns an artifact commit message.

func BranchFromHead added in v0.0.16

func BranchFromHead(ctx context.Context, repo *git.Repository, artifactFileName, svc string) (string, error)

BranchFromHead reutrns the branch name from the current HEAD commit.

It only handles files that originates from a build operation, ie. non-build commits cannot be extracted.

func BranchName added in v0.0.16

func BranchName(modifiedFiles []string, artifactFileName, svc string) (string, bool)

BranchName returns the branch name and a bool indicating one is found from a list of modified file paths.

It only handles files that originates from a build operation, ie. non-build commits cannot be extracted.

func Checkout

func Checkout(r *git.Repository, hash plumbing.Hash) error

func Clone

func Clone(ctx context.Context, repoURL, destination, sshPrivateKeyPath string) (*git.Repository, error)

func CloneDepth

func CloneDepth(ctx context.Context, repoURL, destination, sshPrivateKeyPath string, depth int) (*git.Repository, error)

func Commit

func Commit(ctx context.Context, repo *git.Repository, changesPath, authorName, authorEmail, committerName, committerEmail, msg, sshPrivateKeyPath string) error

func CommitterDetails

func CommitterDetails() (string, string, error)

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

Configuration files are read first in the local git repository (if available) and then read the global Git configuration.

func LocateArtifact added in v0.0.2

func LocateArtifact(r *git.Repository, artifactID string) (plumbing.Hash, error)

LocateArtifact traverses the git log to find an artifact commit with id artifactID.

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

func LocateEnvRelease added in v0.0.25

func LocateEnvRelease(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 LocateRelease

func LocateRelease(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 LocateServiceRelease added in v0.0.10

func LocateServiceRelease(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 LocateServiceReleaseRollbackSkip added in v0.0.10

func LocateServiceReleaseRollbackSkip(r *git.Repository, env, service string, n uint) (plumbing.Hash, error)

LocateServiceReleaseRollbackSkip traverses the git log to find a 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 PolicyUpdateApplyCommitMessage added in v0.0.4

func PolicyUpdateApplyCommitMessage(env, service, branch, policy string) string

PolicyUpdateApplyCommitMessage returns an apply policy commit message.

func PolicyUpdateDeleteCommitMessage added in v0.0.4

func PolicyUpdateDeleteCommitMessage(service string) string

PolicyUpdateDeleteCommitMessage returns a delete policy commit message.

func ReleaseCommitMessage added in v0.0.4

func ReleaseCommitMessage(env, service, artifactID string) string

ReleaseCommitMessage returns an artifact release commit message.

func RollbackCommitMessage added in v0.0.10

func RollbackCommitMessage(env, service, oldArtifactID, newArtifactID string) string

RollbackCommitMessage returns an artifact rollback commit message.

Types

This section is empty.

Jump to

Keyboard shortcuts

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