command

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2025 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoHostsConfigured = errors.New("no hosts configured")
)
View Source
var (

	// ErrRunFailed indicates that a run failed with an error
	ErrRunFailed = errors.New("run failed")
)
View Source
var (
	PluginFuncs = map[string]func(ExecPluginOptions, *plugin.Plugin) (any, error){
		"apply":       applyPlugin,
		"filter":      filterPlugin,
		"onPrClosed":  onPrClosedPlugin,
		"onPrCreated": onPrCreatedPlugin,
		"onPrMerged":  onPrMergedPlugin,
	}
)

Functions

func ExecPlugin added in v0.12.0

func ExecPlugin(funcName string, opts ExecPluginOptions) error

ExecPlugin executes the function of a plugin specified by `funcName`. It creates a temporary directory if `opts` doesn't specify one. It decodes the context content to send to the plugin from JSON.

Types

type CiRunner added in v0.14.0

type CiRunner struct {
	Opts options.Opts
}

func NewCiRunner added in v0.14.0

func NewCiRunner(opts options.Opts) (*CiRunner, error)

func NewCiRunnerFromConfig added in v0.14.0

func NewCiRunnerFromConfig(configFile string, skipPlugins bool) (*CiRunner, error)

NewCiRunnerFromConfig creates a new CiRunner by reading from configFile. It ignores some errors that are not relevant in a CI run.

func (*CiRunner) Run added in v0.14.0

func (ci *CiRunner) Run(out io.Writer, taskFiles ...string) error

Run reads and validates taskFiles and writes a message to out for each file.

type ExecPluginOptions added in v0.12.0

type ExecPluginOptions struct {
	Addr      string
	Config    map[string]string
	Context   *protoV1.Context
	LogFormat string
	LogLevel  string
	Out       io.Writer
	Path      string
	WorkDir   string
}

ExecPluginOptions defines all options expected by function ExecPlugin.

type NewScheduleRunnerOptions added in v0.24.0

type NewScheduleRunnerOptions struct {
	HttpClient   *http.Client
	ServerApiKey string
	ServerUrl    string
}

NewScheduleRunnerOptions defines all options expected by NewScheduleRunner.

type Run added in v0.9.0

type Run struct {
	Clock            clock.Clock
	DryRun           bool
	Hosts            []host.Host
	Processor        processor.RepositoryTaskProcessor
	PullRequestCache host.PullRequestCache
	PushGateway      *push.Pusher
	RepositoryLister host.RepositoryLister
	TaskRegistry     *task.Registry
}

func (*Run) Run added in v0.9.0

func (r *Run) Run(repositoryNames, taskFiles []string, inputs map[string]string) ([]RunResult, error)

type RunResult

type RunResult struct {
	Error          error
	PullRequest    *host.PullRequest
	RepositoryName string
	Result         processor.Result
	TaskName       string
}

func ExecuteRun

func ExecuteRun(opts options.Opts, repositoryNames, taskFiles []string, inputs map[string]string) ([]RunResult, error)

type ScheduleRunner added in v0.24.0

type ScheduleRunner struct {
	// contains filtered or unexported fields
}

ScheduleRunner wraps the logic to schedule a new run.

func NewScheduleRunner added in v0.24.0

func NewScheduleRunner(opts NewScheduleRunnerOptions) (*ScheduleRunner, error)

NewScheduleRunner initializes a new ScheduleRunner from NewScheduleRunnerOptions.

func (*ScheduleRunner) Run added in v0.24.0

Run schedules a new run from payload via the API of saturn-bot server.

type ScheduleRunnerRunOptions added in v0.24.0

type ScheduleRunnerRunOptions struct {
	// OutLog is the writer that [ScheduleRunner]
	// writes human-readable log messages to.
	OutLog io.Writer
	// OutReport is the writer that [ScheduleRunner]
	// writes task results to, if the user requests it.
	OutReport io.Writer
	// OutputFormat defines the output format to use.
	OutputFormat string
	// ScheduleRequest is the data to send to saturn-bot server.
	ScheduleRequest client.ScheduleRunV1Request
	// WaitFor is the total amount of time to wait for the run to complete.
	WaitFor time.Duration
	// WaitInterval is the time between requests sent to saturn-bot server
	// to check if the run has finished.
	WaitInterval time.Duration
}

ScheduleRunnerRunOptions are all options expected by ScheduleRunnerRunOptions.

type TryRunner

type TryRunner struct {
	ApplyActionsFunc func(actions []action.Action, ctx context.Context, dir string) error
	GitClient        git.GitClient
	Hosts            []host.Host
	Inputs           map[string]string
	Out              io.Writer
	Registry         *task.Registry
	RepositoryName   string
	TaskFile         string
	TaskName         string
}

func NewTryRunner

func NewTryRunner(opts options.Opts, dataDir string, repositoryName string, taskFile string, taskName string, inputs map[string]string) (*TryRunner, error)

func (*TryRunner) Run

func (r *TryRunner) Run() error

Jump to

Keyboard shortcuts

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