docker

package
v0.1.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSDKConnection

func CheckSDKConnection(ctx context.Context) error

CheckSDKConnection verifies that Docker Engine is reachable.

func NewSDKClient

func NewSDKClient() (*client.Client, error)

NewSDKClient creates a Docker Engine API client using the user's Docker environment configuration.

func Run

func Run(
	ctx context.Context,
	workspace string,
	argv []string,
	stdout, stderr io.Writer,
) (int, error)

func RunWithSDK

func RunWithSDK(
	ctx context.Context,
	workspace string,
	argv []string,
	user string,
	stdout, stderr io.Writer,
) (int, error)

RunWithSDK executes a command using the legacy Alpine runtime.

func RunWithSDKRuntime

func RunWithSDKRuntime(
	ctx context.Context,
	workspace string,
	argv []string,
	user string,
	stdout, stderr io.Writer,
	runtime *RuntimeSpec,
) (int, error)

RunWithSDKRuntime executes a command using an allowlisted runtime.

func RunWithSDKRuntimeModules

func RunWithSDKRuntimeModules(
	ctx context.Context,
	workspace string,
	argv []string,
	user string,
	stdout, stderr io.Writer,
	runtime *RuntimeSpec,
	artifactsDir string,
) (int, error)

RunWithSDKRuntimeModules executes a Go command with staged module artifacts. The caller must provide a trusted, immutable staging directory.

func RunWithSDKRuntimeOfflineExec

func RunWithSDKRuntimeOfflineExec(
	ctx context.Context,
	workspace string,
	argv []string,
	user string,
	stdout, stderr io.Writer,
	runtime *RuntimeSpec,
	cacheDir string,
) (exitCode int, runErr error)

func RunWithSDKRuntimeSnapshotExec

func RunWithSDKRuntimeSnapshotExec(
	ctx context.Context,
	workspaceTAR []byte,
	moduleTAR []byte,
	argv []string,
	user string,
	stdout, stderr io.Writer,
	runtime *RuntimeSpec,
) (exitCode int, runErr error)

RunWithSDKRuntimeSnapshotExec executes offline Go commands using Docker-managed volumes rather than host bind mounts.

The caller supplies TAR archives constructed from verified capsule data. The executor owns all Docker resources.

func RunWithSDKRuntimeSnapshotExecSelectiveReadersV3

func RunWithSDKRuntimeSnapshotExecSelectiveReadersV3(
	ctx context.Context,
	workspaceTAR io.Reader,
	moduleTAR io.Reader,
	argv []string,
	expected []ExpectedGoModule,
	materialized []ExpectedGoModule,
	memoryBytes int64,
	user string,
	stdout, stderr io.Writer,
	runtime *RuntimeSpec,
) (int, error)

RunWithSDKRuntimeSnapshotExecSelectiveReadersV3 runs selective offline Go replay using two prevalidated TAR readers. Readers are consumed once and are not closed by this function.

func RunWithSDKRuntimeSnapshotExecSelectiveV3

func RunWithSDKRuntimeSnapshotExecSelectiveV3(
	ctx context.Context,
	workspaceTAR []byte,
	moduleTAR []byte,
	argv []string,
	expected []ExpectedGoModule,
	materialized []ExpectedGoModule,
	memoryBytes int64,
	user string,
	stdout, stderr io.Writer,
	runtime *RuntimeSpec,
) (int, error)

RunWithSDKRuntimeSnapshotExecSelectiveV3 materializes only modules with complete ZIP artifacts, while verifying the full selected Go module graph before executing the captured command.

func RunWithSDKRuntimeSnapshotExecVerified

func RunWithSDKRuntimeSnapshotExecVerified(
	ctx context.Context,
	workspaceTAR []byte,
	moduleTAR []byte,
	argv []string,
	expected []ExpectedGoModule,
	user string,
	stdout, stderr io.Writer,
	runtime *RuntimeSpec,
) (int, error)

RunWithSDKRuntimeSnapshotExecVerified requires an exact offline Go module graph match before executing the captured command.

func RunWithSDKRuntimeSnapshotExecVerifiedWithMemory

func RunWithSDKRuntimeSnapshotExecVerifiedWithMemory(
	ctx context.Context,
	workspaceTAR []byte,
	moduleTAR []byte,
	argv []string,
	expected []ExpectedGoModule,
	memoryBytes int64,
	user string,
	stdout, stderr io.Writer,
	runtime *RuntimeSpec,
) (int, error)

RunWithSDKRuntimeSnapshotExecVerifiedWithMemory runs schema-v3 replay with an explicitly bounded execution-container memory limit.

func RunWithSDKRuntimeTarget

func RunWithSDKRuntimeTarget(
	ctx context.Context,
	workspace string,
	argv []string,
	user string,
	stdout, stderr io.Writer,
	runtime *RuntimeSpec,
	targetOS string,
	targetArch string,
) (int, error)

RunWithSDKRuntimeTarget executes a command with an explicit Go target.

func RunWithUser

func RunWithUser(
	ctx context.Context,
	workspace string,
	argv []string,
	user string,
	stdout, stderr io.Writer,
) (int, error)

Types

type ExpectedGoModule

type ExpectedGoModule struct {
	Path    string
	Version string
}

ExpectedGoModule identifies a selected external Go module.

type RuntimeSpec

type RuntimeSpec struct {
	Kind    string
	Version string
}

type SnapshotVolumes

type SnapshotVolumes struct {
	Workspace   string
	ModuleCache string
	// contains filtered or unexported fields
}

SnapshotVolumes owns Docker resources created for one replay. Close must be called before closing the Docker client.

Not safe for concurrent use.

func CreateSnapshotVolumes

func CreateSnapshotVolumes(
	ctx context.Context,
	dockerClient *client.Client,
	image string,
	workspaceTAR, moduleTAR []byte,
) (*SnapshotVolumes, error)

CreateSnapshotVolumes uploads two in-memory TAR archives into separate Docker-managed volumes.

image must already be available to the Docker daemon. The caller owns the returned volumes and must call Close.

func CreateSnapshotVolumesFromReaders

func CreateSnapshotVolumesFromReaders(
	ctx context.Context,
	dockerClient *client.Client,
	image string,
	workspaceTAR, moduleTAR io.Reader,
) (*SnapshotVolumes, error)

CreateSnapshotVolumesFromReaders uploads two TAR streams into Docker-managed volumes without materializing them as byte slices.

Readers must remain valid until this call returns. They are consumed once and are not closed by this function.

func (*SnapshotVolumes) Close

func (v *SnapshotVolumes) Close() error

Close removes the volumes and any remaining preparation containers. It uses a fresh context even if replay was canceled.

Jump to

Keyboard shortcuts

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