workflowstep

package
v0.187.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const (
	NamePush       = "push"
	NameWaitCI     = "wait-ci"
	NameWaitAssets = "wait-assets"
)

Step names the first batch of built-in steps (design §一·5).

View Source
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).

View Source
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 Args

func Args(uses string, with map[string]any) (any, error)

Args decodes a `with:` block into the step's arguments (used before running).

func Names

func Names() []string

Names lists the registered step names, in registration order.

func ParseUses

func ParseUses(uses string) (string, error)

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.

func Run

func Run(ctx context.Context, name string, with map[string]any, dir string) (any, error)

Run executes a built-in step by name in dir (the command's working directory), after decoding and validating its `with:` block once more: the executing machine does not trust that the submit-time validation and this binary agree.

func Validate

func Validate(uses string, with map[string]any) error

Validate checks a `uses:` value and its `with:` block at submit time: the step exists and the block decodes strictly into the step's own arguments and passes its checks.

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.

func Lookup

func Lookup(name string) (*Step, bool)

Lookup returns the registered step of an un-prefixed name.

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.

Jump to

Keyboard shortcuts

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