-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
210 lines (171 loc) · 8.97 KB
/
Copy pathMakefile
File metadata and controls
210 lines (171 loc) · 8.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
.PHONY: build test lint clean docker help install deps integration-test test-unit test-scripts test-integration test-e2e test-all test-management-ui test-management-ui-browser test-celld test-celld-uat-structure test-celld-uat test-celld-uat-automated test-celld-soak test-celld-human-uat fmt vet check build-agent-musl build-agent-all docker-mgmt docker-agent docker-push
# Docker image tags
# Internal base image. Versioned tag is what downstream Dockerfile FROMs
# consume; `:latest` is kept as a developer-convenience alias only. Per
# issue #262, no `:latest` in FROM lines anywhere in the repo.
BASE_VERSION := v2026.5.17
BASE_IMAGE := agentic-sandbox-base:$(BASE_VERSION)
BASE_IMAGE_LATEST := agentic-sandbox-base:latest
TEST_IMAGE := agentic-sandbox-test:latest
REGISTRY ?= registry.example.invalid
MGMT_IMAGE := $(REGISTRY)/agentic-sandbox/agentic-mgmt
AGENT_IMAGE := $(REGISTRY)/agentic-sandbox/agent-client
IMAGE_TAG ?= latest
# This workstation exposes 20 logical CPUs. Keep local test execution within
# half of the host; callers and separately measured CI lanes may override it.
LOCAL_TEST_JOBS ?= 10
RUST_TEST_THREADS ?= $(LOCAL_TEST_JOBS)
NODE_TEST_CONCURRENCY ?= $(LOCAL_TEST_JOBS)
CARGO_DOCKER_BUILD_JOBS ?= 8
export RUST_TEST_THREADS
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Available targets:'
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
# Build targets
build: ## Build Rust components (management server, agent client, CLI)
@echo "Building Rust components..."
@$(MAKE) -s build-management
@$(MAKE) -s build-agent
@$(MAKE) -s build-cli
build-management: ## Build Rust management server
@echo "Building management server..."
@cd management && cargo build --release
build-agent: ## Build Rust agent client (glibc - for Ubuntu)
@echo "Building agent client (glibc)..."
@cd agent-rs && cargo build --release
build-agent-musl: ## Build agent client (musl/static - for Alpine)
@echo "Building agent client (musl/static)..."
@cd agent-rs && cargo build --release --target x86_64-unknown-linux-musl --no-default-features
build-agent-all: build-agent build-agent-musl ## Build both agent variants (glibc + musl)
build-cli: ## Build Rust CLI
@echo "Building CLI..."
@cd cli && cargo build --release
# Test targets
test: test-unit ## Run unit tests (default)
test-unit: ## Run Rust unit tests (workspace-wide for management)
@echo "Running Rust unit tests..."
@cd management && cargo test --workspace
@cd agent-rs && cargo test
@cd cli && cargo test
test-scripts: ## Run lightweight script regression tests
@echo "Running script regression tests..."
@./tests/package/test-agentic-setup-manifest.sh
@./tests/release/test-notify-site-workflow.sh
@python3 -m unittest tests/test_runtime_benchmark.py
@python3 -m unittest scripts/observability/test_activity_timeline_poc.py
@./scripts/test-macos-activity-collector.sh
@./scripts/test-activity-reliability-campaign.sh
@./tests/package/test-package-macos.sh
@./tests/package/test-verify-macos-developer-bundle.sh
@./tests/package/test-macos-release-recovery.sh
@./scripts/test-benchmark-terminal-transports.sh
@./images/qemu/tests/test-vsock-cidr-lifecycle.sh
@./images/qemu/tests/test-provision-dry-run.sh
@./images/qemu/tests/test-disk-size-guard.sh
@./images/qemu/tests/test-cloud-hypervisor-backend.sh
@./images/qemu/tests/test-libvirt-destroy-cleanup.sh
@./images/qemu/tests/test-ch-faststart.sh
@./images/qemu/tests/test-libvirt-checkpoint.sh
@python3 ./images/qemu/tests/test-ch-fork-memory-probe.py
@./scripts/test-reap-e2e-vms-cloud-hypervisor.sh
@./scripts/test-reap-e2e-vms-celld-dhcp.sh
@./scripts/test-vfio-gpu-runner-guard.sh
@./images/qemu/tests/test-agent-client-path-parity.sh
@./images/qemu/tests/test-build-base-image-automation.sh
@./tests/container/test-multiarch-build-contract.sh
@./tests/release/test-mirror-oci-index.sh
@./tests/release/test-ghcr-matrix.sh
@./tests/release/test-github-release-mirror-assets.sh
@./tests/container/test-macos-validation-contract.sh
@./tests/container/test-macos-release-ceremony-contract.sh
@./tests/container/test-debian-apt-https.sh
@./tests/container/test-agent-entrypoint-secure-transport.sh
@./tests/container/test-security-probe-network-contract.sh
@./tests/container/test-agentshare-run-retention.sh
@./tests/container/test-e2e-agentshare-forwarding.sh
@./scripts/verify-container-security.sh
test-management-ui: ## Run deterministic management dashboard contracts and state-flow tests
@node --test --test-concurrency=$(NODE_TEST_CONCURRENCY) management/ui/test/management-ui.test.mjs
test-management-ui-browser: ## Run focused management dashboard tests in a headless Chromium-compatible browser
@./scripts/run-management-ui-browser-smoke.sh
test-celld: ## Run deterministic Celld Rust, contract, and Worker behavior tests
@./scripts/test-celld-contracts.sh
@cargo test --locked --manifest-path tools/celld-callback-relay/Cargo.toml
@npm ci --ignore-scripts --prefix runtimes/celld/instance-cell
@npm test --prefix runtimes/celld/instance-cell
test-celld-uat-structure: ## Validate the Celld UAT catalog, runner, contracts, and evidence writer
@node --test --test-concurrency=$(NODE_TEST_CONCURRENCY) tests/celld/uat/*.test.mjs
@node scripts/celld-uat-contract-check.mjs
@./images/qemu/tests/test-libvirt-destroy-cleanup.sh
@./tests/container/test-e2e-agentshare-forwarding.sh
test-celld-uat: test-celld-uat-automated ## Run the unattended Celld UAT lane
test-celld-uat-automated: test-celld-uat-structure ## Run UAT 001-015; exits 2 while live prerequisites are NOT_RUN
@node scripts/run-celld-uat.mjs --trigger automated
test-celld-soak: test-celld-uat-structure ## Evaluate operator-run UAT 016 from CELLD_SOAK_INPUT
@test -n "$(CELLD_SOAK_INPUT)" || { echo "CELLD_SOAK_INPUT is required (copy tests/celld/uat/operator/soak-input.example.json)" >&2; exit 2; }
@node scripts/run-celld-operator-uat.mjs soak --input "$(CELLD_SOAK_INPUT)"
test-celld-human-uat: test-celld-uat-structure ## Evaluate operator-run UAT 017 from CELLD_HUMAN_UAT_INPUT
@test -n "$(CELLD_HUMAN_UAT_INPUT)" || { echo "CELLD_HUMAN_UAT_INPUT is required (copy tests/celld/uat/operator/human-input.example.json)" >&2; exit 2; }
@node scripts/run-celld-operator-uat.mjs human --input "$(CELLD_HUMAN_UAT_INPUT)"
# E2E tests
test-e2e: ## Run E2E integration tests (management server + agents)
@echo "Running E2E integration tests..."
./scripts/run-e2e-tests.sh
test-all: test-unit test-e2e ## Run all tests
@echo "All tests completed"
# Lint/format targets
fmt: ## Format Rust code
@echo "Formatting Rust code..."
@cd management && cargo fmt
@cd agent-rs && cargo fmt
@cd cli && cargo fmt
lint: ## Check Rust formatting
@echo "Checking Rust formatting..."
@cd management && cargo fmt -- --check
@cd agent-rs && cargo fmt -- --check
@cd cli && cargo fmt -- --check
# Docker targets
docker: docker-base docker-test ## Build all Docker images
docker-base: ## Build base Docker image (versioned + :latest alias)
@echo "Building base Docker image $(BASE_IMAGE)..."
docker build -t $(BASE_IMAGE) -t $(BASE_IMAGE_LATEST) images/base/
docker-test: ## Build test Docker image
@echo "Building test Docker image..."
docker build -t $(TEST_IMAGE) images/test/
docker-mgmt: ## Build management server image
@echo "Building management server image..."
docker build --build-arg CARGO_BUILD_JOBS=$(CARGO_DOCKER_BUILD_JOBS) -t $(MGMT_IMAGE):$(IMAGE_TAG) -f deploy/docker/Dockerfile.management .
docker-agent: ## Build agent client image
@echo "Building agent client image..."
docker build --build-arg CARGO_BUILD_JOBS=$(CARGO_DOCKER_BUILD_JOBS) -t $(AGENT_IMAGE):$(IMAGE_TAG) -f deploy/docker/Dockerfile.agent-rust .
docker-push: docker-mgmt docker-agent ## Build and push production images to registry
@echo "Pushing to $(REGISTRY)..."
docker push $(MGMT_IMAGE):$(IMAGE_TAG)
docker push $(AGENT_IMAGE):$(IMAGE_TAG)
docker-clean: ## Remove Docker images
@echo "Removing Docker images..."
docker rmi -f $(BASE_IMAGE) $(BASE_IMAGE_LATEST) $(TEST_IMAGE) $(MGMT_IMAGE):$(IMAGE_TAG) $(AGENT_IMAGE):$(IMAGE_TAG) 2>/dev/null || true
# Development environment
dev-setup: ## Set up development environment
@echo "Setting up development environment..."
./scripts/dev-setup.sh
dev-up: ## Start development environment
@echo "Starting development environment..."
docker-compose -f docker-compose.dev.yaml up -d
dev-down: ## Stop development environment
@echo "Stopping development environment..."
docker-compose -f docker-compose.dev.yaml down
dev-logs: ## View development environment logs
docker-compose -f docker-compose.dev.yaml logs -f
# Clean targets
clean: ## Remove build artifacts
@echo "Cleaning build artifacts..."
@cd management && cargo clean
@cd agent-rs && cargo clean
@cd cli && cargo clean
clean-all: clean docker-clean ## Remove all build artifacts and Docker images
# Quick checks before commit
check: lint test-unit test-scripts test-management-ui ## Run all checks (format check + tests)
.DEFAULT_GOAL := help