Skip to main content
Version: 0.14.0

Runtime Selection Flowchart

This diagram documents the decision tree for selecting which runtime executes a command. Understanding this helps users choose the right runtime for their use case.

Decision Flowchart

Diagram: architecture/runtime-decision

Platform Selection Details

Diagram: architecture/runtime-platform

Platform Values

Platform ValueMatches On
"linux"Linux systems
"macos"macOS systems
"windows"Windows systems
note

At least one platform must be specified per implementation. There is no "all platforms" shorthand — list each target platform explicitly.

Example Command Definition

cmds: [{
name: "build"
implementations: [
{
script: {content: "nmake build"}
runtimes: [{name: "native"}]
platforms: [{name: "windows"}]
},
{
script: {content: "make build"}
runtimes: [{name: "container", image: "debian:stable-slim"}]
platforms: [{name: "linux"}]
},
{
script: {content: "make build"}
runtimes: [{name: "native"}]
platforms: [{name: "macos"}]
},
]
}]

Runtime Comparison

AspectNativeVirtual-ShVirtual-LuaContainer
SpeedFastestFastFastSlower (overhead)
IsolationNoneNone (not a sandbox)None (not a sandbox)Full
PortabilityPlatform-dependentHighHighHighest
LanguageHost shellPOSIX subsetLuaFull (in container)
DependenciesHost shellBuilt-ins or allowed binariesLua stdlib or allowed helpersDocker/Podman
Best forSimple scriptsCross-platform shellCross-platform LuaComplex environments

Runtime Resolution Precedence

Runtime mode is resolved in this order:

  1. --ivk-runtime CLI override — hard fail if incompatible with the selected implementation
  2. default_runtime from config — used only when compatible with the implementation
  3. Command default runtime — the runtime specified in the selected platform implementation
warning

There is no implicit native → virtual fallback when native is unavailable. If the native runtime is requested but cannot run (e.g., no shell found), the command fails rather than silently switching to virtual.

Runtime Availability Checks

Native Runtime

Diagram: architecture/runtime-native-check

Virtual-Sh And Virtual-Lua Runtimes

Diagram: architecture/runtime-virtual-check

The virtual-sh and virtual-lua runtimes are always available because they are embedded in the Invowk binary.

Container Runtime

Diagram: architecture/runtime-container-check

Container Provisioning Details

For ephemeral container execution, Invowk prepares an image and creates an ephemeral image layer. Existing persistent container targets can skip image preparation and use Exec directly. Missing persistent targets fail before image preparation unless create_if_missing is enabled, in which case Invowk prepares the image, creates/starts the persistent container, then uses Exec:

Diagram: architecture/runtime-provision

Why Ephemeral Layers?

  1. No image pollution: Base images stay clean
  2. Fast iteration: No full rebuild needed
  3. Portable: Commands work with any compatible base image
  4. Secure: Invowk binary is injected, not installed in image

SSH Server for Callbacks

When enable_host_ssh: true is set, Invowk starts a temporary SSH server:

Diagram: architecture/runtime-ssh

Use cases:

  • Accessing host secrets
  • Running host-only commands
  • File synchronization

Decision Guidelines

Use CaseRecommended RuntimeWhy
Quick scriptsnativeFastest, no overhead
Cross-platform shell commandsvirtual-shWorks everywhere
Cross-platform Lua commandsvirtual-luaWorks everywhere
CI/CD pipelinescontainerReproducible
Commands needing specific toolscontainerIsolated dependencies
Interactive TUInative, virtual-sh, or virtual-luaPTY-backed interactive support