probe

package module
v0.11.0 Latest Latest
Warning

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

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

README

English | 日本語







PROBE







GitHub Workflow Status GitHub Release Go Documentation Deepwiki Documentation

A powerful YAML-based workflow automation tool designed for testing, monitoring, and automation tasks. Probe uses plugin-based actions to execute workflows, making it highly flexible and extensible.

Quick Start

name: API Health Check
jobs:
- name: Check API Status
  steps:
  - name: Ping API
    uses: http
    with:
      url: https://api.example.com
      get: /health
    test: res.code == 200
probe --workflow health-check.yml

Features

  • Simple YAML Syntax: Easy-to-read workflow definitions
  • Plugin Architecture: Built-in HTTP, SMTP, and Hello actions with extensibility
  • Job Dependencies: Control execution order with needs
  • Step Outputs: Share data between steps and jobs using outputs
  • Repetition: Repeat jobs with configurable intervals
  • Iteration: Execute steps with different variable sets
  • Expression Engine: Powerful templating and condition evaluation
  • Testing Support: Built-in assertion system
  • Timing Controls: Wait conditions and delays
  • Rich Output: Buffered, consistent output formatting
  • Security: Safe expression evaluation with timeout protection

Installation

Using Go

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

From Source

git clone https://github.com/linyows/probe.git
cd probe
go build -o probe ./cmd/probe

Usage

Basic Usage

# Run a workflow
probe --workflow ./workflow.yml

# Verbose output
probe --workflow ./workflow.yml --verbose

# Show response times
probe --workflow ./workflow.yml --rt

CLI Options

  • --workflow <path>: Specify YAML workflow file
  • --verbose: Enable detailed output
  • --rt: Show response times
  • --help: Show help information

Workflow Syntax

Basic Structure

name: Workflow Name
description: Optional description
vars:
  global_var: value
jobs:
- name: Job Name
  steps:
  - name: Step Name
    uses: action_name
    with:
      param: value

Jobs

Jobs are executed in parallel by default. Use needs for dependencies:

jobs:
- name: Setup
  id: setup
  steps:
  - name: Initialize
    uses: http
    with:
      post: /setup

- name: Test
  needs: [setup]  # Wait for setup to complete
  steps:
  - name: Run test
    uses: http
    with:
      get: /test

Steps

Steps within a job execute sequentially:

steps:
- name: Login
  id: login
  uses: http
  with:
    post: /auth/login
    body:
      username: admin
      password: secret
  outputs:
    token: res.body.token

- name: Get Profile
  uses: http
  with:
    get: /profile
    headers:
      authorization: "Bearer {{outputs.login.token}}"
  test: res.code == 200

Variables and Expressions

Use {{expression}} syntax for dynamic values:

vars:
  api_url: https://api.example.com
  user_id: 123

steps:
- name: Get User
  uses: http
  with:
    url: "{{vars.api_url}}"
    get: "/users/{{vars.user_id}}"
  test: res.body.id == vars.user_id

Built-in Functions

test: |
  res.code == 200 &&
  match_json(res.body, vars.expected) &&
  random_int(10) > 5

Available functions:

  • match_json(actual, expected): JSON pattern matching with regex support
  • diff_json(actual, expected): Show differences between JSON objects
  • random_int(max): Generate random integer
  • random_str(length): Generate random string
  • unixtime(): Current Unix timestamp

Output Management

Share data between steps and jobs:

- name: Get Token
  id: auth
  uses: http
  with:
    post: /auth
  outputs:
    token: res.body.access_token
    expires: res.body.expires_in

- name: Use Token
  uses: http
  with:
    get: /protected
    headers:
      authorization: "Bearer {{outputs.auth.token}}"

Iteration

Execute steps with different variable sets:

- name: Test Multiple Users
  uses: http
  with:
    post: /users
    body:
      name: "{{vars.name}}"
      role: "{{vars.role}}"
  test: res.code == 201
  iter:
  - {name: "Alice", role: "admin"}
  - {name: "Bob", role: "user"}
  - {name: "Carol", role: "editor"}

Job Repetition

Repeat entire jobs with intervals:

- name: Health Check
  repeat:
    count: 10
    interval: 30s
  steps:
  - name: Ping
    uses: http
    with:
      get: /health
    test: res.code == 200

Conditional Execution

Skip steps based on conditions:

- name: Conditional Step
  uses: http
  with:
    get: /api/data
  skipif: vars.skip_test == true
  test: res.code == 200

Timing and Delays

- name: Wait and Check
  uses: http
  with:
    get: /status
  wait: 5s  # Wait before execution
  test: res.code == 200

Built-in Actions

HTTP Action

- name: HTTP Request
  uses: http
  with:
    url: https://api.example.com
    method: POST  # GET, POST, PUT, DELETE, etc.
    headers:
      content-type: application/json
      authorization: Bearer token
    body:
      key: value
    timeout: 30s

SMTP Action

- name: Send Email
  uses: smtp
  with:
    addr: smtp.example.com:587
    from: sender@example.com
    to: recipient@example.com
    subject: Test Email
    body: Email content
    my-hostname: localhost

Hello Action (Testing)

- name: Test Action
  uses: hello
  with:
    name: World

Advanced Examples

REST API Testing

name: User API Test
vars:
  base_url: https://api.example.com
  admin_token: "{{env.ADMIN_TOKEN}}"

jobs:
- name: User CRUD Operations
  defaults:
    http:
      url: "{{vars.base_url}}"
      headers:
        authorization: "Bearer {{vars.admin_token}}"
        content-type: application/json

  steps:
  - name: Create User
    id: create
    uses: http
    with:
      post: /users
      body:
        name: Test User
        email: test@example.com
    test: res.code == 201
    outputs:
      user_id: res.body.id

  - name: Get User
    uses: http
    with:
      get: "/users/{{outputs.create.user_id}}"
    test: |
      res.code == 200 &&
      res.body.name == "Test User"

  - name: Update User
    uses: http
    with:
      put: "/users/{{outputs.create.user_id}}"
      body:
        name: Updated User
    test: res.code == 200

  - name: Delete User
    uses: http
    with:
      delete: "/users/{{outputs.create.user_id}}"
    test: res.code == 204

Load Testing with Repetition

name: Load Test
jobs:
- name: Concurrent Requests
  repeat:
    count: 100
    interval: 100ms
  steps:
  - name: API Call
    uses: http
    with:
      url: https://api.example.com
      get: /endpoint
    test: res.code == 200

Multi-Service Integration

name: E2E Test
jobs:
- name: Setup Database
  id: db-setup
  steps:
  - name: Initialize
    uses: http
    with:
      post: http://db-service/init

- name: API Tests
  needs: [db-setup]
  steps:
  - name: Test API
    uses: http
    with:
      get: http://api-service/data
    test: res.code == 200

- name: Cleanup
  needs: [db-setup]
  steps:
  - name: Reset Database
    uses: http
    with:
      post: http://db-service/reset

Expression Reference

Context Variables

  • vars.*: Workflow and step variables
  • env.*: Environment variables
  • res.*: Previous step response
  • req.*: Previous step request
  • outputs.*: Step outputs
  • steps[i].*: Historical step data

Response Object

res:
  code: 200
  status: "200 OK"
  headers:
    content-type: application/json
  body: {...}  # Parsed JSON or raw string
  rawbody: "..." # Original response body

Operators

  • Arithmetic: +, -, *, /, %
  • Comparison: ==, !=, <, <=, >, >=
  • Logical: &&, ||, !
  • Ternary: condition ? true_value : false_value

Extending Probe

Probe supports custom actions through Protocol Buffers. Create your own actions to extend functionality beyond the built-in HTTP, SMTP, and Hello actions.

Configuration

Environment Variables

  • PROBE_*: Custom environment variables accessible via env.*

Defaults

Use YAML anchors for common configurations:

x_defaults: &api_defaults
  http:
    url: https://api.example.com
    headers:
      authorization: Bearer token

jobs:
- name: Test Job
  defaults: *api_defaults

Troubleshooting

Common Issues

Expression Evaluation Errors

  • Check syntax: {{expression}} not {expression}
  • Verify variable names and paths
  • Use quotes around string values

HTTP Action Issues

  • Verify URL format and accessibility
  • Check headers and authentication
  • Review timeout settings

Job Dependencies

  • Ensure job IDs are unique
  • Check needs references
  • Avoid circular dependencies

Debug Output

Use --verbose flag for detailed execution information:

probe --workflow test.yml --verbose

Best Practices

  1. Use descriptive names for workflows, jobs, and steps
  2. Leverage outputs for data sharing between steps
  3. Implement proper testing with meaningful assertions
  4. Use defaults to reduce repetition
  5. Structure workflows logically with clear dependencies
  6. Handle errors gracefully with appropriate tests
  7. Use variables for configuration management

Contributing

We welcome contributions! Please feel free to submit issues, feature requests, or pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

linyows


For more examples and advanced usage, check the examples directory.

Documentation

Index

Constants

View Source
const (
	// MaxLogStringLength is the maximum length for log output to prevent log bloat
	MaxLogStringLength = 200
	// MaxStringLength is the maximum length for general string processing
	MaxStringLength = 1000000
)
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 GetTruncationMessage added in v0.9.0

func GetTruncationMessage() string

GetTruncationMessage returns a colored truncation message

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 TruncateMapStringString added in v0.9.0

func TruncateMapStringString(params map[string]string, maxLen int) map[string]string

TruncateMapStringString truncates long values in map[string]string for logging

func TruncateString added in v0.9.0

func TruncateString(s string, maxLen int) string

TruncateString truncates a string if it exceeds the maximum length

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 Config

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

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 Executor added in v0.8.0

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

Executor handles job execution with buffered output

func NewExecutor added in v0.8.0

func NewExecutor(w *Workflow, job *Job) *Executor

NewExecutor creates a new job executor

func (*Executor) Execute added in v0.8.0

func (e *Executor) Execute(ctx JobContext) bool

Execute runs a job with buffered output

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
	// Current job ID for this context
	CurrentJobID string
	// Repeat tracking
	IsRepeating   bool
	RepeatCurrent int
	RepeatTotal   int
	StepCounters  map[int]StepRepeatCounter // step index -> counter
	// Print writer
	Printer *Printer
	// Result for managing job-level output
	Result *Result
	// Job scheduler for managing job dependencies and execution
	JobScheduler *JobScheduler
	// Shared outputs across all jobs (accessible via expressions as "outputs")
	Outputs *Outputs `expr:"outputs"`
}

JobContext provides context data for job execution

func (*JobContext) SetFailed added in v0.2.0

func (j *JobContext) SetFailed()

SetFailed marks the job context as failed

type JobResult added in v0.8.0

type JobResult struct {
	JobName     string
	JobID       string
	Status      string
	StartTime   time.Time
	EndTime     time.Time
	Success     bool
	StepResults []StepResult // Store all step results for this job
	// contains filtered or unexported fields
}

JobResult stores execution results 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 Printer added in v0.7.0

type Printer struct {
	Buffer    map[string]*strings.Builder
	BufferIDs []string // Order preservation
	// contains filtered or unexported fields
}

Printer implements PrintWriter for console print

func NewPrinter added in v0.7.0

func NewPrinter(verbose bool, bufferIDs []string) *Printer

NewPrinter creates a new console print writer

func (*Printer) AddSpinnerSuffix added in v0.8.0

func (p *Printer) AddSpinnerSuffix(txt string)

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) PrintEchoContent added in v0.10.0

func (p *Printer) PrintEchoContent(content string)

PrintEchoContent prints echo content with proper indentation in verbose mode

func (*Printer) PrintError added in v0.7.0

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

PrintError prints an error message

func (*Printer) PrintHeader added in v0.8.0

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

PrintHeader prints the workflow name and description

func (*Printer) PrintMapData added in v0.10.0

func (p *Printer) PrintMapData(data map[string]any)

PrintMapData prints map data with proper formatting for nested structures

func (*Printer) PrintReport added in v0.8.0

func (p *Printer) PrintReport(rs *Result)

PrintReport prints a complete workflow report using Result data

func (*Printer) PrintRequestResponse added in v0.10.0

func (p *Printer) PrintRequestResponse(stepIdx int, stepName string, req, res map[string]any, rt string)

PrintRequestResponse prints request and response data with proper formatting

func (*Printer) PrintSeparator added in v0.7.0

func (p *Printer) PrintSeparator()

PrintSeparator prints a separator line for verbose output

func (*Printer) PrintTestResult added in v0.10.0

func (p *Printer) PrintTestResult(success bool, testExpr string, context interface{})

PrintTestResult prints test result in verbose mode

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) StartSpinner added in v0.8.0

func (p *Printer) StartSpinner()

func (*Printer) StopSpinner added in v0.8.0

func (p *Printer) StopSpinner()

type Probe

type Probe struct {
	FilePath string

	Config Config
	// contains filtered or unexported fields
}

func New

func New(path string, v bool) *Probe

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 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 NewProbeError added in v0.7.0

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

NewProbeError creates a new ProbeError

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 Result added in v0.8.0

type Result struct {
	Jobs map[string]*JobResult
}

Result manages execution results for multiple jobs

func NewResult added in v0.8.0

func NewResult() *Result

NewResult creates a new Result instance

func (*Result) AddStepResult added in v0.8.0

func (rs *Result) AddStepResult(jobID string, stepResult StepResult)

AddStepResult adds a StepResult to the specified job result

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(printer *Printer) (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"`
}

StepContext provides context data for step expression evaluation

type StepRepeatCounter added in v0.6.0

type StepRepeatCounter struct {
	SuccessCount int
	FailureCount int
	Name         string
	LastResult   bool
}

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
	RepeatCounter *StepRepeatCounter // For repeat execution information
}

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

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