Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Architecture ¶
type Architecture struct {
Languages map[string]Language `yaml:"languages"`
Contracts *ContractConfig `yaml:"contracts,omitempty"`
}
type CloneEvent ¶
type CloneEvent struct {
Type CloneEventType
Parent string // for submodule events
Module string // current module path
Name string // submodule name or module path
URL string // for discovery
Ref string // current ref we are cloning from
Progress int // 0–100
}
CloneEvent is a single “thing that happened” during clone
type CloneEventType ¶
type CloneEventType int
CloneEventType enumerates the kinds of things git clone can tell us
const ( EventSubmoduleDiscovered CloneEventType = iota EventSubmoduleCloneStart EventProgress EventCloneComplete EventCloneFailed )
type Config ¶
type Config struct {
Architectures map[string]Architecture `yaml:"architectures"`
}
func LoadConfig ¶
type ContractConfig ¶
type GitClient ¶
type GitClient struct {
Runner Runner
ReceivingRegex *regexp.Regexp
CloningRegex *regexp.Regexp
SubmoduleRegex *regexp.Regexp
}
GitClient does our actual clone + parsing
func NewGitClient ¶
func NewGitClient() *GitClient
NewGitClient builds a GitClient using the real exec
func NewGitClientWithRunner ¶
NewGitClientWithRunner enables injecting a custom Runner (e.g. in tests)
func (*GitClient) Clone ¶
func (g *GitClient) Clone( ctx context.Context, repoURL, ref, dest string, config GitFetcherConfig, reporter Reporter, ) error
Clone runs the following to enable clones from SHAs, tags and branches:
- git clone --no-checkout --depth 1 <repoURL> <dest>
- git -C <dest> checkout --quiet <ref>
- git -C <dest> submodule update --init --recursive --progress
type GitFetcher ¶
type GitFetcher struct {
Client *GitClient
Metrics GitMetrics
Config GitFetcherConfig
Logger logger.ProgressLogger
}
GitFetcher wraps clone with metrics and reporting
type GitFetcherConfig ¶
type GitFetcherConfig struct {
Verbose bool
}
GitFetcherConfig holds options; we only care about Verbose here
type GitMetrics ¶
TODO: implement metric transport
type Reporter ¶
type Reporter interface {
Report(CloneEvent)
}
Reporter consumes CloneEvents
func NewCloneReporter ¶
func NewCloneReporter(repoURL string, lg logger.ProgressLogger, m GitMetrics) Reporter
type Runner ¶
type Runner interface {
// CommandContext mirrors exec.CommandContext
CommandContext(ctx context.Context, name string, args ...string) *exec.Cmd
}
Runner lets us inject/mock command execution in tests
type SubmoduleReport ¶
Click to show internal directories.
Click to hide internal directories.