executor

package
v0.1.1-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllExecutors

func GetAllExecutors() []string

func GetSchema

func GetSchema(name string) (interface{}, error)

GetSchema returns the config schema of the executor

func RegisterExecutor

func RegisterExecutor(name string, factory NewExecutorFunc)

RegisterExecutor should be called by executor modules their init() function.

func RegisterSchema

func RegisterSchema(name string, schema interface{})

RegisterSchema should be called by executor modules to register their config schema

Types

type ExecutionContext

type ExecutionContext struct {
	// WithConfig is the yaml config passed to the executor
	WithConfig []byte
	Inputs     map[string]any
	Stdout     io.Writer
	Stderr     io.Writer
	ExecID     string
}

type Executor

type Executor interface {
	Execute(ctx context.Context, execCtx ExecutionContext) (outputs map[string]string, err error)
}

type LocalLinuxDriver

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

func (*LocalLinuxDriver) Close

func (d *LocalLinuxDriver) Close() error

func (*LocalLinuxDriver) CreateDir

func (d *LocalLinuxDriver) CreateDir(ctx context.Context, path string) error

func (*LocalLinuxDriver) CreateFile

func (d *LocalLinuxDriver) CreateFile(ctx context.Context, path string) error

func (*LocalLinuxDriver) Dial

func (d *LocalLinuxDriver) Dial(network, address string) (net.Conn, error)

func (*LocalLinuxDriver) Download

func (d *LocalLinuxDriver) Download(ctx context.Context, remotePath, localPath string) error

func (*LocalLinuxDriver) Exec

func (d *LocalLinuxDriver) Exec(ctx context.Context, command string, workingDir string, env []string, stdout, stderr io.Writer) error

func (*LocalLinuxDriver) GetWorkingDirectory

func (d *LocalLinuxDriver) GetWorkingDirectory() string

func (*LocalLinuxDriver) IsRemote

func (d *LocalLinuxDriver) IsRemote() bool

func (*LocalLinuxDriver) Join

func (d *LocalLinuxDriver) Join(parts ...string) string

func (*LocalLinuxDriver) ListFiles

func (d *LocalLinuxDriver) ListFiles(ctx context.Context, dirPath string) ([]string, error)

func (*LocalLinuxDriver) Remove

func (d *LocalLinuxDriver) Remove(ctx context.Context, path string) error

func (*LocalLinuxDriver) SetPermissions

func (d *LocalLinuxDriver) SetPermissions(ctx context.Context, path string, perms os.FileMode) error

func (*LocalLinuxDriver) TempDir

func (d *LocalLinuxDriver) TempDir() string

func (*LocalLinuxDriver) Upload

func (d *LocalLinuxDriver) Upload(ctx context.Context, localPath, remotePath string) error

type NewExecutorFunc

type NewExecutorFunc func(name string, driver NodeDriver) (Executor, error)

NewExecutorFunc defines the signature for a function that can create an executor.

func GetNewExecutorFunc

func GetNewExecutorFunc(name string) (NewExecutorFunc, error)

GetNewExecutorFunc is used to retrieve the NewExecutorFunc for an executor

type Node

type Node struct {
	Hostname       string
	Port           int
	Username       string
	Auth           NodeAuth
	ConnectionType string
	OSFamily       string
}

type NodeAuth

type NodeAuth struct {
	Method string
	Key    string
}

type NodeDriver

type NodeDriver interface {
	Upload(ctx context.Context, localPath, remotePath string) error
	Download(ctx context.Context, remotePath, localPath string) error
	CreateDir(ctx context.Context, path string) error
	CreateFile(ctx context.Context, path string) error
	GetWorkingDirectory() string
	Remove(ctx context.Context, path string) error
	SetPermissions(ctx context.Context, path string, perms os.FileMode) error
	Exec(ctx context.Context, command string, workingDir string, env []string, stdout, stderr io.Writer) error
	Dial(network, address string) (net.Conn, error)
	IsRemote() bool
	TempDir() string
	Join(parts ...string) string
	// ListFiles should only return top level files and no directories
	ListFiles(ctx context.Context, dirPath string) ([]string, error)
	Close() error
}

func NewLocalLinux

func NewLocalLinux() (NodeDriver, error)

func NewNodeDriver

func NewNodeDriver(ctx context.Context, node Node) (NodeDriver, error)

func NewRemoteLinux

func NewRemoteLinux(client remoteclient.RemoteClient) (NodeDriver, error)

type RemoteLinuxDriver

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

func (*RemoteLinuxDriver) Close

func (d *RemoteLinuxDriver) Close() error

func (*RemoteLinuxDriver) CreateDir

func (d *RemoteLinuxDriver) CreateDir(ctx context.Context, dirPath string) error

func (*RemoteLinuxDriver) CreateFile

func (d *RemoteLinuxDriver) CreateFile(ctx context.Context, filePath string) error

func (*RemoteLinuxDriver) Dial

func (d *RemoteLinuxDriver) Dial(network, address string) (net.Conn, error)

func (*RemoteLinuxDriver) Download

func (d *RemoteLinuxDriver) Download(ctx context.Context, remotePath, localPath string) error

func (*RemoteLinuxDriver) Exec

func (d *RemoteLinuxDriver) Exec(ctx context.Context, command string, workingDir string, env []string, stdout, stderr io.Writer) error

func (*RemoteLinuxDriver) GetWorkingDirectory

func (d *RemoteLinuxDriver) GetWorkingDirectory() string

func (*RemoteLinuxDriver) IsRemote

func (d *RemoteLinuxDriver) IsRemote() bool

func (*RemoteLinuxDriver) Join

func (d *RemoteLinuxDriver) Join(parts ...string) string

func (*RemoteLinuxDriver) ListFiles

func (d *RemoteLinuxDriver) ListFiles(ctx context.Context, dirPath string) ([]string, error)

func (*RemoteLinuxDriver) Remove

func (d *RemoteLinuxDriver) Remove(ctx context.Context, filePath string) error

func (*RemoteLinuxDriver) SetPermissions

func (d *RemoteLinuxDriver) SetPermissions(ctx context.Context, filePath string, perms os.FileMode) error

func (*RemoteLinuxDriver) TempDir

func (d *RemoteLinuxDriver) TempDir() string

func (*RemoteLinuxDriver) Upload

func (d *RemoteLinuxDriver) Upload(ctx context.Context, localPath, remotePath string) error

Jump to

Keyboard shortcuts

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