probe

package module
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2025 License: MIT Imports: 25 Imported by: 0

README






PROBE






GitHub Workflow Status GitHub Release Go Documentation

Probe is a YAML-based workflow automation tool. It uses plugin-based actions to execute workflows, making it highly flexible and extensible.

Example using REST API:

name: Example http workflow
jobs:
- name: Request REST API
  defaults:
    http:
      url: http://localhost:9000
      headers:
        authorization: Bearer {env.TOKEN}
        accept: application/json
  steps:
  - name: Get a user information
    uses: http
    with:
      get: /api/v1/me
    test: res.status == 200 && res.body.uname == foobar
  - name: Update user
    uses: http
    with:
      put: /api/v1/users/{steps[0].res.body.uid}
      body:
        profile: "I'm a software engineer living in Fukuoka."
    test: res.status == 201

Example of sending repeated emails:

name: Send queue congestion experiment
jobs:
- name: Normal sender
  id: normal-sender
  repeat:
    count: 60
    interval: 10
  steps:
  - use: smtp
    with:
      addr: localhost:5871
      from: alice@msa1.local
      to: bob@mx1.local
      my-hostname: msa1-local
      subject: Experiment A
- name: Throttled sender
  id: throtteled-sender
  repeat:
    count: 60
    interval: 10
  steps:
  - use: smtp
    with:
      addr: localhost:5872
      from: carol@msa2.local
      to: bob@mx2.local
      my-hostname: msa2-local
      subject: Experiment B
- name: Export latency as CSV
  needs:
  - normal-sender
  - throtteled-sender
  waitif: sh(postqueue -p 2> /dev/null | grep -c '^[A-F0-9]') != "0"
  steps:
  - use: mail-latency
    with:
      spath: /home/vmail
      dpath: ./mail-latency.csv

Features

A probe workflow consists of jobs and steps contained in the jobs. Multiple jobs are executed asynchronously, and steps are executed in sequence. Step execution results are logged, and can be expanded in YAML using curly braces.

  • Workflows can be automated using built-in http, mail, and shell actions
  • Custom actions that meet your use cases can be created using protocol buffers
  • Protocol-based YAML definitions provide low learning costs and high visibility

Install

Installation via various package managers is not yet supported, but will be soon.

go install github.com/linyows/probe/cmd/probe@latest

Usage

Run the workflow by passing the path to the yaml file where the workflow is defined to the workflow option.

probe --workflow ./worflow.yml

To-Do

Here are some additional features I'm considering:

  • Support waitif and needs params in job
  • Support rich output
  • Support multipart/form-data in http actions
  • Support some actions:
    • grpc actions
    • graphql actions
    • ssh actions
    • amqp actions
    • imap actions
    • udp actions
  • Support post-actions
  • Support pre-job and post-job

Author

linyows

Documentation

Index

Constants

View Source
const (
	IconSuccess = "✔︎ "
	IconError   = "✘ "
	IconWarning = "▲ "
	IconCircle  = "⏺ "
	IconWait    = "🕐︎"
	IconSkip    = "⏭ "
)

Icon constants

Variables

View Source
var (
	BuiltinCmd = "builtin-actions"
	Handshake  = plugin.HandshakeConfig{ProtocolVersion: 1, MagicCookieKey: "probe", MagicCookieValue: "actions"}
	PluginMap  = map[string]plugin.Plugin{"actions": &ActionsPlugin{}}
)

Functions

func AnyToString added in v0.4.0

func AnyToString(value any) (string, bool)

AnyToString attempts to convert any type to a string.

func AssignStruct

func AssignStruct(pa ActionsParams, st any) error

func DiffJSON added in v0.4.0

func DiffJSON(src, target map[string]any) string

DiffJSON compares two `map[string]any` objects strictly and collects differences.

func EnvMap added in v0.3.0

func EnvMap() map[string]string

func FlattenInterface

func FlattenInterface(i any) map[string]string

func IsErrorType added in v0.7.0

func IsErrorType(err error, errorType ErrorType) bool

IsErrorType checks if an error is of a specific type

func MapToStructByTags

func MapToStructByTags(params map[string]any, dest any) error

converting from a map[string]any to a struct

func MatchJSON added in v0.4.0

func MatchJSON(src, target map[string]any) bool

MatchJSON compares two `map[string]any` objects strictly. All fields in `src` and `target` must match, including structure and values.

func MergeMaps added in v0.4.0

func MergeMaps(base, over map[string]any) map[string]any

MergeMaps merges two maps of type map[string]any. If keys conflict, the values from over override those in base. Nested maps are merged recursively.

func MergeStringMaps

func MergeStringMaps(base map[string]string, over map[string]any) map[string]string

merge string maps

func RunActions

func RunActions(name string, args []string, with map[string]any, verbose bool) (map[string]any, error)

func StrmapToAnymap added in v0.3.0

func StrmapToAnymap(strmap map[string]string) map[string]any

func StructToMapByTags

func StructToMapByTags(src any) (map[string]any, error)

converting from a struct to a map[string]any

func TitleCase

func TitleCase(st string, char string) string

func UnflattenInterface

func UnflattenInterface(flatMap map[string]string) map[string]any

Recursively convert a map[string]string to a map[string]any

Types

type Actions

type Actions interface {
	Run(args []string, with map[string]string) (map[string]string, error)
}

type ActionsArgs

type ActionsArgs []string

type ActionsClient

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

func (*ActionsClient) Run

func (m *ActionsClient) Run(args []string, with map[string]string) (map[string]string, error)

type ActionsParams

type ActionsParams map[string]string

type ActionsPlugin

type ActionsPlugin struct {
	plugin.Plugin
	Impl Actions
}

func (*ActionsPlugin) GRPCClient

func (p *ActionsPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (any, error)

func (*ActionsPlugin) GRPCServer

func (p *ActionsPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

type ActionsServer

type ActionsServer struct {
	Impl Actions
}

func (*ActionsServer) Run

func (m *ActionsServer) Run(ctx context.Context, req *pb.RunRequest) (*pb.RunResponse, error)

type BufferedJobExecutor added in v0.6.0

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

BufferedJobExecutor handles job execution with buffered output

func NewBufferedJobExecutor added in v0.6.0

func NewBufferedJobExecutor(w *Workflow) *BufferedJobExecutor

NewBufferedJobExecutor creates a new buffered job executor

func (*BufferedJobExecutor) Execute added in v0.6.0

func (e *BufferedJobExecutor) Execute(job *Job, jobID string, ctx JobContext, config ExecutionConfig) ExecutionResult

Execute runs a job with buffered output

type Config

type Config struct {
	Log     io.Writer
	Verbose bool
	RT      bool
	Printer PrintWriter
}

type ErrorType added in v0.7.0

type ErrorType string

ErrorType represents different categories of errors

const (
	ErrorTypeValidation    ErrorType = "validation"
	ErrorTypeExecution     ErrorType = "execution"
	ErrorTypeConfiguration ErrorType = "configuration"
	ErrorTypeNetwork       ErrorType = "network"
	ErrorTypeFile          ErrorType = "file"
	ErrorTypeAction        ErrorType = "action"
	ErrorTypeDependency    ErrorType = "dependency"
)

type ExecutionConfig added in v0.6.0

type ExecutionConfig struct {
	UseBuffering    bool
	UseParallel     bool
	HasDependencies bool
	WorkflowOutput  *WorkflowOutput
	JobScheduler    *JobScheduler
}

ExecutionConfig contains configuration for job execution

type ExecutionResult added in v0.6.0

type ExecutionResult struct {
	Success  bool
	Duration time.Duration
	Output   string
	Error    error
}

ExecutionResult represents the result of a job execution

type Expr added in v0.2.0

type Expr struct{}

func (*Expr) Eval added in v0.3.0

func (e *Expr) Eval(input string, env any) (any, error)

func (*Expr) EvalOrEvalTemplate added in v0.4.0

func (e *Expr) EvalOrEvalTemplate(input string, env any) (string, error)

func (*Expr) EvalTemplate added in v0.2.0

func (e *Expr) EvalTemplate(input string, env any) (string, error)

func (*Expr) EvalTemplateMap added in v0.4.0

func (e *Expr) EvalTemplateMap(input map[string]any, env any) map[string]any

func (*Expr) Options added in v0.4.0

func (e *Expr) Options(env any) []ex.Option

type Interval added in v0.6.0

type Interval struct {
	time.Duration
}

Interval represents a time interval that can be specified as a number (seconds) or duration string

func (Interval) MarshalYAML added in v0.6.0

func (i Interval) MarshalYAML() (interface{}, error)

MarshalYAML implements custom YAML marshaling for Interval

func (*Interval) UnmarshalYAML added in v0.6.0

func (i *Interval) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements custom YAML unmarshaling for Interval

type Job

type Job struct {
	Name     string   `yaml:"name" validate:"required"`
	ID       string   `yaml:"id,omitempty"`
	Needs    []string `yaml:"needs,omitempty"`
	Steps    []*Step  `yaml:"steps" validate:"required"`
	Repeat   *Repeat  `yaml:"repeat"`
	Defaults any      `yaml:"defaults"`
	// contains filtered or unexported fields
}

func (*Job) Start

func (j *Job) Start(ctx JobContext) error

type JobContext

type JobContext struct {
	Vars map[string]any   `expr:"vars"`
	Logs []map[string]any `expr:"steps"`
	Config
	Failed bool
	// Repeat tracking
	IsRepeating   bool
	RepeatCurrent int
	RepeatTotal   int
	StepCounters  map[int]StepRepeatCounter // step index -> counter
	// Output buffering
	UseBuffering bool
	// Print writer
	Printer PrintWriter
	// Shared outputs across all jobs (accessible via expressions as "outputs")
	Outputs *Outputs `expr:"outputs"`
}

func (*JobContext) SetFailed added in v0.2.0

func (j *JobContext) SetFailed()

type JobExecutor added in v0.6.0

type JobExecutor interface {
	Execute(job *Job, jobID string, ctx JobContext, config ExecutionConfig) ExecutionResult
}

JobExecutor defines the interface for executing jobs

type JobOutput added in v0.6.0

type JobOutput struct {
	JobName   string
	JobID     string
	Buffer    strings.Builder
	Status    string
	StartTime time.Time
	EndTime   time.Time
	Success   bool
	// contains filtered or unexported fields
}

JobOutput stores buffered output for a job

type JobScheduler added in v0.5.0

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

func NewJobScheduler added in v0.5.0

func NewJobScheduler() *JobScheduler

func (*JobScheduler) AddJob added in v0.5.0

func (js *JobScheduler) AddJob(job *Job) error

func (*JobScheduler) AllJobsCompleted added in v0.5.0

func (js *JobScheduler) AllJobsCompleted() bool

func (*JobScheduler) CanRunJob added in v0.5.0

func (js *JobScheduler) CanRunJob(jobID string) bool

func (*JobScheduler) GetRepeatInfo added in v0.5.0

func (js *JobScheduler) GetRepeatInfo(jobID string) (current, target int)

GetRepeatInfo returns current repeat counter and target for a job

func (*JobScheduler) GetRunnableJobs added in v0.5.0

func (js *JobScheduler) GetRunnableJobs() []string

func (*JobScheduler) IncrementRepeatCounter added in v0.5.0

func (js *JobScheduler) IncrementRepeatCounter(jobID string)

IncrementRepeatCounter increments the repeat counter for a job

func (*JobScheduler) MarkJobsWithFailedDependencies added in v0.6.0

func (js *JobScheduler) MarkJobsWithFailedDependencies() []string

MarkJobsWithFailedDependencies marks jobs as failed if their dependencies have failed

func (*JobScheduler) SetJobStatus added in v0.5.0

func (js *JobScheduler) SetJobStatus(jobID string, status JobStatus, success bool)

func (*JobScheduler) ShouldRepeatJob added in v0.5.0

func (js *JobScheduler) ShouldRepeatJob(jobID string) bool

ShouldRepeatJob checks if a job should be repeated

func (*JobScheduler) ValidateDependencies added in v0.5.0

func (js *JobScheduler) ValidateDependencies() error

type JobStatus added in v0.5.0

type JobStatus int
const (
	JobPending JobStatus = iota
	JobRunning
	JobCompleted
	JobFailed
)

type LogLevel added in v0.7.0

type LogLevel int

LogLevel defines different logging levels

const (
	LogLevelDebug LogLevel = iota
	LogLevelInfo
	LogLevelWarn
	LogLevelError
)

type Outputs added in v0.7.0

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

Outputs manages step outputs across the entire workflow

func NewOutputs added in v0.7.0

func NewOutputs() *Outputs

NewOutputs creates a new Outputs instance

func (*Outputs) Get added in v0.7.0

func (o *Outputs) Get(stepID string) (map[string]any, bool)

Get retrieves outputs for a step

func (*Outputs) GetAll added in v0.7.0

func (o *Outputs) GetAll() map[string]map[string]any

GetAll returns all outputs (safe copy for expression evaluation)

func (*Outputs) Set added in v0.7.0

func (o *Outputs) Set(stepID string, outputs map[string]any)

Set stores outputs for a step

type ParallelJobExecutor added in v0.6.0

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

ParallelJobExecutor handles parallel job execution without dependencies

func NewParallelJobExecutor added in v0.6.0

func NewParallelJobExecutor(w *Workflow) *ParallelJobExecutor

NewParallelJobExecutor creates a new parallel job executor

func (*ParallelJobExecutor) Execute added in v0.6.0

func (e *ParallelJobExecutor) Execute(job *Job, jobID string, ctx JobContext, config ExecutionConfig) ExecutionResult

Execute runs a job in parallel mode

type PrintWriter added in v0.7.0

type PrintWriter interface {
	// Workflow level output
	PrintWorkflowHeader(name, description string)
	PrintJobName(name string)

	// Step level output
	PrintStepResult(step StepResult)
	PrintStepRepeatStart(stepIdx int, stepName string, repeatCount int)
	PrintStepRepeatResult(stepIdx int, counter StepRepeatCounter, hasTest bool)

	// Job level output
	PrintJobResult(jobName string, status StatusType, duration float64)
	PrintJobOutput(output string)

	// Workflow summary
	PrintWorkflowSummary(totalTime float64, successCount, totalJobs int)

	// Error output
	PrintError(format string, args ...interface{})

	// Verbose output
	PrintVerbose(format string, args ...interface{})
	PrintSeparator()

	// Unified logging methods
	LogDebug(format string, args ...interface{})
	LogInfo(format string, args ...interface{})
	LogWarn(format string, args ...interface{})
	LogError(format string, args ...interface{})
}

PrintWriter defines the interface for different print implementations

type Printer added in v0.7.0

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

Printer implements PrintWriter for console print

func NewPrinter added in v0.7.0

func NewPrinter(verbose bool) *Printer

NewPrinter creates a new console print writer

func (*Printer) LogDebug added in v0.7.0

func (p *Printer) LogDebug(format string, args ...interface{})

LogDebug prints debug messages (only in verbose mode)

func (*Printer) LogError added in v0.7.0

func (p *Printer) LogError(format string, args ...interface{})

LogError prints error messages to stderr

func (*Printer) LogInfo added in v0.7.0

func (p *Printer) LogInfo(format string, args ...interface{})

LogInfo prints informational messages

func (*Printer) LogWarn added in v0.7.0

func (p *Printer) LogWarn(format string, args ...interface{})

LogWarn prints warning messages to stderr

func (*Printer) PrintError added in v0.7.0

func (p *Printer) PrintError(format string, args ...interface{})

PrintError prints an error message

func (*Printer) PrintJobName added in v0.7.0

func (p *Printer) PrintJobName(name string)

PrintJobName prints the job name

func (*Printer) PrintJobOutput added in v0.7.0

func (p *Printer) PrintJobOutput(output string)

PrintJobOutput prints buffered job output

func (*Printer) PrintJobResult added in v0.7.0

func (p *Printer) PrintJobResult(jobName string, status StatusType, duration float64)

PrintJobResult prints the result of a job execution

func (*Printer) PrintSeparator added in v0.7.0

func (p *Printer) PrintSeparator()

PrintSeparator prints a separator line for verbose output

func (*Printer) PrintStepRepeatResult added in v0.7.0

func (p *Printer) PrintStepRepeatResult(stepIdx int, counter StepRepeatCounter, hasTest bool)

PrintStepRepeatResult prints the final result of a repeated step execution

func (*Printer) PrintStepRepeatStart added in v0.7.0

func (p *Printer) PrintStepRepeatStart(stepIdx int, stepName string, repeatCount int)

PrintStepRepeatStart prints the start of a repeated step execution

func (*Printer) PrintStepResult added in v0.7.0

func (p *Printer) PrintStepResult(step StepResult)

PrintStepResult prints the result of a single step execution

func (*Printer) PrintVerbose added in v0.7.0

func (p *Printer) PrintVerbose(format string, args ...interface{})

PrintVerbose prints verbose output (only if verbose mode is enabled)

func (*Printer) PrintWorkflowHeader added in v0.7.0

func (p *Printer) PrintWorkflowHeader(name, description string)

PrintWorkflowHeader prints the workflow name and description

func (*Printer) PrintWorkflowSummary added in v0.7.0

func (p *Printer) PrintWorkflowSummary(totalTime float64, successCount, totalJobs int)

PrintWorkflowSummary prints the workflow execution summary

type Probe

type Probe struct {
	FilePath string

	Config Config
	// contains filtered or unexported fields
}

func New

func New(path string, v bool) *Probe

func NewWithPrinter added in v0.7.0

func NewWithPrinter(path string, v bool, printer PrintWriter) *Probe

NewWithPrinter creates a new Probe with a custom PrintWriter (useful for testing)

func (*Probe) Do

func (p *Probe) Do() error

func (*Probe) ExitStatus added in v0.2.0

func (p *Probe) ExitStatus() int

func (*Probe) Load

func (p *Probe) Load() error

type ProbeError added in v0.7.0

type ProbeError struct {
	Type      ErrorType
	Operation string
	Message   string
	Cause     error
	Context   map[string]interface{}
}

ProbeError is the base error type with context information

func NewActionError added in v0.7.0

func NewActionError(operation, message string, cause error) *ProbeError

func NewConfigurationError added in v0.7.0

func NewConfigurationError(operation, message string, cause error) *ProbeError

func NewDependencyError added in v0.7.0

func NewDependencyError(operation, message string, cause error) *ProbeError

func NewExecutionError added in v0.7.0

func NewExecutionError(operation, message string, cause error) *ProbeError

func NewFileError added in v0.7.0

func NewFileError(operation, message string, cause error) *ProbeError

func NewNetworkError added in v0.7.0

func NewNetworkError(operation, message string, cause error) *ProbeError

func NewProbeError added in v0.7.0

func NewProbeError(errorType ErrorType, operation, message string, cause error) *ProbeError

NewProbeError creates a new ProbeError

func NewValidationError added in v0.7.0

func NewValidationError(operation, message string, cause error) *ProbeError

Convenience functions for creating specific error types

func (*ProbeError) Error added in v0.7.0

func (e *ProbeError) Error() string

func (*ProbeError) Is added in v0.7.0

func (e *ProbeError) Is(target error) bool

func (*ProbeError) Unwrap added in v0.7.0

func (e *ProbeError) Unwrap() error

func (*ProbeError) WithContext added in v0.7.0

func (e *ProbeError) WithContext(key string, value interface{}) *ProbeError

WithContext adds context information to the error

type Repeat

type Repeat struct {
	Count    int      `yaml:"count" validate:"required,gte=0,lt=100"`
	Interval Interval `yaml:"interval"`
}

Repeat defines the repeat configuration for jobs

type SequentialJobExecutor added in v0.6.0

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

SequentialJobExecutor handles sequential job execution with dependencies

func NewSequentialJobExecutor added in v0.6.0

func NewSequentialJobExecutor(w *Workflow) *SequentialJobExecutor

NewSequentialJobExecutor creates a new sequential job executor

func (*SequentialJobExecutor) Execute added in v0.6.0

func (e *SequentialJobExecutor) Execute(job *Job, jobID string, ctx JobContext, config ExecutionConfig) ExecutionResult

Execute runs a job in sequential mode with dependency management

type SilentPrinter added in v0.7.0

type SilentPrinter struct{}

SilentPrinter is a no-op implementation of PrintWriter for testing

func NewSilentPrinter added in v0.7.0

func NewSilentPrinter() *SilentPrinter

NewSilentPrinter creates a new silent print writer for testing

func (*SilentPrinter) LogDebug added in v0.7.0

func (s *SilentPrinter) LogDebug(format string, args ...interface{})

LogDebug does nothing in silent mode

func (*SilentPrinter) LogError added in v0.7.0

func (s *SilentPrinter) LogError(format string, args ...interface{})

LogError does nothing in silent mode

func (*SilentPrinter) LogInfo added in v0.7.0

func (s *SilentPrinter) LogInfo(format string, args ...interface{})

LogInfo does nothing in silent mode

func (*SilentPrinter) LogWarn added in v0.7.0

func (s *SilentPrinter) LogWarn(format string, args ...interface{})

LogWarn does nothing in silent mode

func (*SilentPrinter) PrintError added in v0.7.0

func (s *SilentPrinter) PrintError(format string, args ...interface{})

PrintError does nothing in silent mode

func (*SilentPrinter) PrintJobName added in v0.7.0

func (s *SilentPrinter) PrintJobName(name string)

PrintJobName does nothing in silent mode

func (*SilentPrinter) PrintJobOutput added in v0.7.0

func (s *SilentPrinter) PrintJobOutput(output string)

PrintJobOutput does nothing in silent mode

func (*SilentPrinter) PrintJobResult added in v0.7.0

func (s *SilentPrinter) PrintJobResult(jobName string, status StatusType, duration float64)

PrintJobResult does nothing in silent mode

func (*SilentPrinter) PrintSeparator added in v0.7.0

func (s *SilentPrinter) PrintSeparator()

PrintSeparator does nothing in silent mode

func (*SilentPrinter) PrintStepRepeatResult added in v0.7.0

func (s *SilentPrinter) PrintStepRepeatResult(stepIdx int, counter StepRepeatCounter, hasTest bool)

PrintStepRepeatResult does nothing in silent mode

func (*SilentPrinter) PrintStepRepeatStart added in v0.7.0

func (s *SilentPrinter) PrintStepRepeatStart(stepIdx int, stepName string, repeatCount int)

PrintStepRepeatStart does nothing in silent mode

func (*SilentPrinter) PrintStepResult added in v0.7.0

func (s *SilentPrinter) PrintStepResult(step StepResult)

PrintStepResult does nothing in silent mode

func (*SilentPrinter) PrintVerbose added in v0.7.0

func (s *SilentPrinter) PrintVerbose(format string, args ...interface{})

PrintVerbose does nothing in silent mode

func (*SilentPrinter) PrintWorkflowHeader added in v0.7.0

func (s *SilentPrinter) PrintWorkflowHeader(name, description string)

PrintWorkflowHeader does nothing in silent mode

func (*SilentPrinter) PrintWorkflowSummary added in v0.7.0

func (s *SilentPrinter) PrintWorkflowSummary(totalTime float64, successCount, totalJobs int)

PrintWorkflowSummary does nothing in silent mode

type StatusType added in v0.6.0

type StatusType int

StatusType represents the status of execution

const (
	StatusSuccess StatusType = iota
	StatusError
	StatusWarning
	StatusSkipped
)

type Step

type Step struct {
	Name    string            `yaml:"name"`
	ID      string            `yaml:"id,omitempty"`
	Uses    string            `yaml:"uses" validate:"required"`
	With    map[string]any    `yaml:"with"`
	Test    string            `yaml:"test"`
	Echo    string            `yaml:"echo"`
	Vars    map[string]any    `yaml:"vars"`
	Iter    []map[string]any  `yaml:"iter"`
	Wait    string            `yaml:"wait,omitempty"`
	SkipIf  string            `yaml:"skipif,omitempty"`
	Outputs map[string]string `yaml:"outputs,omitempty"`
	// contains filtered or unexported fields
}

func (*Step) Do added in v0.5.0

func (st *Step) Do(jCtx *JobContext)

func (*Step) DoEcho added in v0.5.0

func (st *Step) DoEcho(jCtx *JobContext)

func (*Step) DoEchoWithSequentialPrint added in v0.5.0

func (st *Step) DoEchoWithSequentialPrint(jCtx *JobContext)

func (*Step) DoTest added in v0.5.0

func (st *Step) DoTest() (string, bool)

func (*Step) DoTestWithSequentialPrint added in v0.5.0

func (st *Step) DoTestWithSequentialPrint(jCtx *JobContext) bool

func (*Step) SetCtx added in v0.4.0

func (st *Step) SetCtx(j JobContext, override map[string]any)

func (*Step) ShowRequestResponse added in v0.5.0

func (st *Step) ShowRequestResponse(name string, jCtx *JobContext)

type StepContext added in v0.5.0

type StepContext struct {
	Vars    map[string]any            `expr:"vars"`
	Logs    []map[string]any          `expr:"steps"`
	Res     map[string]any            `expr:"res"`
	Req     map[string]any            `expr:"req"`
	RT      string                    `expr:"rt"`
	Outputs map[string]map[string]any `expr:"outputs"`
}

type StepRepeatCounter added in v0.6.0

type StepRepeatCounter struct {
	SuccessCount int
	FailureCount int
	Name         string
	LastResult   bool
	Output       strings.Builder
}

StepRepeatCounter tracks the execution results of repeated steps

type StepResult added in v0.6.0

type StepResult struct {
	Index      int
	Name       string
	Status     StatusType
	RT         string
	WaitTime   string
	TestOutput string
	EchoOutput string
	HasTest    bool
}

StepResult represents the result of a step execution

type ValidationError

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

ValidationError for validation-specific errors

func (*ValidationError) AddMessage

func (e *ValidationError) AddMessage(s string)

func (*ValidationError) Error

func (e *ValidationError) Error() string

func (*ValidationError) HasError

func (e *ValidationError) HasError() bool

type Workflow

type Workflow struct {
	Name        string         `yaml:"name" validate:"required"`
	Description string         `yaml:"description,omitempty"`
	Jobs        []Job          `yaml:"jobs" validate:"required"`
	Vars        map[string]any `yaml:"vars"`
	// contains filtered or unexported fields
}

func (*Workflow) Env added in v0.3.0

func (w *Workflow) Env() map[string]string

func (*Workflow) SetExitStatus added in v0.2.0

func (w *Workflow) SetExitStatus(isErr bool)

func (*Workflow) Start

func (w *Workflow) Start(c Config) error

Start executes the workflow with the given configuration

type WorkflowOutput added in v0.6.0

type WorkflowOutput struct {
	Jobs map[string]*JobOutput
	// contains filtered or unexported fields
}

WorkflowOutput manages output for multiple jobs

func NewWorkflowOutput added in v0.6.0

func NewWorkflowOutput() *WorkflowOutput

NewWorkflowOutput creates a new WorkflowOutput instance

Directories

Path Synopsis
actions
cmd
probe command

Jump to

Keyboard shortcuts

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