Documentation
¶
Index ¶
- Constants
- Variables
- type Data
- type EarthfileNotExistError
- type GitLookup
- func (gl *GitLookup) AddMatcher(...) error
- func (gl *GitLookup) ConvertCloneURL(ctx context.Context, inURL string) (gitURL string, keyScans []string, sshCommand string, err error)
- func (gl *GitLookup) DisableSSH()
- func (gl *GitLookup) GetCloneURL(ctx context.Context, path string) (gitURL string, subPath string, keyScans []string, sshCommand string, err error)
- type Resolver
Constants ¶
const ( HTTPProtocol = iota + 1 HTTPSProtocol SSHProtocol GitProtocol UnknownProtocol )
TODO eventually we should use gitutil.parseURL directly; but for now we want to avoid this change to keep this commit smaller.
const DockerfileMetaTarget = "@dockerfile:"
DockerfileMetaTarget is a target name prefix which signals the resolver that the build file is a dockerfile. The DockerfileMetaTarget is really not a valid Earthly target otherwise.
Variables ¶
var ErrNoMatch = errors.Errorf("no git match found")
ErrNoMatch occurs when no git matcher is found.
var ImplicitExcludes = []string{
".tmp-earthly-out/",
"build.earth",
"Earthfile",
earthIgnoreFile,
earthlyIgnoreFile,
}
ImplicitExcludes is a list of implicit patterns to exclude.
Functions ¶
This section is empty.
Types ¶
type Data ¶
type Data struct {
// BuildContext is the state to use for the build.
BuildContextFactory llbfactory.Factory
// Target is the earthly reference.
Ref domain.Reference
// GitMetadata contains git metadata information.
GitMetadata *gitutil.GitMetadata
// LocalDirs is the local dirs map to be passed as part of the buildkit solve.
LocalDirs map[string]string
// Features holds the feature state for the build context
Features *features.Features
// BuildFilePath is the local path where the Earthfile or Dockerfile can be found.
BuildFilePath string
// The parsed Earthfile AST.
Earthfile spec.Earthfile
}
Data represents a resolved target's build context data.
type EarthfileNotExistError ¶
type EarthfileNotExistError struct {
Target string
}
EarthfileNotExistError is the struct indicating that file does not exist.
func (EarthfileNotExistError) Error ¶
func (err EarthfileNotExistError) Error() string
Error implements [error] interface.
type GitLookup ¶
type GitLookup struct {
// contains filtered or unexported fields
}
GitLookup looksup gits.
func NewGitLookup ¶
func NewGitLookup(console conslogging.ConsoleLogger, sshAuthSock string) *GitLookup
NewGitLookup creates new lookuper.
func (*GitLookup) AddMatcher ¶
func (gl *GitLookup) AddMatcher( name, pattern, sub, user, password, prefix, suffix, protocol, knownHosts string, strictHostKeyChecking bool, port int, sshCommand string, ) error
AddMatcher adds a new matcher for looking up git repos.
func (*GitLookup) ConvertCloneURL ¶
func (gl *GitLookup) ConvertCloneURL( ctx context.Context, inURL string, ) (gitURL string, keyScans []string, sshCommand string, err error)
ConvertCloneURL takes a url such as https://github.com/user/repo.git or git@github.com:user/repo.git and makes use of configured git credentials and protocol preferences to convert it into the appropriate https or ssh protocol. it also returns a keyScan and sshCommand.
func (*GitLookup) DisableSSH ¶
func (gl *GitLookup) DisableSSH()
DisableSSH changes all git matchers from ssh to https.
func (*GitLookup) GetCloneURL ¶
func (gl *GitLookup) GetCloneURL( ctx context.Context, path string, ) (gitURL string, subPath string, keyScans []string, sshCommand string, err error)
GetCloneURL returns the repo to clone, and a path relative to the repo
"github.com/earthly/earthly" ---> ("git@github.com/earthly/earthly.git", "")
"github.com/EarthBuild/earthbuild/examples" ---> ("git@github.com/earthly/earthly.git", "examples")
"github.com/EarthBuild/earthbuild/examples/go" ---> ("git@github.com/earthly/earthly.git", "examples/go")
Additionally a ssh keyscan might be returned (or an empty string indicating none was configured) Also, a custom "git ssh command" may be returned. This is part of this function since the user may specify a command necessary to clone their repository successfully.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver is a build context resolver.
func NewResolver ¶
func NewResolver( cleanCollection *cleanup.Collection, gitLookup *GitLookup, console conslogging.ConsoleLogger, featureFlagOverrides, gitBranchOverride, gitLFSInclude string, gitLogLevel buildkitgitutil.GitLogLevel, gitImage string, ) *Resolver
NewResolver returns a new NewResolver.
func (*Resolver) ExpandWildcard ¶
func (r *Resolver) ExpandWildcard( ctx context.Context, gwClient gwclient.Client, platr *platutil.Resolver, parentTarget, target domain.Target, ) ([]string, error)
ExpandWildcard will expand a wildcard BUILD target in a local path or remote Git repository. Local and remote targets are treated differently. For local targets, we need to join the two targets in order to derive the full relative path. This is then used when globbing for matches. The paths are then made relative to the parent target for resolution by the caller.
func (*Resolver) Resolve ¶
func (r *Resolver) Resolve( ctx context.Context, gwClient gwclient.Client, platr *platutil.Resolver, ref domain.Reference, ) (*Data, error)
Resolve returns resolved context data for a given Earthly reference. If the reference is a target, then the context will include a build context and possibly additional local directories.