-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
407 lines (341 loc) · 22.6 KB
/
Makefile
File metadata and controls
407 lines (341 loc) · 22.6 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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
# Bazel wrapper
BAZEL = ./tool/bazel
# Docker Compose wrapper
COMPOSE = docker-compose
# SubmitQueue compose files
COMPOSE_FILE = example/submitqueue/docker-compose.yml
GATEWAY_COMPOSE_FILE = example/submitqueue/gateway/server/docker-compose.yml
ORCHESTRATOR_COMPOSE_FILE = example/submitqueue/orchestrator/server/docker-compose.yml
# Fixed project name for local manual testing (tests use unique random names)
SUBMITQUEUE_LOCAL_PROJECT = submitqueue
# Stovepipe compose files
STOVEPIPE_GATEWAY_COMPOSE_FILE = example/stovepipe/gateway/server/docker-compose.yml
STOVEPIPE_ORCHESTRATOR_COMPOSE_FILE = example/stovepipe/orchestrator/server/docker-compose.yml
STOVEPIPE_STACK_COMPOSE_FILE = example/stovepipe/docker-compose.yml
# Fixed project name for local manual testing (tests use unique random names)
STOVEPIPE_LOCAL_PROJECT = stovepipe
# yamlfmt version for YAML formatting (override with: make fmt YAMLFMT_VERSION=v0.16.0)
YAMLFMT_VERSION ?= v0.16.0
# goimports version for Go formatting + import fixing
GOIMPORTS_VERSION ?= v0.33.0
# Set REPO_ROOT for docker-compose
export REPO_ROOT := $(shell pwd)
# Fails if git working tree is dirty. Usage: $(call assert_clean,fix command)
define assert_clean
@if ! git diff --quiet; then \
echo "The following files need updating:" >&2; \
git diff --name-only >&2; \
echo "" >&2; \
echo "Please run '$(1)' locally and commit the changes." >&2; \
exit 1; \
fi
endef
.PHONY: build build-all-linux build-submitqueue-gateway-linux build-submitqueue-orchestrator-linux build-stovepipe-gateway-linux build-stovepipe-orchestrator-linux check-gazelle check-mocks check-tidy clean clean-proto deps e2e-test fmt gazelle integration-test integration-test-submitqueue-consumer integration-test-extensions integration-test-submitqueue-gateway integration-test-submitqueue-orchestrator license-fix lint lint-fmt lint-license local-submitqueue-clean local-submitqueue-gateway-start local-submitqueue-gateway-stop local-init-submitqueue-schemas local-init-stovepipe-queue-schema local-submitqueue-logs local-submitqueue-orchestrator-start local-submitqueue-orchestrator-stop local-submitqueue-ps local-submitqueue-restart local-submitqueue-start local-stop local-stovepipe-gateway-start local-stovepipe-orchestrator-start local-stovepipe-start mocks proto query-deps query-targets run-client-submitqueue-gateway run-client-submitqueue-orchestrator run-client-stovepipe-gateway run-client-stovepipe-orchestrator run-queue-admin test test-no-cache tidy tidy-bazel tidy-go help
build: ## Build all services and examples
@echo "Building all targets with Bazel..."
@$(BAZEL) build //...
@echo "Build complete!"
# Build Linux binaries required for Docker containers
build-all-linux: build-submitqueue-gateway-linux build-submitqueue-orchestrator-linux build-stovepipe-gateway-linux build-stovepipe-orchestrator-linux ## Build all Linux binaries for Docker
@echo "All Linux binaries ready for Docker"
build-submitqueue-gateway-linux: ## Build Gateway Linux binary for Docker
@echo "Building Gateway Linux binary for Docker..."
@$(BAZEL) build --platforms=@rules_go//go/toolchain:linux_amd64 //example/submitqueue/gateway/server:gateway
@mkdir -p .docker-bin
@cp -f bazel-bin/example/submitqueue/gateway/server/gateway_/gateway .docker-bin/gateway 2>/dev/null || \
cp -f bazel-bin/example/submitqueue/gateway/server/gateway .docker-bin/gateway
@echo "Gateway Linux binary ready at .docker-bin/gateway"
build-submitqueue-orchestrator-linux: ## Build Orchestrator Linux binary for Docker
@echo "Building Orchestrator Linux binary for Docker..."
@$(BAZEL) build --platforms=@rules_go//go/toolchain:linux_amd64 //example/submitqueue/orchestrator/server:orchestrator
@mkdir -p .docker-bin
@cp -f bazel-bin/example/submitqueue/orchestrator/server/orchestrator_/orchestrator .docker-bin/orchestrator 2>/dev/null || \
cp -f bazel-bin/example/submitqueue/orchestrator/server/orchestrator .docker-bin/orchestrator
@echo "Orchestrator Linux binary ready at .docker-bin/orchestrator"
build-stovepipe-gateway-linux: ## Build Stovepipe gateway Linux binary for Docker
@echo "Building Stovepipe gateway Linux binary for Docker..."
@$(BAZEL) build --platforms=@rules_go//go/toolchain:linux_amd64 //example/stovepipe/gateway/server:gateway
@mkdir -p .docker-bin
@cp -f bazel-bin/example/stovepipe/gateway/server/gateway_/gateway .docker-bin/stovepipe-gateway 2>/dev/null || \
cp -f bazel-bin/example/stovepipe/gateway/server/gateway .docker-bin/stovepipe-gateway
@echo "Stovepipe gateway Linux binary ready at .docker-bin/stovepipe-gateway"
build-stovepipe-orchestrator-linux: ## Build Stovepipe orchestrator Linux binary for Docker
@echo "Building Stovepipe orchestrator Linux binary for Docker..."
@$(BAZEL) build --platforms=@rules_go//go/toolchain:linux_amd64 //example/stovepipe/orchestrator/server:orchestrator
@mkdir -p .docker-bin
@cp -f bazel-bin/example/stovepipe/orchestrator/server/orchestrator_/orchestrator .docker-bin/stovepipe-orchestrator 2>/dev/null || \
cp -f bazel-bin/example/stovepipe/orchestrator/server/orchestrator .docker-bin/stovepipe-orchestrator
@echo "Stovepipe orchestrator Linux binary ready at .docker-bin/stovepipe-orchestrator"
check-gazelle: ## Check BUILD.bazel files are up to date
@echo "Running Gazelle to check BUILD files..."
@$(BAZEL) run //:gazelle
$(call assert_clean,make gazelle)
@echo "BUILD files are up to date."
check-mocks: mocks ## Check mock files are up to date
$(call assert_clean,make mocks)
@echo "Mock files are up to date."
check-tidy: tidy ## Check that go.mod and MODULE.bazel are tidy
$(call assert_clean,make tidy)
@echo "Module files are up to date."
clean: ## Clean generated files and binaries
@echo "Cleaning with Bazel..."
@$(BAZEL) clean
@rm -rf bin/
@echo "Clean complete!"
clean-proto: ## Clean generated proto files
@echo "Cleaning generated proto files..."
@rm -rf submitqueue/gateway/protopb/*.pb.go
@rm -rf submitqueue/orchestrator/protopb/*.pb.go
@rm -rf stovepipe/gateway/protopb/*.pb.go
@rm -rf stovepipe/orchestrator/protopb/*.pb.go
@echo "Proto clean complete!"
deps: tidy-go ## Download and tidy Go dependencies
@echo "Dependencies installed!"
e2e-test: build-all-linux ## Run end-to-end tests (hermetic, auto-builds binaries; runs in parallel)
@echo "Running end-to-end tests (parallel)..."
@$(BAZEL) test //test/e2e/... --test_output=errors
fmt: ## Format Go and YAML code
@echo "Formatting Go code..."
@find . -name '*.go' -not -path './pkg/*' -not -path './bazel-*' | xargs $(BAZEL) run @rules_go//go -- run golang.org/x/tools/cmd/goimports@$(GOIMPORTS_VERSION) -w
@echo "Formatting YAML files..."
@$(BAZEL) run @rules_go//go -- run github.com/google/yamlfmt/cmd/yamlfmt@$(YAMLFMT_VERSION)
@echo "Formatting complete!"
gazelle: ## Update BUILD.bazel files
@echo "Running Gazelle to update BUILD files..."
@$(BAZEL) run //:gazelle
integration-test: build-all-linux ## Run all integration tests (auto-builds binaries; runs in parallel)
@echo "Running all integration tests (parallel)..."
@$(BAZEL) test //test/integration/... --test_output=errors
integration-test-submitqueue-consumer: ## Run Consumer integration tests
@echo "Running Consumer integration tests..."
@$(BAZEL) test //test/integration/submitqueue/core/consumer:consumer_test --test_output=streamed
integration-test-extensions: ## Run extension integration tests (runs in parallel)
@echo "Running extension integration tests (parallel)..."
@$(BAZEL) test //test/integration/submitqueue/extension/... //test/integration/extension/... --test_output=errors
integration-test-submitqueue-gateway: build-submitqueue-gateway-linux ## Run Gateway integration tests (auto-builds binary)
@echo "Running Gateway integration tests..."
@$(BAZEL) test //test/integration/submitqueue/gateway:gateway_test --test_output=streamed
integration-test-submitqueue-orchestrator: build-submitqueue-orchestrator-linux ## Run Orchestrator integration tests (auto-builds binary)
@echo "Running Orchestrator integration tests..."
@$(BAZEL) test //test/integration/submitqueue/orchestrator:orchestrator_test --test_output=streamed
license-fix: ## Add missing license headers to source files
@$(BAZEL) run //tool/linter/licenseheader -- --fix
lint: lint-fmt lint-license ## Run all linters
@echo "All lint checks passed."
lint-fmt: fmt ## Check code formatting (fails if unformatted)
$(call assert_clean,make fmt)
@echo "All code is properly formatted."
lint-license: ## Check license headers on all source files
@$(BAZEL) run //tool/linter/licenseheader -- --check
local-submitqueue-clean: ## Stop and remove all local services, volumes, and images
@echo "Cleaning all services and data..."
@$(COMPOSE) -f $(COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) down -v --rmi local
@echo "All services, volumes, and images removed."
local-submitqueue-gateway-start: build-submitqueue-gateway-linux ## Start Gateway service locally (Gateway + 2 MySQL databases)
@echo "Starting Gateway with docker-compose..."
@$(COMPOSE) -f $(GATEWAY_COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) up -d --build --wait
@echo "Applying database schemas..."
@$(MAKE) -s local-init-submitqueue-schemas
@echo ""
@echo "✅ Gateway is running!"
@echo ""
@$(COMPOSE) -f $(GATEWAY_COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) ps
@echo ""
@echo "Gateway gRPC port: $$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-gateway-service-1 8080 2>/dev/null | cut -d: -f2 || echo 'unknown')"
@echo "MySQL App port: $$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-mysql-app-1 3306 2>/dev/null | cut -d: -f2 || echo 'unknown')"
@echo "MySQL Queue port: $$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-mysql-queue-1 3306 2>/dev/null | cut -d: -f2 || echo 'unknown')"
local-submitqueue-gateway-stop: ## Stop Gateway service
@echo "Stopping Gateway services..."
@$(COMPOSE) -f $(GATEWAY_COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) down
@echo "Gateway services stopped."
local-init-submitqueue-schemas: ## Manually apply all database schemas
@echo "Applying storage schema to mysql-app..."
@for file in submitqueue/extension/storage/mysql/schema/*.sql; do \
echo " - Applying $$(basename $$file)..."; \
docker exec -i $(SUBMITQUEUE_LOCAL_PROJECT)-mysql-app-1 mysql -uroot -proot submitqueue < $$file 2>&1 | grep -v "Using a password" || true; \
done
@echo "Applying counter schema to mysql-app..."
@for file in submitqueue/extension/counter/mysql/schema/*.sql; do \
echo " - Applying $$(basename $$file)..."; \
docker exec -i $(SUBMITQUEUE_LOCAL_PROJECT)-mysql-app-1 mysql -uroot -proot submitqueue < $$file 2>&1 | grep -v "Using a password" || true; \
done
@echo "Applying queue schema to mysql-queue..."
@for file in extension/queue/mysql/schema/*.sql; do \
echo " - Applying $$(basename $$file)..."; \
docker exec -i $(SUBMITQUEUE_LOCAL_PROJECT)-mysql-queue-1 mysql -uroot -proot submitqueue < $$file 2>&1 | grep -v "Using a password" || true; \
done
@echo "✅ All schemas applied successfully"
local-init-stovepipe-queue-schema: ## Apply queue schema only (mysql-queue) for Stovepipe compose stacks
@echo "Applying queue schema to mysql-queue (Stovepipe; no app storage/counter schema yet)..."
@for file in extension/queue/mysql/schema/*.sql; do \
echo " - Applying $$(basename $$file)..."; \
docker exec -i $(STOVEPIPE_LOCAL_PROJECT)-mysql-queue-1 mysql -uroot -proot submitqueue < $$file 2>&1 | grep -v "Using a password" || true; \
done
@echo "✅ Stovepipe queue schema applied successfully"
local-submitqueue-logs: ## View logs from all running services
@$(COMPOSE) -f $(COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) logs -f
local-submitqueue-orchestrator-start: build-submitqueue-orchestrator-linux ## Start Orchestrator service locally (Orchestrator + 2 MySQL databases)
@echo "Starting Orchestrator with docker-compose..."
@$(COMPOSE) -f $(ORCHESTRATOR_COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) up -d --build --wait
@echo "Applying database schemas..."
@$(MAKE) -s local-init-submitqueue-schemas
@echo ""
@echo "✅ Orchestrator is running!"
@echo ""
@$(COMPOSE) -f $(ORCHESTRATOR_COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) ps
@echo ""
@echo "Orchestrator gRPC port: $$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-orchestrator-service-1 8080 2>/dev/null | cut -d: -f2 || echo 'unknown')"
@echo "MySQL App port: $$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-mysql-app-1 3306 2>/dev/null | cut -d: -f2 || echo 'unknown')"
@echo "MySQL Queue port: $$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-mysql-queue-1 3306 2>/dev/null | cut -d: -f2 || echo 'unknown')"
local-submitqueue-orchestrator-stop: ## Stop Orchestrator service
@echo "Stopping Orchestrator services..."
@$(COMPOSE) -f $(ORCHESTRATOR_COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) down
@echo "Orchestrator services stopped."
local-submitqueue-ps: ## Show running containers and their ports
@echo "Running containers and ports:"
@echo ""
@$(COMPOSE) -f $(COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) ps
@echo ""
@echo "📡 Service Endpoints:"
@echo " Gateway gRPC: localhost:$$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-gateway-service-1 8080 2>/dev/null | cut -d: -f2 || echo 'not running')"
@echo " Orchestrator gRPC: localhost:$$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-orchestrator-service-1 8080 2>/dev/null | cut -d: -f2 || echo 'not running')"
@echo ""
@echo "🗄️ Database Endpoints:"
@echo " MySQL App: localhost:$$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-mysql-app-1 3306 2>/dev/null | cut -d: -f2 || echo 'not running')"
@echo " MySQL Queue: localhost:$$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-mysql-queue-1 3306 2>/dev/null | cut -d: -f2 || echo 'not running')"
@echo ""
@echo "💡 Usage:"
@echo " # Connect to MySQL App DB"
@echo " mysql -h127.0.0.1 -P$$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-mysql-app-1 3306 2>/dev/null | cut -d: -f2 || echo 'PORT') -uroot -proot submitqueue"
@echo ""
@echo " # Call Gateway gRPC"
@echo " grpcurl -plaintext -d '{\"message\":\"test\"}' localhost:$$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-gateway-service-1 8080 2>/dev/null | cut -d: -f2 || echo 'PORT') submitqueue.SubmitQueueGateway/Ping"
@echo ""
@echo " # View logs"
@echo " make local-submitqueue-logs"
local-submitqueue-restart: build-all-linux ## Restart all services (rebuild and restart)
@echo "Restarting all services..."
@$(COMPOSE) -f $(COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) restart
@echo "Services restarted!"
@make local-submitqueue-ps
local-submitqueue-start: build-all-linux ## Start full stack (Gateway + Orchestrator + MySQL)
@echo "Starting full stack with docker-compose..."
@$(COMPOSE) -f $(COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) up -d --build --wait
@echo "Applying database schemas..."
@$(MAKE) -s local-init-submitqueue-schemas
@echo ""
@echo "✅ Full stack is running!"
@echo ""
@make local-submitqueue-ps
local-stop: ## Stop all services (keep data)
@echo "Stopping all services..."
@$(COMPOSE) -f $(COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) down
@$(COMPOSE) -f $(STOVEPIPE_STACK_COMPOSE_FILE) -p $(STOVEPIPE_LOCAL_PROJECT) down
@echo "Services stopped. Data volumes preserved."
local-stovepipe-logs: ## View logs from all running Stovepipe services
@$(COMPOSE) -f $(STOVEPIPE_STACK_COMPOSE_FILE) -p $(STOVEPIPE_LOCAL_PROJECT) logs -f
local-stovepipe-start: build-stovepipe-gateway-linux build-stovepipe-orchestrator-linux ## Start full Stovepipe stack (gateway + orchestrator + MySQL)
@echo "Starting full Stovepipe stack with compose..."
@$(COMPOSE) -f $(STOVEPIPE_STACK_COMPOSE_FILE) -p $(STOVEPIPE_LOCAL_PROJECT) up -d --build --wait
@echo "Applying queue schema to mysql-queue (no Stovepipe app schema yet)..."
@$(MAKE) -s local-init-stovepipe-queue-schema
@echo ""
@echo "✅ Full Stovepipe stack is running!"
@echo ""
@echo "Expected container NAMEs (project=$(STOVEPIPE_LOCAL_PROJECT), one replica each):"
@echo " $(STOVEPIPE_LOCAL_PROJECT)-mysql-app-1"
@echo " $(STOVEPIPE_LOCAL_PROJECT)-mysql-queue-1"
@echo " $(STOVEPIPE_LOCAL_PROJECT)-gateway-service-1"
@echo " $(STOVEPIPE_LOCAL_PROJECT)-orchestrator-service-1"
@echo ""
@$(COMPOSE) -f $(STOVEPIPE_STACK_COMPOSE_FILE) -p $(STOVEPIPE_LOCAL_PROJECT) ps
@echo ""
@echo "Stovepipe gateway gRPC port: $$(docker port $(STOVEPIPE_LOCAL_PROJECT)-gateway-service-1 8080 2>/dev/null | cut -d: -f2 || echo 'unknown')"
@echo "Stovepipe orchestrator gRPC port: $$(docker port $(STOVEPIPE_LOCAL_PROJECT)-orchestrator-service-1 8080 2>/dev/null | cut -d: -f2 || echo 'unknown')"
@echo "MySQL App port: $$(docker port $(STOVEPIPE_LOCAL_PROJECT)-mysql-app-1 3306 2>/dev/null | cut -d: -f2 || echo 'unknown')"
@echo "MySQL Queue port: $$(docker port $(STOVEPIPE_LOCAL_PROJECT)-mysql-queue-1 3306 2>/dev/null | cut -d: -f2 || echo 'unknown')"
local-stovepipe-orchestrator-start: build-stovepipe-orchestrator-linux ## Start Stovepipe orchestrator locally (orchestrator + 2 MySQL databases)
@echo "Starting Stovepipe orchestrator with compose..."
@$(COMPOSE) -f $(STOVEPIPE_ORCHESTRATOR_COMPOSE_FILE) -p $(STOVEPIPE_LOCAL_PROJECT) up -d --build --wait
@echo "Applying queue schema to mysql-queue (no Stovepipe app schema yet)..."
@$(MAKE) -s local-init-stovepipe-queue-schema
@echo ""
@echo "✅ Stovepipe orchestrator is running!"
@echo ""
@$(COMPOSE) -f $(STOVEPIPE_ORCHESTRATOR_COMPOSE_FILE) -p $(STOVEPIPE_LOCAL_PROJECT) ps
@echo ""
@echo "Stovepipe orchestrator gRPC port: $$(docker port $(STOVEPIPE_LOCAL_PROJECT)-orchestrator-service-1 8080 2>/dev/null | cut -d: -f2 || echo 'unknown')"
@echo "MySQL App port: $$(docker port $(STOVEPIPE_LOCAL_PROJECT)-mysql-app-1 3306 2>/dev/null | cut -d: -f2 || echo 'unknown')"
@echo "MySQL Queue port: $$(docker port $(STOVEPIPE_LOCAL_PROJECT)-mysql-queue-1 3306 2>/dev/null | cut -d: -f2 || echo 'unknown')"
local-stovepipe-gateway-start: build-stovepipe-gateway-linux ## Start Stovepipe gateway locally (gateway + 2 MySQL databases)
@echo "Starting Stovepipe gateway with compose..."
@$(COMPOSE) -f $(STOVEPIPE_GATEWAY_COMPOSE_FILE) -p $(STOVEPIPE_LOCAL_PROJECT) up -d --build --wait
@echo "Applying queue schema to mysql-queue (no Stovepipe app schema yet)..."
@$(MAKE) -s local-init-stovepipe-queue-schema
@echo ""
@echo "✅ Stovepipe gateway is running!"
@echo ""
@$(COMPOSE) -f $(STOVEPIPE_GATEWAY_COMPOSE_FILE) -p $(STOVEPIPE_LOCAL_PROJECT) ps
@echo ""
@echo "Stovepipe gateway gRPC port: $$(docker port $(STOVEPIPE_LOCAL_PROJECT)-gateway-service-1 8080 2>/dev/null | cut -d: -f2 || echo 'unknown')"
@echo "MySQL App port: $$(docker port $(STOVEPIPE_LOCAL_PROJECT)-mysql-app-1 3306 2>/dev/null | cut -d: -f2 || echo 'unknown')"
@echo "MySQL Queue port: $$(docker port $(STOVEPIPE_LOCAL_PROJECT)-mysql-queue-1 3306 2>/dev/null | cut -d: -f2 || echo 'unknown')"
mocks: ## Generate mock files using mockgen
@echo "Generating mocks..."
@$(BAZEL) run @rules_go//go -- generate ./submitqueue/extension/storage/... ./submitqueue/extension/buildrunner/... ./submitqueue/extension/changestore/... ./submitqueue/extension/counter/... ./extension/queue/... ./submitqueue/extension/queueconfig/... ./submitqueue/extension/mergechecker/... ./submitqueue/extension/pusher/... ./submitqueue/extension/scorer/... ./submitqueue/extension/conflict/... ./submitqueue/core/consumer/...
@echo "Mocks generated successfully!"
proto: ## Generate protobuf files from .proto definitions
@echo "Generating protobuf files with protoc..."
@protoc --go_out=submitqueue/gateway/protopb --go_opt=paths=source_relative \
--go-grpc_out=submitqueue/gateway/protopb --go-grpc_opt=paths=source_relative \
--yarpc-go_out=submitqueue/gateway/protopb --yarpc-go_opt=paths=source_relative \
--proto_path=submitqueue/gateway/proto submitqueue/gateway/proto/gateway.proto
@protoc --go_out=submitqueue/orchestrator/protopb --go_opt=paths=source_relative \
--go-grpc_out=submitqueue/orchestrator/protopb --go-grpc_opt=paths=source_relative \
--yarpc-go_out=submitqueue/orchestrator/protopb --yarpc-go_opt=paths=source_relative \
--proto_path=submitqueue/orchestrator/proto submitqueue/orchestrator/proto/orchestrator.proto
@protoc --go_out=stovepipe/gateway/protopb --go_opt=paths=source_relative \
--go-grpc_out=stovepipe/gateway/protopb --go-grpc_opt=paths=source_relative \
--yarpc-go_out=stovepipe/gateway/protopb --yarpc-go_opt=paths=source_relative \
--proto_path=stovepipe/gateway/proto stovepipe/gateway/proto/gateway.proto
@protoc --go_out=stovepipe/orchestrator/protopb --go_opt=paths=source_relative \
--go-grpc_out=stovepipe/orchestrator/protopb --go-grpc_opt=paths=source_relative \
--yarpc-go_out=stovepipe/orchestrator/protopb --yarpc-go_opt=paths=source_relative \
--proto_path=stovepipe/orchestrator/proto stovepipe/orchestrator/proto/orchestrator.proto
@echo "Protobuf files generated successfully!"
# Bazel query helpers
query-deps:
@$(BAZEL) query 'deps(//example/submitqueue/gateway/server:gateway)'
query-targets:
@$(BAZEL) query //...
# Run gateway client (connects to any running gateway service)
run-client-submitqueue-gateway:
@$(BAZEL) run //example/submitqueue/gateway/client:gateway -- -addr $(or $(SERVER_ADDR),localhost:8081) -message "$(or $(MESSAGE),ping)"
# Run orchestrator client (connects to any running orchestrator service)
run-client-submitqueue-orchestrator:
@$(BAZEL) run //example/submitqueue/orchestrator/client:orchestrator -- -addr $(or $(SERVER_ADDR),localhost:8082) -message "$(or $(MESSAGE),ping)"
# Run stovepipe gateway client (connects to any running stovepipe gateway service)
run-client-stovepipe-gateway:
@$(BAZEL) run //example/stovepipe/gateway/client:gateway -- -addr $(or $(SERVER_ADDR),localhost:8083) -message "$(or $(MESSAGE),ping)"
# Run stovepipe orchestrator client (connects to any running stovepipe orchestrator service)
run-client-stovepipe-orchestrator:
@$(BAZEL) run //example/stovepipe/orchestrator/client:orchestrator -- -addr $(or $(SERVER_ADDR),localhost:8084) -message "$(or $(MESSAGE),ping)"
run-queue-admin: ## Run queue-admin CLI (use ARGS to pass arguments, e.g. make run-queue-admin ARGS="list-topics")
@$(BAZEL) run //extension/queue/mysql/ctl -- $(ARGS)
test: ## Run unit tests
@echo "Running unit tests..."
@$(BAZEL) test //... --test_tag_filters=-manual,-integration || echo "No unit tests found (only integration tests exist)"
test-no-cache: ## Run unit tests without cache (force re-run)
@echo "Running unit tests (no cache)..."
@$(BAZEL) test //... --test_tag_filters=-manual,-integration --nocache_test_results
tidy: tidy-go tidy-bazel ## Run go mod tidy and bazel mod tidy
tidy-bazel: ## Run bazel mod tidy
@echo "Running bazel mod tidy..."
@$(BAZEL) mod tidy
tidy-go: ## Run go mod tidy
@echo "Running go mod tidy..."
@$(BAZEL) run @rules_go//go -- mod tidy -e
help: ## Show this help message
@echo "Available targets:"
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-30s\033[0m %s\n", $$1, $$2}'