runner

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 8 Imported by: 0

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

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 JobInfo

type JobInfo struct {
	VariableName string `json:"variable_name"`
	Package      string `json:"package"`
}

JobInfo contains information about a job variable to extract.

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 New

func New() *Runner

New creates a new Runner.

func (*Runner) FindGoPath

func (r *Runner) FindGoPath() (string, error)

FindGoPath locates the Go binary.

func (*Runner) GenerateExtractor

func (r *Runner) GenerateExtractor(modulePath, pkg string, jobs []JobInfo) (string, error)

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

func (r *Runner) ParseGoMod(dir string) (string, error)

ParseGoMod extracts the module path and replace directives from a go.mod file.

func (*Runner) ParseGoModFull

func (r *Runner) ParseGoModFull(dir string) (*GoModInfo, error)

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.

Jump to

Keyboard shortcuts

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