Module: Bsdkrun

Defined in:
lib/bsdkrun.rb,
lib/bsdkrun/ci.rb,
lib/bsdkrun/args.rb,
lib/bsdkrun/cache.rb,
lib/bsdkrun/types.rb,
lib/bsdkrun/binary.rb,
lib/bsdkrun/client.rb,
lib/bsdkrun/errors.rb,
lib/bsdkrun/images.rb,
lib/bsdkrun/system.rb,
lib/bsdkrun/process.rb,
lib/bsdkrun/sandbox.rb,
lib/bsdkrun/version.rb,
lib/bsdkrun/volumes.rb,
lib/bsdkrun/networks.rb,
lib/bsdkrun/ws_client.rb,
lib/bsdkrun/filesystem.rb,
lib/bsdkrun/shell_session.rb,
lib/bsdkrun/websocket_frame.rb

Overview

bsdkrun — a Ruby SDK for bsdkrun, a Firecracker-style microVM launcher for BSD, Linux, and unikernel guests. A thin wrapper around the bsdkrun CLI: it builds argv, shells out, and parses JSON output.

Examples:

require "bsdkrun"

sbx = Bsdkrun::Sandbox.create(os: "linux", image: "alpine")
puts sbx.exec(["uname", "-a"]).text
sbx.stop

Defined Under Namespace

Modules: Args, Binary, Caches, Images, Networks, Process, System, Volumes, WebSocketFrame Classes: AiAgent, AiSession, AuthError, BinaryNotFound, CIWorkflow, Cache, CacheEntry, Client, CommandFailed, CommandResult, DockerContainer, DockerStatus, Error, ExecResult, FileSystem, FileTransferFailed, GraphQLError, ImageInfo, NetworkInfo, PortForward, RestoreResult, Result, Sandbox, SandboxInfo, SandboxNotFound, ShellSession, ShellSessionInfo, SnapshotInfo, VolumeInfo, WsClient

Constant Summary collapse

VERSION =

The bsdkrun Ruby SDK version.

"0.6.0"

Class Method Summary collapse

Class Method Details

.binary_pathString

Returns the resolved bsdkrun binary path.

Returns:

  • (String)

    the resolved bsdkrun binary path.

Raises:



43
44
45
# File 'lib/bsdkrun.rb', line 43

def binary_path
  Binary.resolve
end

.binary_path=(path) ⇒ void

This method returns an undefined value.

Force the SDK to use a specific bsdkrun binary, bypassing discovery.

Parameters:

  • path (String, nil)


37
38
39
# File 'lib/bsdkrun.rb', line 37

def binary_path=(path)
  Binary.override = path
end

.create(opts = {}, **kwargs) ⇒ Sandbox

Convenience alias for Bsdkrun::Sandbox.create.

Returns:



55
56
57
# File 'lib/bsdkrun.rb', line 55

def create(opts = {}, **kwargs)
  Sandbox.create(opts, **kwargs)
end

.get(id) ⇒ Sandbox

Convenience alias for Bsdkrun::Sandbox.get.

Returns:



61
62
63
# File 'lib/bsdkrun.rb', line 61

def get(id)
  Sandbox.get(id)
end

.imagesModule

The Images namespace.

Returns:

  • (Module)


73
74
75
# File 'lib/bsdkrun.rb', line 73

def images
  Images
end

.list(all: false) ⇒ Array<SandboxInfo>

Convenience alias for Bsdkrun::Sandbox.list.

Returns:



67
68
69
# File 'lib/bsdkrun.rb', line 67

def list(all: false)
  Sandbox.list(all: all)
end

.networksModule

The Networks namespace.

Returns:

  • (Module)


85
86
87
# File 'lib/bsdkrun.rb', line 85

def networks
  Networks
end

.reset_binary!void

This method returns an undefined value.

Reset cached binary discovery state (mainly for tests).



49
50
51
# File 'lib/bsdkrun.rb', line 49

def reset_binary!
  Binary.reset!
end

.systemModule

The System namespace.

Returns:

  • (Module)


91
92
93
# File 'lib/bsdkrun.rb', line 91

def system
  System
end

.volumesModule

The Volumes namespace.

Returns:

  • (Module)


79
80
81
# File 'lib/bsdkrun.rb', line 79

def volumes
  Volumes
end

.workflow(name) ⇒ Object

Start a CI workflow definition.



201
202
203
# File 'lib/bsdkrun/ci.rb', line 201

def self.workflow(name)
  CIWorkflow.new(name)
end