pipeline

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package pipeline runs the configurable validation steps inside a worktree and implements the "clean push gate": a push is allowed only when every required step passes. It executes shell commands and never pushes anything itself.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	StopOnFailure  bool
	DefaultTimeout time.Duration
	Env            map[string]string
	Steps          []Step
}

Config is the runtime validation configuration.

func FromConfig

func FromConfig(c config.ValidationConfig) (Config, error)

FromConfig converts the YAML-facing config into a runtime Config, parsing duration strings.

type Result

type Result struct {
	Steps    []StepResult  `json:"steps"`
	Passed   bool          `json:"passed"`
	Failed   []StepResult  `json:"failed,omitempty"`
	Duration time.Duration `json:"duration"`
}

Result is the aggregate pipeline outcome.

func (Result) FailureDigest

func (r Result) FailureDigest() string

FailureDigest renders a compact summary of failed steps for an agent to fix.

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner executes validation pipelines.

func NewRunner

func NewRunner(cfg Config, log *zerolog.Logger) *Runner

NewRunner builds a Runner.

func (*Runner) Gate

func (r *Runner) Gate(ctx context.Context, dir string) (allowed bool, result Result, err error)

Gate runs the pipeline and reports whether a push is allowed. It never pushes.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, dir string) (Result, error)

Run executes all steps in dir and returns the aggregate result.

type Step

type Step struct {
	Name            string
	Run             string
	Timeout         time.Duration
	ContinueOnError bool // failure is recorded but does NOT block the gate
	WorkdirRel      string
	Env             map[string]string
}

Step is one validation command.

type StepResult

type StepResult struct {
	Name     string        `json:"name"`
	Status   StepStatus    `json:"status"`
	ExitCode int           `json:"exit_code"`
	Stdout   string        `json:"stdout,omitempty"`
	Stderr   string        `json:"stderr,omitempty"`
	Duration time.Duration `json:"duration"`
	Advisory bool          `json:"advisory,omitempty"` // continue_on_error step
}

StepResult captures one step's execution.

type StepStatus

type StepStatus string

StepStatus is the outcome of a single step.

const (
	StepPassed   StepStatus = "passed"
	StepFailed   StepStatus = "failed"
	StepTimedOut StepStatus = "timed_out"
	StepSkipped  StepStatus = "skipped"
)

Jump to

Keyboard shortcuts

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