Documentation
¶
Overview ¶
Package core hosts the built-in actions, functions, state backend, and encrypters that ship with every compiled factory binary.
Built-in actions:
- core.command - exec a process, capture stdout/stderr/exit
- core.http - HTTP request, return body/status
- core.wait-for - poll a predicate until true or timeout
- core.script - multi-line script (uses triple-quoted multilines)
Built-in functions: core.format, core.b64-encode, core.b64-decode, core.range, and core.length. State backend core.local writes snapshots to the local filesystem; the core.env-key and core.noop encrypters cover encrypted and plaintext state.
Actions implement the standard action interface: triggered (hash-based re-run), with @lock cross-DAG serialization, @timeout, and @sensitive redaction.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CommandAction ¶
CommandAction execs a single process and captures its output.
func (*CommandAction) Run ¶
func (a *CommandAction) Run(ctx context.Context, _ any) (*CommandActionOutput, error)
Run execs argv[0] with argv[1:] as arguments. Environment is merged with the parent, with user-supplied variables taking precedence.
type CommandActionOutput ¶
CommandActionOutput carries the captured output of a command run. Run returns an error when the process fails to start or the context is canceled.
type HTTPAction ¶
type HTTPAction struct {
URL string
Method string
Headers map[string]string
Body string
Timeout time.Duration
}
HTTPAction issues an HTTP request and captures the response.
func (*HTTPAction) Run ¶
func (a *HTTPAction) Run(ctx context.Context, _ any) (*HTTPActionOutput, error)
Run issues the request. Method defaults to GET. Timeout applies to the whole round trip including reading the response body.
type HTTPActionOutput ¶
type HTTPActionOutput struct {
Status int
StatusText string
Headers map[string][]string
Body string
Duration time.Duration
}
HTTPActionOutput is the captured response. The action returns an error only when the request can't be built or the transport fails, not on HTTP error status codes. HTTP status codes are returned as data in Status.
type ScriptAction ¶
type ScriptAction struct {
Script string
Shell string
Environment map[string]string
WorkingDir string
}
ScriptAction runs a shell script via `<shell> -c <script>`. Shell defaults to `sh`; set it to `bash`, `python3`, or any other interpreter that accepts `-c`.
func (*ScriptAction) Run ¶
func (a *ScriptAction) Run(ctx context.Context, _ any) (*ScriptActionOutput, error)
Run invokes the configured shell with the script. Output mirrors what CommandAction returns.
type ScriptActionOutput ¶
type ScriptActionOutput = CommandActionOutput
ScriptActionOutput is the captured output of a script run. It is the same shape as the command action's output because both reduce to a process exec; the alias keeps the convention that every action type has a sibling type named `<GoName>Output`.
type WaitForAction ¶
type WaitForAction struct {
Argv []string
Interval time.Duration
Timeout time.Duration
Environment map[string]string
WorkingDir string
}
WaitForAction polls a command until it exits 0 or the deadline is reached. The command runs at most once per Interval (default 1s) and the whole poll loop runs for at most Timeout (default 5m).
func (*WaitForAction) Run ¶
func (a *WaitForAction) Run(ctx context.Context, _ any) (*WaitForActionOutput, error)
Run polls until the command exits 0, the timeout fires, or the context is cancelled. A nonzero exit triggers another attempt, and an error is returned if the process fails to start.