run-dev
GitHub提供 CubeSandbox 项目的构建、测试和开发流程指导,涵盖 Docker 环境下的 Go/Rust 组件编译、单测执行及集成测试,辅助开发者完成代码开发与验证任务。
Trigger Scenarios
Install
npx skills add TencentCloud/CubeSandbox --skill run-dev -g -y
SKILL.md
Frontmatter
{
"name": "run-dev",
"description": "Build, test, format, and develop CubeSandbox components. Use when asked to build, compile, run tests, format code, or do development work on this project."
}
CubeSandbox Development Skill
CubeSandbox is a monorepo sandbox service (Go + Rust + Web). All component
builds run inside a Docker builder container via make targets at the
repo root. The builder image provides Go 1.24, Rust 1.89, protoc, and all
build dependencies.
Paths in this document are relative to the repo root
Prerequisites
# Docker must be running
docker info > /dev/null 2>&1 || { echo "Docker is not running"; exit 1; }
The builder image is built once (or when toolchains change):
make builder-image
Build
All builds happen inside the cube-sandbox-builder:ubuntu2004 Docker image.
Binaries land in _output/bin/.
Build all Go components
make all
This builds: cubemaster, cubelet, cubevsmapdump, network-agent, agent, cubeapi, shim.
Build individual components
| Command | Component | Language | Time |
|---|---|---|---|
make cubemaster |
Master scheduler + CLI | Go | ~30s |
make cubelet |
Per-node sandbox agent + CLI | Go + Rust (cubecow SDK) | ~90s |
make agent |
In-guest agent daemon | Rust | ~2min |
make cubeapi or make cube-api |
E2B-compatible REST API | Rust (musl) | ~3min |
make shim |
containerd shim + runtime | Rust | ~2min |
make network-agent |
Network management | Go | ~30s |
make cubevsmapdump |
eBPF map dump tool | Go | ~20s |
make cube-proxy-sidecar |
Proxy sidecar (dev only) | Go | ~20s |
make cubecow-smoke |
CubeCoW smoke test | Go + Rust | ~60s |
make cube-init / make guest-init |
Guest PID1 (cube-init) |
Rust (musl) | ~30s |
make agent-ext4 / make cube-agent-ext4 |
Independent cube-agent.ext4 (+ version) |
Rust + e2fsprogs | ~2min |
make pmem-assets |
cube-init + agent-ext4 |
— | ~2min |
Agent-independent pmem outputs:
make cube-init # → _output/bin/cube-init
make agent-ext4 # → _output/cube-agent/cube-agent.ext4 (+ version)
make pmem-assets # both of the above
Verify a build
# Check files in `_output/bin/`
file _output/bin/cubemaster
Test
Tests run inside the builder container. Some tests need external services (Redis, KVM) and will fail without them — see Gotchas.
Run component tests
# Agent tests (Rust) — 101+ tests, most pass without KVM
make builder-run BUILDER_CMD='cd /workspace/agent && make test'
# CubeMaster tests (Go) — needs Redis at minimum
make builder-run BUILDER_CMD='cd /workspace/CubeMaster && make proto && CI=true CUBE_MASTER_CONFIG_PATH=/workspace/CubeMaster/test/conf.yaml go test -short ./api/... ./pkg/...'
# Cubelet tests (Go)
make builder-run BUILDER_CMD='cd /workspace/Cubelet && make proto && go test -short ./pkg/...'
# CubeCoW native tests (Go + CGO, needs cubecow SDK built)
make cubecow-test-native
# Integration tests — require a running CubeSandbox cluster (dev-env or one-click deploy)
Run a single test
# CubeMaster: single package with verbose output
make builder-run BUILDER_CMD='cd /workspace/CubeMaster && CI=true CUBE_MASTER_CONFIG_PATH=/workspace/CubeMaster/test/conf.yaml go test -v -run TestSomething ./pkg/base/...'
# Agent: single test
make builder-run BUILDER_CMD='cd /workspace/agent && cargo test -p cube-agent test_name'
Format and Lint
# Format all components (Go + Rust)
make fmt
# Web UI lint
make web-lint
For a single component:
# Go component
make builder-run BUILDER_CMD='cd /workspace/CubeMaster && make fmt'
# Rust component — fmt automatically runs in builder
make builder-run BUILDER_CMD='cd /workspace/CubeAPI && cargo fmt --check'
Web UI
The web dashboard lives in web/ (Vite + Vue + TypeScript).
make web-install # Install npm dependencies (~30s)
make web-build # Build static assets → web/dist/ (~2s)
make web-dev # Start Vite dev server (localhost:5173)
make web-lint # Lint check
make web-preview # Preview built assets
Sync OpenAPI types after CubeAPI changes:
make web-api-sync
Gotchas
-
Tests need Redis/KVM/MicroVM context.
CubeMaster/pkg/base/wrapredistests panic if Redis is not reachable.agentsandbox tests (9 of 110) fail without a running KVM MicroVM.- Run with
-shortor filter to the relevant package when iterating.
-
CubeMaster tests use
CUBE_MASTER_CONFIG_PATH. Must be set totest/conf.yamlinside the container (absolute path from/workspace). -
go covdatanot available. The builder's Go toolchain (1.25) removedcovdata. Use-coverprofiledirectly or skip coverage:go test -short ./pkg/... # no coverage flag -
Builder container runs as host UID:GID. The
builder-runtarget mounts the workspace with--user $(UID):$(GID). Files written by the builder (e.g.,_output/bin/*) are owned by the host user. -
All builds are sequential. The Makefile uses
builder-runwhich spawns one Docker container per target. Buildingmake allruns each component sequentially. For parallel builds, use separate terminals or background processes. -
Agent build runs embedded unit tests before linking.
make agentincludescargo testfor the logging crate as part of the build. These are pure unit tests and always pass. -
CubeCoW SDK must be built before cubelet.
make cubelethandles this automatically via thecubecow-sdkdependency, but if you build cubelet outside the make flow, runmake cubecow-sdkfirst. -
KVM required for running sandboxes. Building works without KVM, but actually creating/starting sandboxes needs
/dev/kvmwith nested virtualization enabled. This container has it (/dev/kvmexists with nested=Y).
Troubleshooting
| Symptom | Fix |
|---|---|
docker: Cannot connect |
Docker daemon not running. sudo systemctl start docker |
make: *** [builder-image] Error |
Docker build failed. Check network, retry with make builder-image BUILDER_FORCE_REBUILD=1. From China, add MIRROR=cn to fetch the llvm.sh installer and clang-14 apt packages from a China mirror (the LLVM GPG key still comes from apt.llvm.org) |
error: protoc not installed inside builder |
Builder image is outdated. Rebuild: make builder-image BUILDER_FORCE_REBUILD=1 |
go: no such tool "covdata" |
Don't use -coverprofile flag with make test in CubeMaster. Use raw go test instead. |
cargo: command not found on host |
Rust builds run inside Docker. Use make <target>, not raw cargo. |
| Build hangs on "Download modules" | Go module download is slow. The builder persists GOPATH at ~/.cache/cube-sandbox-builder/go, so retry is faster. |
panic: nil pointer dereference in Redis test |
Expected — no Redis in builder. Filter: -run 'Test[^D]' or skip wrapredis package. |
Version History
- 5cefcca Current 2026-08-08 07:59


