sandbox

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sandbox is the seam between a check runner and the place where check code runs. A Sandbox is the only way that the runner executes the argv of a check, and every implementation must isolate that argv from the host.

Index

Constants

View Source
const CacheMount = "/cache"

CacheMount is the path at which a container sandbox shows Spec.Cache.

Variables

This section is empty.

Functions

func CacheEnv

func CacheEnv(dir string) []string

CacheEnv returns the variables that point the caches of the argv at the cache directory dir as the argv sees it.

Types

type Outcome

type Outcome struct {
	ExitCode int
	TimedOut bool
}

Outcome is how a run ended. A non-zero ExitCode is not an error: the check failed.

type Sandbox

type Sandbox interface {
	Run(ctx context.Context, spec Spec) (Outcome, error)
}

Sandbox runs a check. Run returns an error only when the sandbox itself fails or when ctx ends before the argv does. A missing argv[0] ends with ExitCode 127. When Run returns, no process of the run is left.

type Spec

type Spec struct {
	// Dir is a host directory that holds the tree. The argv runs with the root of Dir as its working directory and may write there.
	Dir  string
	Argv []string
	// Timeout is the longest run time. When it passes, the sandbox kills every process that the argv started.
	Timeout time.Duration
	// Cache is an optional host directory that persists across runs. The argv sees it as read-write at the path in the
	// variable WARD_CACHE_DIR, which CacheEnv sets with the Go and XDG cache variables. It never holds the tree.
	Cache string
	// Output receives the standard output and the standard error of the argv, interleaved.
	Output io.Writer
}

Spec is one run.

Directories

Path Synopsis
Package container runs a check in an OCI container through the command line of an engine such as docker or podman.
Package container runs a check in an OCI container through the command line of an engine such as docker or podman.
Package fake is the minimal implementation of sandbox.Sandbox for tests.
Package fake is the minimal implementation of sandbox.Sandbox for tests.
Package gvisor runs a check in an OCI container under the gVisor runtime runsc, through a container engine.
Package gvisor runs a check in an OCI container under the gVisor runtime runsc, through a container engine.
Package sandboxtest is the conformance suite of sandbox.Sandbox.
Package sandboxtest is the conformance suite of sandbox.Sandbox.

Jump to

Keyboard shortcuts

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