actions¶
Package actions provides the action handler system for mooncake.
Overview¶
The actions package defines a standard interface (Handler) that all action implementations must follow, along with a registry for discovering handlers at runtime.
Architecture¶
Actions are implemented as packages under internal/actions/. Each action package provides a Handler implementation that is registered globally on import via an init() function.
The executor looks up handlers from the registry based on the action type determined from the step configuration.
Backward Compatibility¶
This new system is designed to work alongside the existing action implementations. The Step struct retains all existing action fields (Shell, File, Template, etc.), and actions are migrated incrementally to the new Handler interface.
Creating a New Action¶
To create a new action handler:
-
Create a package under internal/actions/ (e.g., internal/actions/notify)
-
Implement the Handler interface:
type Handler struct{}
func (h *Handler) Metadata() actions.ActionMetadata {
return actions.ActionMetadata{
Name: "notify",
Description: "Send notifications",
Category: actions.CategorySystem,
SupportsDryRun: true,
}
}
func (h *Handler) Validate(step *config.Step) error {
// Validate step.Notify config
return nil
}
func (h *Handler) Execute(ctx *executor.ExecutionContext, step *config.Step) (*executor.Result, error) {
// Implement action logic
return &executor.Result{Changed: true}, nil
}
func (h *Handler) DryRun(ctx *executor.ExecutionContext, step *config.Step) error {
ctx.Logger.Infof(" [DRY-RUN] Would send notification")
return nil
}
- Register the handler in init():
- Import the package in the executor to ensure registration:
Migration Strategy¶
Existing actions are being migrated incrementally:
- Phase 1: Create Handler implementations for simple actions (print, vars)
- Phase 2: Migrate complex actions (shell, file, template)
- Phase 3: Migrate specialized actions (service, assert, preset)
- Phase 4: Remove legacy code paths
During migration, both old and new implementations coexist. The executor checks if a handler is registered and prefers it, falling back to legacy implementations for non-migrated actions.
Package actions provides the handler interface and registry for mooncake actions.
The actions package defines a standard interface that all action handlers must implement, along with a registry system for discovering and dispatching to handlers at runtime.
To create a new action handler:
- Create a new package under internal/actions (e.g., internal/actions/notify)
- Implement the Handler interface
- Register your handler in an init() function
- The handler will be automatically available for use
Example:
package notify
import "github.com/alehatsman/mooncake/internal/actions"
type Handler struct{}
func init() {
actions.Register(&Handler{})
}
func (h *Handler) Metadata() actions.ActionMetadata {
return actions.ActionMetadata{
Name: "notify",
Description: "Send notifications",
Category: actions.CategorySystem,
}
}
// ... implement other interface methods
Index¶
- func Count() int
- func Has(actionType string) bool
- func Register(handler Handler)
- type ActionCategory
- type ActionMetadata
- func List() []ActionMetadata
- type Context
- type Handler
- func Get(actionType string) (Handler, bool)
- func NewHandlerFunc(metadata ActionMetadata, validate func(*config.Step) error, execute func(Context, *config.Step) (Result, error), dryRun func(Context, *config.Step) error) Handler
- type HandlerFunc
- func (h *HandlerFunc) DryRun(ctx Context, step *config.Step) error
- func (h *HandlerFunc) Execute(ctx Context, step *config.Step) (Result, error)
- func (h *HandlerFunc) Metadata() ActionMetadata
- func (h *HandlerFunc) Validate(step *config.Step) error
- type Registry
- func NewRegistry() *Registry
- func (r *Registry) Count() int
- func (r *Registry) Get(actionType string) (Handler, bool)
- func (r *Registry) Has(actionType string) bool
- func (r *Registry) List() []ActionMetadata
- func (r *Registry) Register(handler Handler)
- type Result
func Count¶
Count returns the number of handlers in the global registry.
func Has¶
Has checks if a handler exists in the global registry.
func Register¶
Register registers a handler in the global registry. This is the most common way to register handlers from init() functions.
Example:
type ActionCategory¶
ActionCategory groups related actions by their primary function.
const (
// CategoryCommand represents actions that execute commands (shell, command)
CategoryCommand ActionCategory = "command"
// CategoryFile represents actions that manipulate files (file, template, copy, download)
CategoryFile ActionCategory = "file"
// CategorySystem represents system-level actions (service, assert, preset)
CategorySystem ActionCategory = "system"
// CategoryData represents data manipulation actions (vars, include_vars)
CategoryData ActionCategory = "data"
// CategoryNetwork represents network-related actions (download, http requests)
CategoryNetwork ActionCategory = "network"
// CategoryOutput represents output/display actions (print)
CategoryOutput ActionCategory = "output"
)
type ActionMetadata¶
ActionMetadata describes an action type and its capabilities.
type ActionMetadata struct {
// Name is the action name as it appears in YAML (e.g., "shell", "file", "notify")
Name string
// Description is a human-readable description of what this action does
Description string
// Category groups related actions (command, file, system, etc.)
Category ActionCategory
// SupportsDryRun indicates whether this action can be executed in dry-run mode
SupportsDryRun bool
// SupportsBecome indicates whether this action supports privilege escalation (sudo)
SupportsBecome bool
// EmitsEvents lists the event types this action emits (e.g., "file.created", "notify.sent")
EmitsEvents []string
// Version is the action implementation version (semantic versioning)
Version string
}
func List¶
List returns all handlers from the global registry.
type Context¶
Context provides the execution environment for action handlers.
Context is the primary interface through which handlers interact with the mooncake runtime. It provides access to:
- Template rendering (Jinja2-like syntax with variables and filters)
- Expression evaluation (when/changed_when/failed_when conditions)
- Logging (structured output to TUI or text)
- Variables (step vars, global vars, facts, registered results)
- Event publishing (for observability and artifacts)
- Execution mode (dry-run vs actual execution)
This interface avoids circular imports between actions and executor packages.
Example usage in a handler:
func (h *Handler) Execute(ctx actions.Context, step *config.Step) (actions.Result, error) {
// Render template strings
path, err := ctx.GetTemplate().RenderString(step.File.Path, ctx.GetVariables())
// Log progress
ctx.GetLogger().Infof("Creating file at %s", path)
// Emit events for observability
ctx.GetEventPublisher().Publish(events.Event{
Type: events.EventFileCreated,
Data: events.FileOperationData{Path: path},
})
// Return result
result := executor.NewResult()
result.SetChanged(true)
return result, nil
}
type Context interface {
// GetTemplate returns the template renderer for processing Jinja2-like templates.
//
// Use this to render:
// - Path strings with variables: "{{ home }}/{{ item }}"
// - Content with logic: "{% if os == 'linux' %}...{% endif %}"
// - Filters: "{{ path | expanduser }}"
//
// The renderer has access to all variables in scope (step vars, globals, facts).
GetTemplate() template.Renderer
// GetEvaluator returns the expression evaluator for conditions.
//
// Use this to evaluate:
// - when: "os == 'linux' && arch == 'amd64'"
// - changed_when: "result.rc == 0 and 'changed' in result.stdout"
// - failed_when: "result.rc != 0 and result.rc != 5"
//
// Returns interface{} which should be cast to bool for conditions.
GetEvaluator() expression.Evaluator
// GetLogger returns the logger for handler output.
//
// Use levels appropriately:
// - Infof: User-visible progress ("Installing package nginx")
// - Debugf: Detailed info ("Command: apt install nginx")
// - Warnf: Non-fatal issues ("File already exists, skipping")
// - Errorf: Failures ("Failed to create directory: permission denied")
//
// Output is formatted for TUI or text mode automatically.
GetLogger() logger.Logger
// GetVariables returns all variables in the current scope.
//
// Includes:
// - Step-level vars (defined in step.Vars)
// - Global vars (from vars actions)
// - System facts (os, arch, cpu_cores, memory_total_mb, etc.)
// - Registered results (from register: field on previous steps)
// - Loop context (item, item_index when in with_items/with_filetree)
//
// Keys are strings, values are interface{} (string, int, bool, []interface{}, map[string]interface{}).
GetVariables() map[string]interface{}
// GetEventPublisher returns the event publisher for observability.
//
// Emit events for:
// - State changes (EventFileCreated, EventServiceStarted)
// - Progress tracking (custom events for long operations)
// - Artifact generation (paths to created files)
//
// Events are consumed by:
// - Artifact collector (for rollback support)
// - External observers (CI/CD integrations)
// - Audit logs
GetEventPublisher() events.Publisher
// IsDryRun returns true if this is a dry-run execution.
//
// In dry-run mode:
// - Handlers MUST NOT make actual changes
// - Handlers SHOULD log what would happen
// - Template rendering should still work (to validate syntax)
// - File existence checks are OK (read-only operations)
// - Writing/deleting/executing is NOT OK
//
// The DryRun() method handles this automatically, but Execute() can also check.
IsDryRun() bool
// GetCurrentStepID returns the unique ID of the currently executing step.
//
// Format: "step-{global_step_number}"
//
// Use this when:
// - Emitting events (so they're associated with the step)
// - Creating temporary files (include step ID to avoid conflicts)
// - Logging (though step ID is usually added automatically)
GetCurrentStepID() string
}
type Handler¶
Handler defines the interface that all action handlers must implement.
A handler is responsible for:
- Validating action configuration
- Executing the action
- Handling dry-run mode
- Emitting appropriate events
- Returning results
Handlers should be stateless - all execution state is passed via ExecutionContext.
type Handler interface {
// Metadata returns metadata describing this action type.
Metadata() ActionMetadata
// Validate checks if the step configuration is valid for this action.
// This is called before Execute to fail fast on configuration errors.
// Returns an error if validation fails.
Validate(step *config.Step) error
// Execute runs the action and returns a result.
// The result includes whether the action made changes, output data,
// and any error information.
//
// Handlers should:
// - Emit appropriate events via ctx.GetEventPublisher()
// - Handle template rendering via ctx.GetTemplate()
// - Use ctx.GetLogger() for logging
// - Return a Result with Changed=true if the action modified state
//
// If an error occurs, return it - the executor will handle result registration.
Execute(ctx Context, step *config.Step) (Result, error)
// DryRun logs what would happen if Execute were called, without making changes.
// This is called when the executor is in dry-run mode.
//
// Handlers should:
// - Use ctx.GetLogger() to describe what would happen
// - Attempt to render templates (but catch errors gracefully)
// - NOT make any actual changes to the system
// - NOT emit action-specific events (step lifecycle events are handled by executor)
//
// Returns an error only if dry-run simulation fails catastrophically.
DryRun(ctx Context, step *config.Step) error
}
func Get¶
Get retrieves a handler from the global registry.
func NewHandlerFunc¶
func NewHandlerFunc(metadata ActionMetadata, validate func(*config.Step) error, execute func(Context, *config.Step) (Result, error), dryRun func(Context, *config.Step) error) Handler
NewHandlerFunc creates a Handler from function implementations.
type HandlerFunc¶
HandlerFunc is a function type that implements Handler for simple actions. This allows creating handlers without defining a new type.
func (*HandlerFunc) DryRun¶
func (*HandlerFunc) Execute¶
func (*HandlerFunc) Metadata¶
func (*HandlerFunc) Validate¶
type Registry¶
Registry manages registered action handlers through a thread-safe map.
The registry pattern enables:
- Dynamic action discovery - handlers register themselves via init()
- Loose coupling - executor doesn't import all action packages
- Extensibility - new actions added without changing executor
- Thread safety - concurrent access from multiple goroutines
Registration flow:
- Action package imports actions: import "github.com/.../internal/actions"
- Action package defines handler: type Handler struct{}
- Action package registers in init(): func init() { actions.Register(&Handler{}) }
- Main imports register package: import _ "github.com/.../internal/register"
- Register package imports all actions: import _ ".../actions/shell"
- All handlers automatically registered before main() runs
Lookup flow:
- Executor determines action type from step: actionType := step.DetermineActionType()
- Executor queries registry: handler, ok := actions.Get(actionType)
- If found, executor calls: handler.Validate(step), handler.Execute(ctx, step)
- If not found, executor falls back to legacy implementation
This avoids circular imports because:
- actions package defines Handler interface
- action implementations (shell, file, etc.) import actions
- executor imports actions but NOT action implementations
- register package imports action implementations (triggers init())
- cmd imports register (triggers all registrations)
func NewRegistry¶
NewRegistry creates a new action registry.
func (*Registry) Count¶
Count returns the number of registered handlers.
func (*Registry) Get¶
Get retrieves a handler by action type name. Returns the handler and true if found, nil and false otherwise.
func (*Registry) Has¶
Has checks if a handler is registered for the given action type.
func (*Registry) List¶
List returns metadata for all registered handlers. Useful for introspection and documentation generation.
func (*Registry) Register¶
Register adds a handler to the registry. This is typically called from init() functions in action packages. Panics if a handler with the same name is already registered.
type Result¶
Result represents the outcome of an action execution.
Results track:
- Whether changes were made (for idempotency reporting)
- Output data (stdout/stderr from commands)
- Success/failure status
- Custom data (for result registration)
Results can be registered to variables for use in subsequent steps via the register: field.
Example:
result := executor.NewResult()
result.SetChanged(true) // File was created/modified
result.SetData(map[string]interface{}{
"path": "/etc/myapp/config.yml",
"size": 1024,
"checksum": "sha256:abc123...",
})
// If step has register: myfile, data is available as:
// {{ myfile.changed }} = true
// {{ myfile.path }} = "/etc/myapp/config.yml"
This interface avoids circular imports between actions and executor packages.
type Result interface {
// SetChanged marks whether this action modified system state.
//
// Set to true if the action:
// - Created/modified/deleted files or directories
// - Started/stopped/restarted services
// - Installed/removed packages
// - Executed commands that changed state
//
// Set to false if the action:
// - Found state already as desired (idempotent)
// - Only read/queried information
// - Failed before making changes
//
// Changed count is reported in run summary and used for idempotency tracking.
SetChanged(changed bool)
// SetStdout captures standard output from the action.
//
// Used primarily by shell/command actions. Output is:
// - Available in registered results as {{ result.stdout }}
// - Shown in TUI output view
// - Logged to artifacts
// - Used in changed_when/failed_when expressions
SetStdout(stdout string)
// SetStderr captures standard error from the action.
//
// Used primarily by shell/command actions. Error output is:
// - Available in registered results as {{ result.stderr }}
// - Shown in TUI output view (usually in red)
// - Logged to artifacts
// - Used in changed_when/failed_when expressions
SetStderr(stderr string)
// SetFailed marks the result as failed.
//
// Usually you should return an error instead of calling this. Use this when:
// - The action completed but didn't achieve desired state
// - failed_when expression evaluated to true
// - Assertion failed (assert action)
//
// Failed steps:
// - Increment failure count in run summary
// - Stop execution (unless ignore_errors: true)
// - Are highlighted in TUI
SetFailed(failed bool)
// SetData attaches custom data to the result.
//
// Data becomes available when the result is registered via register: field.
//
// Example:
//
// result.SetData(map[string]interface{}{
// "checksum": "sha256:abc123",
// "size_bytes": 1024,
// "format": "json",
// })
//
// Then in subsequent steps:
// when: myfile.checksum == "sha256:abc123"
// shell: echo "File size: {{ myfile.size_bytes }}"
//
// Keys should be snake_case. Values should be JSON-serializable.
SetData(data map[string]interface{})
// RegisterTo registers this result to the variables map.
//
// Called automatically by the executor when a step has register: field.
// Creates a map in variables with:
// - changed: bool
// - failed: bool
// - stdout: string (if set)
// - stderr: string (if set)
// - rc: int (if applicable)
// - ...custom data from SetData()
//
// Handlers typically don't call this directly.
RegisterTo(variables map[string]interface{}, name string)
}
assert¶
Package assert implements the assert action handler. Assertions verify conditions without changing system state.
Index¶
- type Handler
- func (h *Handler) DryRun(ctx actions.Context, step *config.Step) error
- func (h *Handler) Execute(ctx actions.Context, step *config.Step) (actions.Result, error)
- func (h *Handler) Metadata() actions.ActionMetadata
- func (h *Handler) Validate(step *config.Step) error
type Handler¶
Handler implements the assert action handler.
func (*Handler) DryRun¶
DryRun logs what the assertion would check.
func (*Handler) Execute¶
Execute executes the assert action.
func (*Handler) Metadata¶
Metadata returns the action metadata.
func (*Handler) Validate¶
Validate validates the assert action configuration.
command¶
Package command implements the command action handler.
The command action executes commands directly without shell interpolation. This is safer than shell when you have a known command with arguments, as it prevents shell injection attacks.
Index¶
- type Handler
- func (h *Handler) DryRun(ctx actions.Context, step *config.Step) error
- func (h *Handler) Execute(ctx actions.Context, step *config.Step) (actions.Result, error)
- func (Handler) Metadata() actions.ActionMetadata
- func (h *Handler) Validate(step *config.Step) error
type Handler¶
Handler implements the Handler interface for command actions.
func (*Handler) DryRun¶
DryRun logs what would be executed without actually running the command.
func (*Handler) Execute¶
Execute runs the command action with retry logic if configured.
func (Handler) Metadata¶
Metadata returns metadata about the command action.
func (*Handler) Validate¶
Validate checks if the command configuration is valid.
copy¶
Package copy implements the copy action handler.
The copy action copies files from source to destination with: - Checksum verification (before and after copy) - Atomic write pattern (temp file + rename) - Backup support - Idempotency based on size/modtime
Index¶
- type Handler
- func (h *Handler) DryRun(ctx actions.Context, step *config.Step) error
- func (h *Handler) Execute(ctx actions.Context, step *config.Step) (actions.Result, error)
- func (Handler) Metadata() actions.ActionMetadata
- func (h *Handler) Validate(step *config.Step) error
type Handler¶
Handler implements the Handler interface for copy actions.
func (*Handler) DryRun¶
DryRun logs what would be done without actually doing it.
func (*Handler) Execute¶
Execute runs the copy action.
func (Handler) Metadata¶
Metadata returns metadata about the copy action.
func (*Handler) Validate¶
Validate checks if the copy configuration is valid.
download¶
Package download implements the download action handler.
The download action downloads files from URLs with: - HTTP/HTTPS support - Checksum verification (MD5, SHA1, SHA256) for idempotency - Custom HTTP headers - Timeout and retry support - Atomic write pattern (temp file + rename)
Index¶
- type Handler
- func (h *Handler) DryRun(ctx actions.Context, step *config.Step) error
- func (h *Handler) Execute(ctx actions.Context, step *config.Step) (actions.Result, error)
- func (Handler) Metadata() actions.ActionMetadata
- func (h *Handler) Validate(step *config.Step) error
type Handler¶
Handler implements the Handler interface for download actions.
func (*Handler) DryRun¶
DryRun logs what would be done without actually doing it.
func (*Handler) Execute¶
Execute runs the download action.
func (Handler) Metadata¶
Metadata returns metadata about the download action.
func (*Handler) Validate¶
Validate checks if the download configuration is valid.
file¶
Package file implements the file action handler.
The file action manages files, directories, and links with support for: - Creating/updating files with content - Creating directories - Removing files and directories - Creating symbolic and hard links - Setting permissions and ownership - Touch operations (update timestamps)
Index¶
- type Handler
- func (h *Handler) DryRun(ctx actions.Context, step *config.Step) error
- func (h *Handler) Execute(ctx actions.Context, step *config.Step) (actions.Result, error)
- func (Handler) Metadata() actions.ActionMetadata
- func (h *Handler) Validate(step *config.Step) error
type Handler¶
Handler implements the Handler interface for file actions.
func (*Handler) DryRun¶
DryRun logs what would be done without actually doing it.
func (*Handler) Execute¶
Execute runs the file action.
func (Handler) Metadata¶
Metadata returns metadata about the file action.
func (*Handler) Validate¶
Validate checks if the file configuration is valid.
include_vars¶
Package include_vars implements the include_vars action handler.
The include_vars action loads variables from YAML files into the execution context. This is useful for organizing variables across multiple files.
Index¶
- type Handler
- func (h *Handler) DryRun(ctx actions.Context, step *config.Step) error
- func (h *Handler) Execute(ctx actions.Context, step *config.Step) (actions.Result, error)
- func (Handler) Metadata() actions.ActionMetadata
- func (h *Handler) Validate(step *config.Step) error
type Handler¶
Handler implements the Handler interface for include_vars actions.
func (*Handler) DryRun¶
DryRun logs what variables would be loaded.
func (*Handler) Execute¶
Execute runs the include_vars action.
func (Handler) Metadata¶
Metadata returns metadata about the include_vars action.
func (*Handler) Validate¶
Validate checks if the include_vars configuration is valid.
package_handler¶
Package package implements the package action handler.
The package action manages system packages with support for: - Auto-detection of package manager (apt, dnf, yum, pacman, zypper, apk, brew, port, choco, scoop) - Manual package manager selection - Install, remove, and update operations - Cache management and system upgrades
Index¶
- type Handler
- func (h *Handler) DryRun(ctx actions.Context, step *config.Step) error
- func (h *Handler) Execute(ctx actions.Context, step *config.Step) (actions.Result, error)
- func (h *Handler) Metadata() actions.ActionMetadata
- func (h *Handler) Validate(step *config.Step) error
type Handler¶
Handler implements the Handler interface for package actions.
func (*Handler) DryRun¶
DryRun shows what would be done without making changes.
func (*Handler) Execute¶
Execute runs the package action.
func (*Handler) Metadata¶
Metadata returns metadata about the package action.
func (*Handler) Validate¶
Validate checks if the package configuration is valid.
preset¶
Package preset implements the preset action handler. Presets expand into multiple steps with parameter injection.
Index¶
- type Handler
- func (h *Handler) DryRun(ctx actions.Context, step *config.Step) error
- func (h *Handler) Execute(ctx actions.Context, step *config.Step) (actions.Result, error)
- func (h *Handler) Metadata() actions.ActionMetadata
- func (h *Handler) Validate(step *config.Step) error
type Handler¶
Handler implements the preset action handler.
func (*Handler) DryRun¶
DryRun logs what the preset would expand.
func (*Handler) Execute¶
Execute executes the preset action.
func (*Handler) Metadata¶
Metadata returns the action metadata.
func (*Handler) Validate¶
Validate validates the preset action configuration.
print¶
Package print implements the print action handler.
The print action displays messages to the user during execution. It supports template rendering and is useful for debugging and showing information.
Index¶
- type Handler
- func (h *Handler) DryRun(ctx actions.Context, step *config.Step) error
- func (h *Handler) Execute(ctx actions.Context, step *config.Step) (actions.Result, error)
- func (h *Handler) Metadata() actions.ActionMetadata
- func (h *Handler) Validate(step *config.Step) error
type Handler¶
Handler implements the Handler interface for print actions.
func (*Handler) DryRun¶
DryRun logs what would be printed without actually printing.
func (*Handler) Execute¶
Execute runs the print action.
func (*Handler) Metadata¶
Metadata returns metadata about the print action.
func (*Handler) Validate¶
Validate checks if the print configuration is valid.
service¶
Package service implements the service action handler. Manages services across different platforms (systemd, launchd, Windows).
Index¶
- Constants
- func HandleService(step config.Step, ec *executor.ExecutionContext) error
- type Handler
- func (h *Handler) DryRun(ctx actions.Context, step *config.Step) error
- func (h *Handler) Execute(ctx actions.Context, step *config.Step) (actions.Result, error)
- func (h *Handler) Metadata() actions.ActionMetadata
- func (h *Handler) Validate(step *config.Step) error
Constants¶
const (
ServiceStateStarted = "started"
ServiceStateStopped = "stopped"
ServiceStateReloaded = "reloaded"
ServiceStateRestarted = "restarted"
)
func HandleService¶
HandleService manages services across different platforms (systemd, launchd, Windows).
type Handler¶
Handler implements the service action handler.
func (*Handler) DryRun¶
DryRun logs what the service operation would do.
func (*Handler) Execute¶
Execute executes the service action.
func (*Handler) Metadata¶
Metadata returns the action metadata.
func (*Handler) Validate¶
Validate validates the service action configuration.
shell¶
Package shell implements the shell action handler.
The shell action executes shell commands with support for: - Multiple interpreters (bash, sh, pwsh, cmd) - Sudo/become privilege escalation - Environment variables and working directory - Timeout and retry logic - Stdin, stdout, stderr handling - Result overrides (changed_when, failed_when)
Index¶
- type Handler
- func (h *Handler) DryRun(ctx actions.Context, step *config.Step) error
- func (h *Handler) Execute(ctx actions.Context, step *config.Step) (actions.Result, error)
- func (h *Handler) Metadata() actions.ActionMetadata
- func (h *Handler) Validate(step *config.Step) error
type Handler¶
Handler implements the Handler interface for shell actions.
func (*Handler) DryRun¶
DryRun logs what would be executed.
func (*Handler) Execute¶
Execute runs the shell action.
func (*Handler) Metadata¶
Metadata returns metadata about the shell action.
func (*Handler) Validate¶
Validate checks if the shell configuration is valid.
template¶
Package template implements the template action handler.
The template action reads a template file, renders it with variables, and writes the rendered output to a destination file.
Index¶
- type Handler
- func (h *Handler) DryRun(ctx actions.Context, step *config.Step) error
- func (h *Handler) Execute(ctx actions.Context, step *config.Step) (actions.Result, error)
- func (Handler) Metadata() actions.ActionMetadata
- func (h *Handler) Validate(step *config.Step) error
type Handler¶
Handler implements the Handler interface for template actions.
func (*Handler) DryRun¶
DryRun logs what would be done without actually doing it.
func (*Handler) Execute¶
Execute runs the template action.
func (Handler) Metadata¶
Metadata returns metadata about the template action.
func (*Handler) Validate¶
Validate checks if the template configuration is valid.
unarchive¶
Package unarchive implements the unarchive action handler.
The unarchive action extracts archive files with: - Format support: tar, tar.gz, tar.bz2, zip - Strip leading path components - Idempotency via creates marker - Path traversal protection - Extraction statistics
Index¶
- type ArchiveFormat
- func (f ArchiveFormat) String() string
- type ExtractionStats
- type Handler
- func (h *Handler) DryRun(ctx actions.Context, step *config.Step) error
- func (h *Handler) Execute(ctx actions.Context, step *config.Step) (actions.Result, error)
- func (Handler) Metadata() actions.ActionMetadata
- func (h *Handler) Validate(step *config.Step) error
type ArchiveFormat¶
ArchiveFormat represents the type of archive being extracted.
func (ArchiveFormat) String¶
String returns the string representation of the archive format.
type ExtractionStats¶
ExtractionStats tracks statistics from archive extraction.
type Handler¶
Handler implements the Handler interface for unarchive actions.
func (*Handler) DryRun¶
DryRun logs what would be done without actually doing it.
func (*Handler) Execute¶
Execute runs the unarchive action.
func (Handler) Metadata¶
Metadata returns metadata about the unarchive action.
func (*Handler) Validate¶
Validate checks if the unarchive configuration is valid.
vars¶
Package vars implements the vars action handler.
The vars action sets variables that are available to subsequent steps. Variables can be used in templates and when conditions.
Index¶
- type Handler
- func (h *Handler) DryRun(ctx actions.Context, step *config.Step) error
- func (h *Handler) Execute(ctx actions.Context, step *config.Step) (actions.Result, error)
- func (h *Handler) Metadata() actions.ActionMetadata
- func (h *Handler) Validate(step *config.Step) error
type Handler¶
Handler implements the Handler interface for vars actions.
func (*Handler) DryRun¶
DryRun logs what variables would be set.
func (*Handler) Execute¶
Execute runs the vars action.
func (*Handler) Metadata¶
Metadata returns metadata about the vars action.
func (*Handler) Validate¶
Validate checks if the vars configuration is valid.
Generated by gomarkdoc