SDK Reference
machine
The machine
module provides functions for interacting with the host machine.
Allowed in
- build
- deploy
- destroy
- task
Usage
Load the module:
Example
API Reference
shell(command, shell=“sh”, env=, mute=False, continue_on_error=False)
Runs a shell command on the host machine.
Arguments
command
: Shell command to runshell
: Shell to use (e.g., “sh”, “bash”)env
: Dictionary of environment variablesmute
: Whether to suppress command outputcontinue_on_error
: Whether to continue if command fails
Returns
- Struct containing:
combined_output
: Interleaved stdout and stderrstdout
: Command standard outputstderr
: Command standard errorexit_code
: Command exit code
os()
Returns the operating system of the host machine.
Returns
- String like “linux”, “darwin”, “windows” (matches Go’s GOOS values)
arch()
Returns the architecture of the host machine.
Returns
- String like “amd64”, “arm64” (matches Go’s GOARCH values)
env_var(name)
Returns the value of an environment variable on the host machine.
Arguments
name
: Name of the environment variable
Returns
- Value of the environment variable or None if not set