Documentation
¶
Index ¶
Constants ¶
const RepoCacheDirEnv = "KPT_CACHE_DIR"
RepoCacheDirEnv is the name of the environment variable that controls the cache directory for remote repos. Defaults to UserHomeDir/.kpt/repos if unspecified.
Variables ¶
This section is empty.
Functions ¶
func AmendGitExecError ¶
func AmendGitExecError(err error, f func(e *GitExecError))
AmendGitExecError provides a way to amend the GitExecError returned by the GitLocalRunner.run command.
Types ¶
type GitArgKind ¶
type GitArgKind string
const ( GitArgRef GitArgKind = "reference" GitArgCommit GitArgKind = "commit" GitArgRepoURI GitArgKind = "repo URI" )
type GitExecError ¶
type GitExecError struct {
Type GitExecErrorType
Args []string
Err error
Command string
Repo string
Ref string
StdErr string
StdOut string
}
GitExecError is an error type returned if kpt encounters an error while executing a git command. It includes information about the command that was executed and the output from git.
func (*GitExecError) Error ¶
func (e *GitExecError) Error() string
type GitExecErrorType ¶
type GitExecErrorType int
GitExecErrorType is used to enumerate git errors.
const ( // Unknown is used when we can't classify an error into any of the other // categories. Unknown GitExecErrorType = iota // GitExecutableNotFound means the git executable wasn't available. GitExecutableNotFound // UnknownReference means that provided reference (tag, branch) wasn't // found UnknownReference // HTTPSAuthRequired means we try to access the repo using the https // protocol, but the repo required authentication. HTTPSAuthRequired // RepositoryNotFound means the provided repo uri doesn't seem to point // to a valid git repo. RepositoryNotFound // uri. RepositoryUnavailable )
type GitLocalRunner ¶
type GitLocalRunner struct {
// Dir is the directory the commands are run in.
Dir string
// Debug enables output of debug information to stderr.
Debug bool
// contains filtered or unexported fields
}
GitLocalRunner runs git commands in a local git repo.
func NewLocalGitRunner ¶
func NewLocalGitRunner(pkg string) (*GitLocalRunner, error)
NewLocalGitRunner returns a new GitLocalRunner for a local package.
func (*GitLocalRunner) Run ¶
func (g *GitLocalRunner) Run(ctx context.Context, command string, args ...string) (RunResult, error)
Run runs a git command. Omit the 'git' part of the command. The first return value contains the output to Stdout and Stderr when running the command.
func (*GitLocalRunner) RunVerbose ¶
func (g *GitLocalRunner) RunVerbose(ctx context.Context, command string, args ...string) (RunResult, error)
RunVerbose runs a git command. Omit the 'git' part of the command. The first return value contains the output to Stdout and Stderr when running the command.
type GitUpstreamRepo ¶
type GitUpstreamRepo interface {
Uri() string
Heads() []string
Tags() []string
GetFetchedRefs() []string
GetRepo(ctx context.Context, refs []string) (string, error)
GetDefaultBranch(ctx context.Context) (string, error)
ResolveBranch(branch string) (string, bool)
ResolveTag(tag string) (string, bool)
ResolveRef(ref string) string
}
func NewGitUpstreamRepo ¶
func NewGitUpstreamRepo(ctx context.Context, uri string) (GitUpstreamRepo, error)
NewGitUpstreamRepo returns a new GitUpstreamRepo for an upstream package.