Documentation
¶
Overview ¶
Package taskrun loads and executes named commands from a hydra.yml config.
Index ¶
- type Commands
- func (c *Commands) EffectiveCommands(workDir string) map[string]string
- func (c *Commands) HasCommand(name, workDir string) bool
- func (c *Commands) Run(name, workDir string) error
- func (c *Commands) RunDev(ctx context.Context, workDir string) error
- func (c *Commands) RunNotify(title, message string) (bool, error)
- func (c *Commands) RunTeardown(workDir string) error
- type Duration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Commands ¶
type Commands struct {
Model string `yaml:"model"`
APIType string `yaml:"api_type"`
GiteaURL string `yaml:"gitea_url"`
Timeout *Duration `yaml:"timeout"`
Notify string `yaml:"notify"`
Teardown string `yaml:"teardown"`
Commands map[string]string `yaml:"commands"`
}
Commands holds the named commands loaded from hydra.yml.
func (*Commands) EffectiveCommands ¶
EffectiveCommands returns the commands map including Makefile fallbacks. For each standard command name (clean, dev, test, lint) not configured in hydra.yml, if a matching Makefile target exists in workDir, it is included as "make <name>".
func (*Commands) HasCommand ¶
HasCommand reports whether a command is available for the given name, either from hydra.yml or via a Makefile target in workDir.
func (*Commands) Run ¶
Run executes the named command in the given working directory. The command is run via $SHELL -c, so shell features like pipes and variable expansion work. Falls back to "make <name>" if the command is not configured in hydra.yml but a Makefile with that target exists. Returns nil if neither is available.
func (*Commands) RunDev ¶
RunDev executes the named "dev" command in the given working directory. The command runs until it exits or the context is cancelled. Falls back to "make dev" if no dev command is configured but a Makefile with a dev target exists. Returns an error if neither is available.
func (*Commands) RunNotify ¶
RunNotify executes the configured notify command with title and message as arguments. Returns false if no notify command is configured.
func (*Commands) RunTeardown ¶
RunTeardown executes the configured teardown command in the given working directory. Returns nil if no teardown command is configured.