runner

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package runner builds and runs pack binaries (local, uploaded, or remote) behind a common interface.

Package runner provides abstractions for executing pack commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryRunner

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

BinaryRunner executes pack commands using a local binary.

func NewBinaryRunner

func NewBinaryRunner(packPath string, envVars map[string]string) *BinaryRunner

NewBinaryRunner creates a runner for a binary pack. envVars are run-specific environment variables merged with the process env. Pass nil to inherit the process environment as-is (CLI path).

func (*BinaryRunner) Close

func (r *BinaryRunner) Close() error

Close cleans up any resources. For binary runners, this is a no-op.

func (*BinaryRunner) GetStderr

func (r *BinaryRunner) GetStderr() io.Reader

GetStderr returns the captured stderr output.

func (*BinaryRunner) RunCommand

func (r *BinaryRunner) RunCommand(ctx context.Context, command string, input []byte) ([]byte, error)

RunCommand executes a pack command with input on stdin.

func (*BinaryRunner) String

func (r *BinaryRunner) String() string

String returns a description of the runner.

type Factory

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

Factory creates PackRunners based on pack configuration.

func NewFactory

func NewFactory(dataDir string) (*Factory, error)

NewFactory creates a new runner factory rooted at dataDir. SSH-log routing is the caller's responsibility: set SR_SSH_LOG_DIR in the per-run envVars map handed to CreateRunner if you want the pack SDK to write SSH command logs.

func (*Factory) CreateRunner

func (f *Factory) CreateRunner(ctx context.Context, cfg config.PackConfig, envVars map[string]string) (PackRunner, error)

CreateRunner returns the appropriate runner for the pack type. envVars are run-specific environment variables that override the process env. Pass nil to inherit the process environment as-is.

func (*Factory) GetManifest

func (f *Factory) GetManifest(ctx context.Context, cfg config.PackConfig, parameters map[string]any, envVars map[string]string) (*pack.ManifestResponse, error)

GetManifest retrieves the manifest for a pack by running the manifest command. Parameters are optional key-value configuration passed to the pack via stdin. envVars are run-specific environment variables (pass nil for CLI/management paths).

type PackRunner

type PackRunner interface {
	// RunCommand executes a pack command with JSON input on stdin
	// and returns JSON output from stdout. Stderr is captured internally
	// and can be retrieved via GetStderr().
	RunCommand(ctx context.Context, command string, input []byte) ([]byte, error)

	// GetStderr returns the captured stderr output after RunCommand completes.
	GetStderr() io.Reader

	// String returns a description of the runner for logging.
	String() string

	// Close cleans up any resources held by the runner.
	Close() error
}

PackRunner abstracts the execution of pack commands.

type PackRunnerFactory

type PackRunnerFactory interface {
	// CreateRunner returns the appropriate runner for the pack type.
	CreateRunner(ctx context.Context, cfg config.PackConfig) (PackRunner, error)

	// GetManifest retrieves the manifest for a pack.
	// Parameters are optional key-value configuration passed to the pack via stdin.
	GetManifest(ctx context.Context, cfg config.PackConfig, parameters map[string]any) (*pack.ManifestResponse, error)
}

PackRunnerFactory creates PackRunners based on pack configuration.

Jump to

Keyboard shortcuts

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