runner

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package runner is the container-backend sandbox runner entry point (`boid runner-container`, runner_container_linux.go's RunContainer). See docs/{ja,en}/architecture/sandbox-internals.md for the current launch chain.

This file holds the portable helpers RunContainer uses (spec decoding, signal mapping, the post-namespace-setup file/symlink/PATH/job-done steps) so they can be unit-tested independent of any syscall or container-runtime path.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunContainer added in v0.1.0

func RunContainer(specPath, statePath string) (exitCode int, retErr error)

RunContainer is the `boid runner-container` entry point and the entry point of every sandboxed job: the image's own ENTRYPOINT is ["/usr/local/bin/boid","runner-container"] (build/container/Dockerfile). It runs the post-namespace-setup sequence (write spec.Files, materialize spec.Symlinks, run the sandbox-internal clone if declared, resolve PATH, dispatch to the harness adapter, report job-done) via the shared helpers in runner.go.

The container runtime supplies its own network namespace and egress policy (compose network / egress proxy) and already provides process/mount namespace isolation — the image's own rootfs *is* the sandbox root the moment this process starts, so there is no clone/pivot_root sequence to run here. `HostConfig.Init: true` (docker-init/tini) is PID 1: it owns zombie reap and SIGUSR1 delivery to this process, and the harness adapters' own sigutil.ForwardAndWait (internal/adapters/sigutil) translates a received SIGUSR1 into the agent's graceful SIGTERM.

Types

type State

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

State appends NDJSON diagnostic records to /tmp/boid-<id>-runner-state.json. Each write is a single appended line followed by Sync(), so a panic / kill -9 still leaves the last reached phase flushed on disk. Every method is nil-safe.

func OpenState

func OpenState(path string) *State

OpenState opens (creating) the state file for append. A nil *State (returned when path is empty or open fails) makes all subsequent methods no-ops so the diagnostic path never blocks the run.

func (*State) Close

func (s *State) Close()

Close closes the underlying file.

func (*State) Fail

func (s *State) Fail(stage, phase string, err error)

Fail records a failed phase with an error detail.

func (*State) OK

func (s *State) OK(stage, phase string)

OK records a successful phase.

func (*State) Phase

func (s *State) Phase(stage, phase, status, detail string)

Phase records a single phase transition with ok/error status.

func (*State) Spec

func (s *State) Spec(stage string, spec sandbox.Spec)

Spec records the launch-time spec dump (first line of the file).

Jump to

Keyboard shortcuts

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