Documentation
¶
Overview ¶
Package workflowstep is the registry of gofer's built-in workflow steps — the steps a workflow names with `uses: gofer/<name>` and parametrises with `with:` (design 2026-10-21 §一·5). Every entry declares its name, the Go struct its `with` block is strictly decoded into (an unknown key is an error, not a silent ignore), its validation, where it runs and the worker protocol floor it needs.
It is a SEPARATE package on purpose (G024): `job` must not import `job/workflow`, so the registry can not live in workflow. Both sides use it — workflow validates a spec at submit, and the `gofer tool step <name>` command executes one on the runner.
Index ¶
- Constants
- func Args(uses string, with map[string]any) (any, error)
- func Names() []string
- func ParseUses(uses string) (string, error)
- func Run(ctx context.Context, name string, with map[string]any, dir string) (any, error)
- func Validate(uses string, with map[string]any) error
- type PushArgs
- type Step
- type WaitAssetsArgs
- type WaitCIArgs
Constants ¶
const ( NamePush = "push" NameWaitCI = "wait-ci" NameWaitAssets = "wait-assets" )
Step names the first batch of built-in steps (design §一·5).
const RunnerExec = "exec"
RunnerExec is where a built-in step executes: an exec job on the step's own runner, the same place an ordinary `agent: exec` step runs (which is what makes `runner:` on the step meaningful without extra machinery).
const UsesPrefix = "gofer/"
UsesPrefix is the only accepted prefix of a `uses:` value. A step is always gofer's own code, versioned with the gofer binary; there is no `@version`.
Variables ¶
This section is empty.
Functions ¶
func ParseUses ¶
ParseUses splits a `uses:` value into the registered name. Only `gofer/<registered>` is accepted; anything else is refused with the list of known steps, so a typo in a release workflow is a submit error rather than a silent no-op.
Types ¶
type PushArgs ¶
type PushArgs struct {
// Refs are local branch / tag names: a branch is pushed to refs/heads/<ref>, a tag to
// refs/tags/<ref>.
Refs []string `json:"refs"`
// Remote is the git remote to push to ("" = origin).
Remote string `json:"remote,omitempty"`
// Proxy overrides git's http.proxy for this push (the project's delivery.proxy).
Proxy string `json:"proxy,omitempty"`
}
PushArgs is `gofer/push`'s `with:` block.
type Step ¶
type Step struct {
// Name is the part after `gofer/` (push, wait-ci, wait-assets).
Name string
// Desc is the one-line description shown by `gofer tool step --help` / docs.
Desc string
// Runner is where the step executes (RunnerExec).
Runner string
// MinWorkerProtocol is the lowest worker protocol a worker runner must speak: a
// worker below it has no `gofer tool step` sub-command and would fail the step.
MinWorkerProtocol int
// Decode strictly decodes the `with:` block (unknown keys are refused).
Decode func(with map[string]any) (any, error)
// Validate checks the decoded arguments; it runs at submit AND before execution.
Validate func(args any) error
// Run executes the step in dir and returns the JSON result of the step.
Run func(ctx context.Context, args any, dir string) (any, error)
}
Step is one registered built-in step.
type WaitAssetsArgs ¶
type WaitAssetsArgs struct {
Tag string `json:"tag"`
Assets []string `json:"assets"`
TimeoutMin int `json:"timeout_min,omitempty"`
IntervalSec int `json:"interval_sec,omitempty"`
Remote string `json:"remote,omitempty"`
}
WaitAssetsArgs is `gofer/wait-assets`'s `with:` block.
type WaitCIArgs ¶
type WaitCIArgs struct {
Ref string `json:"ref"`
Required []string `json:"required,omitempty"`
CodeScanning bool `json:"code_scanning,omitempty"`
TimeoutMin int `json:"timeout_min,omitempty"`
IntervalSec int `json:"interval_sec,omitempty"`
Remote string `json:"remote,omitempty"`
}
WaitCIArgs is `gofer/wait-ci`'s `with:` block.