Documentation
¶
Overview ¶
Package runner provides runtime value extraction via temporary Go program generation. It imports the user's package, executes it, and extracts JSON values with custom MarshalJSON() transformations.
Index ¶
- type ExtractedResult
- type GoModInfo
- type JobInfo
- type PipelineInfo
- type Runner
- func (r *Runner) FindGoPath() (string, error)
- func (r *Runner) GenerateExtractor(modulePath, pkg string, jobs []JobInfo) (string, error)
- func (r *Runner) GenerateExtractorWithPipelines(modulePath, pkg string, jobs []JobInfo, pipelines []PipelineInfo) (string, error)
- func (r *Runner) GenerateRunnerConfigExtractor(modulePath, pkg string, configs []RunnerConfigInfo) (string, error)
- func (r *Runner) ParseGoMod(dir string) (string, error)
- func (r *Runner) ParseGoModFull(dir string) (*GoModInfo, error)
- func (r *Runner) Run(projectDir string, jobs []JobInfo, pipelines []PipelineInfo) (*ExtractedResult, error)
- func (r *Runner) RunRunnerConfig(projectDir string, configs []RunnerConfigInfo) (*RunnerConfigResult, error)
- type RunnerConfigInfo
- type RunnerConfigResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExtractedResult ¶
type ExtractedResult struct {
Jobs map[string]map[string]any `json:"jobs,omitempty"`
Pipelines map[string]map[string]any `json:"pipelines,omitempty"`
Error string `json:"error,omitempty"`
}
ExtractedResult contains the extracted values from running the user's code.
type GoModInfo ¶
type GoModInfo struct {
ModulePath string
GoModDir string // Directory containing go.mod (or project dir if synthetic)
ReplaceDirective string // Replace directive for wetwire-gitlab-go if present
Synthetic bool // true if auto-generated (no go.mod found)
}
GoModInfo contains parsed go.mod information.
type PipelineInfo ¶
type PipelineInfo struct {
VariableName string `json:"variable_name"`
Package string `json:"package"`
}
PipelineInfo contains information about a pipeline variable to extract.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner executes Go code to extract pipeline values.
func (*Runner) FindGoPath ¶
FindGoPath locates the Go binary.
func (*Runner) GenerateExtractor ¶
GenerateExtractor generates Go code to extract job values.
func (*Runner) GenerateExtractorWithPipelines ¶
func (r *Runner) GenerateExtractorWithPipelines(modulePath, pkg string, jobs []JobInfo, pipelines []PipelineInfo) (string, error)
GenerateExtractorWithPipelines generates Go code to extract job and pipeline values.
func (*Runner) GenerateRunnerConfigExtractor ¶
func (r *Runner) GenerateRunnerConfigExtractor(modulePath, pkg string, configs []RunnerConfigInfo) (string, error)
GenerateRunnerConfigExtractor generates Go code to extract runner config values.
func (*Runner) ParseGoMod ¶
ParseGoMod extracts the module path and replace directives from a go.mod file.
func (*Runner) ParseGoModFull ¶
ParseGoModFull extracts the module path and replace directives from a go.mod file. If no go.mod is found, it returns synthetic module info based on the directory name.
func (*Runner) Run ¶
func (r *Runner) Run(projectDir string, jobs []JobInfo, pipelines []PipelineInfo) (*ExtractedResult, error)
Run executes the extractor and returns the results.
func (*Runner) RunRunnerConfig ¶
func (r *Runner) RunRunnerConfig(projectDir string, configs []RunnerConfigInfo) (*RunnerConfigResult, error)
RunRunnerConfig executes the runner config extractor and returns the TOML output.
type RunnerConfigInfo ¶
type RunnerConfigInfo struct {
VariableName string `json:"variable_name"`
Package string `json:"package"`
}
RunnerConfigInfo contains information about a runner config variable to extract.
type RunnerConfigResult ¶
type RunnerConfigResult struct {
TOML string `json:"toml,omitempty"`
Error string `json:"error,omitempty"`
}
RunnerConfigResult contains the extracted runner config TOML output.