runners

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ColorReset   = "\033[0m"
	ColorRed     = "\033[31m"   // Red for errors
	ColorGreen   = "\033[32m"   // Green for success (subtle)
	ColorYellow  = "\033[33m"   // Yellow for warnings
	ColorBlue    = "\033[34m"   // Blue for info
	ColorGray    = "\033[90m"   // Gray for secondary info
	ColorDimGray = "\033[2;37m" // Dim gray for less important
	ColorBold    = "\033[1m"    // Bold
	ColorDim     = "\033[2m"    // Dim

	// Additional muted colors
	ColorDarkBlue  = "\033[34;2m" // Darker blue
	ColorDarkGray  = "\033[1;30m" // Dark gray
	ColorLightGray = "\033[37m"   // Light gray
)

ANSI color codes - subtle/muted versions

Variables

This section is empty.

Functions

This section is empty.

Types

type BashRunner

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

func NewBashRunner

func NewBashRunner(cfg *config.RunnerConfig) *BashRunner

NewBashRunner creates a new bash runner with configuration. If cfg.Quiet is true, the package-level quiet redirect is acquired so any direct fmt.Printf / io.Copy(os.Stdout, ...) writes are swallowed; the redirect is restored by Cleanup.

func (*BashRunner) Cleanup

func (r *BashRunner) Cleanup() error

func (*BashRunner) GetRunnerType

func (r *BashRunner) GetRunnerType() types.RunnerType

GetRunnerType returns the type of this runner

func (*BashRunner) RunJob

func (r *BashRunner) RunJob(job *types.Job, workdir string) error

func (*BashRunner) RunStep

func (r *BashRunner) RunStep(step *types.Step, env map[string]string, workdir string) error

type DockerRunner

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

func NewDockerRunner

func NewDockerRunner(cfg *config.RunnerConfig) (*DockerRunner, error)

NewDockerRunner creates a new Docker runner. If cfg.Quiet is true, the package-level quiet redirect is acquired so any direct fmt.Printf (in createContainer / dryRunJob verbose branches) or stdcopy.StdCopy writes (in streamLogs) are swallowed; Cleanup restores it.

func (*DockerRunner) Cleanup

func (r *DockerRunner) Cleanup() error

func (*DockerRunner) GetRunnerType

func (r *DockerRunner) GetRunnerType() types.RunnerType

GetRunnerType returns the type of this runner

func (*DockerRunner) RunJob

func (r *DockerRunner) RunJob(job *types.Job, workdir string) error

func (*DockerRunner) RunStep

func (r *DockerRunner) RunStep(step *types.Step, env map[string]string, workdir string) error

type IndentLevel

type IndentLevel int

IndentLevel represents the current indentation level

const (
	IndentNone   IndentLevel = 0
	IndentJob    IndentLevel = 1
	IndentStep   IndentLevel = 2
	IndentDetail IndentLevel = 3
	IndentOutput IndentLevel = 4
)

type JobSummary

type JobSummary struct {
	JobName        string
	TotalSteps     int
	CompletedSteps int
	FailedSteps    int
	SkippedSteps   int
	Duration       time.Duration
	Success        bool
	Errors         []string
}

JobSummary represents a summary of job execution (in order to track the execution of job)

type OutputFormatter

type OutputFormatter struct {
	Verbose    bool
	Quiet      bool
	Width      int
	UseColor   bool
	IndentSize int
}

OutputFormatter provides consistent output formatting for all runners

func NewOutputFormatter

func NewOutputFormatter(verbose bool) *OutputFormatter

NewOutputFormatter creates a new output formatter

func (*OutputFormatter) Color

func (f *OutputFormatter) Color(text string, color string) string

Color applies color to text if colors are enabled

func (*OutputFormatter) FormatDuration

func (f *OutputFormatter) FormatDuration(d time.Duration) string

FormatDuration formats a duration in a human-readable way

func (*OutputFormatter) GetIndent

func (f *OutputFormatter) GetIndent(level IndentLevel) string

GetIndent returns the indentation string for a given level

func (*OutputFormatter) IsColorEnabled

func (f *OutputFormatter) IsColorEnabled() bool

IsColorEnabled returns whether colors are enabled

func (*OutputFormatter) Line

func (f *OutputFormatter) Line(char rune) string

Line generates a line of the specified character

func (*OutputFormatter) NewProgress

func (f *OutputFormatter) NewProgress(message string) *Progress

NewProgress creates a new progress indicator

func (*OutputFormatter) NewProgressWithLevel

func (f *OutputFormatter) NewProgressWithLevel(message string, level IndentLevel) *Progress

NewProgressWithLevel creates a new progress indicator at specific indent level

func (*OutputFormatter) PrintCommand

func (f *OutputFormatter) PrintCommand(cmd string, indent int)

PrintCommand prints a command that will be or was executed

func (*OutputFormatter) PrintCommandWithLevel

func (f *OutputFormatter) PrintCommandWithLevel(cmd string, level IndentLevel)

PrintCommandWithLevel prints a command at specific indent level

func (*OutputFormatter) PrintDebug

func (f *OutputFormatter) PrintDebug(message string)

PrintDebug prints a debug message if verbose mode is enabled

func (*OutputFormatter) PrintDryRun

func (f *OutputFormatter) PrintDryRun()

PrintDryRun prints dry run header

func (*OutputFormatter) PrintEnvironment

func (f *OutputFormatter) PrintEnvironment(env map[string]string)

PrintEnvironment prints environment variables in a formatted way

func (*OutputFormatter) PrintError

func (f *OutputFormatter) PrintError(message string)

PrintError prints an error message

func (*OutputFormatter) PrintHeader

func (f *OutputFormatter) PrintHeader(jobName, workdir, runner string)

PrintHeader prints the job execution header

func (*OutputFormatter) PrintInfo

func (f *OutputFormatter) PrintInfo(message string)

PrintInfo prints an informational message

func (*OutputFormatter) PrintJobComplete

func (f *OutputFormatter) PrintJobComplete(jobName string, duration time.Duration, success bool)

PrintJobComplete prints job completion summary

func (*OutputFormatter) PrintJobSummary

func (f *OutputFormatter) PrintJobSummary(summary *JobSummary)

PrintJobSummary prints a detailed job summary

func (*OutputFormatter) PrintKeyValue

func (f *OutputFormatter) PrintKeyValue(key, value string, indent int)

PrintKeyValue prints a key-value pair with proper indentation

func (*OutputFormatter) PrintKeyValueWithLevel

func (f *OutputFormatter) PrintKeyValueWithLevel(key, value string, level IndentLevel)

PrintKeyValueWithLevel prints a key-value pair at specific indent level

func (*OutputFormatter) PrintList

func (f *OutputFormatter) PrintList(item string, indent int)

PrintList prints a list item with proper indentation

func (*OutputFormatter) PrintListWithLevel

func (f *OutputFormatter) PrintListWithLevel(item string, level IndentLevel)

PrintListWithLevel prints a list item at specific indent level

func (*OutputFormatter) PrintOutput

func (f *OutputFormatter) PrintOutput(line string, indent int)

PrintOutput prints command output with optional prefix and indentation

func (*OutputFormatter) PrintOutputWithLevel

func (f *OutputFormatter) PrintOutputWithLevel(line string, level IndentLevel)

PrintOutputWithLevel prints output with specific indent level

func (*OutputFormatter) PrintSection

func (f *OutputFormatter) PrintSection(title string)

PrintSection prints a section header

func (*OutputFormatter) PrintServices

func (f *OutputFormatter) PrintServices(services map[string]string)

PrintServices prints service information

func (*OutputFormatter) PrintStepComplete

func (f *OutputFormatter) PrintStepComplete(duration time.Duration)

PrintStepComplete prints step completion

func (*OutputFormatter) PrintStepFailed

func (f *OutputFormatter) PrintStepFailed(err error, duration time.Duration)

PrintStepFailed prints step failure

func (*OutputFormatter) PrintStepHeader

func (f *OutputFormatter) PrintStepHeader(stepName string, current, total int)

PrintStepHeader prints a step header with progress

func (*OutputFormatter) PrintStepResult

func (f *OutputFormatter) PrintStepResult(result *StepResult, current, total int)

PrintStepResult prints a formatted step result

func (*OutputFormatter) PrintStepSkipped

func (f *OutputFormatter) PrintStepSkipped(reason string)

PrintStepSkipped prints that a step was skipped

func (*OutputFormatter) PrintSubSection

func (f *OutputFormatter) PrintSubSection(title string)

PrintSubSection prints a subsection with indent

func (*OutputFormatter) PrintWarning

func (f *OutputFormatter) PrintWarning(message string)

PrintWarning prints a warning message

func (*OutputFormatter) SetColorEnabled

func (f *OutputFormatter) SetColorEnabled(enabled bool)

SetColorEnabled enables or disables color output

func (*OutputFormatter) SetQuiet added in v0.4.0

func (f *OutputFormatter) SetQuiet(quiet bool)

SetQuiet enables or disables non-essential output. When true, formatter Print* methods (except PrintError / PrintStepFailed) become no-ops.

func (*OutputFormatter) TruncateText

func (f *OutputFormatter) TruncateText(text string, width int) string

TruncateText truncates text to fit within the specified width

func (*OutputFormatter) WrapText

func (f *OutputFormatter) WrapText(text string, width int) []string

WrapText wraps text to fit within the specified width

type PodmanRunner

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

PodmanRunner executes jobs using Podman CLI (lightweight, no SDK dependencies)

func NewPodmanRunner

func NewPodmanRunner(cfg *config.RunnerConfig) (*PodmanRunner, error)

NewPodmanRunner creates a new Podman runner using CLI commands. If cfg.Quiet is true, the package-level quiet redirect is acquired so any direct fmt.Printf (dryRunJob) or io.Copy(os.Stdout, ...) writes (streamLogs) are swallowed; Cleanup restores it.

func (*PodmanRunner) Cleanup

func (r *PodmanRunner) Cleanup() error

Cleanup removes containers and pods. The quiet redirect acquired by the constructor is released at the END of Cleanup so any subprocess teardown output (podman rm / podman pod rm / etc.) still hits /dev/null while Quiet=true. Cleanup is idempotent: callers may invoke it multiple times.

func (*PodmanRunner) GetRunnerType

func (r *PodmanRunner) GetRunnerType() types.RunnerType

GetRunnerType returns the runner type

func (*PodmanRunner) RunJob

func (r *PodmanRunner) RunJob(job *types.Job, workdir string) error

RunJob executes a job using Podman/Docker CLI

func (*PodmanRunner) RunStep

func (r *PodmanRunner) RunStep(step *types.Step, env map[string]string, workdir string) error

RunStep implements Runner interface

type Progress

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

Progress shows a progress indicator for long-running operations

func (*Progress) Complete

func (p *Progress) Complete(success bool)

Complete marks the progress as complete

func (*Progress) Update

func (p *Progress) Update(message string)

Update updates the progress message

type StepResult

type StepResult struct {
	Name     string
	Success  bool
	Skipped  bool
	Duration time.Duration
	Output   string
	Error    error
}

StepResult represents the result of a step execution

Jump to

Keyboard shortcuts

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