Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: make lint

# ---------------------------------------------------------------------------
# TIDY (module files + BUILD files in sync)
# TIDY (module files + BUILD files + generated proto in sync)
# ---------------------------------------------------------------------------
tidy:
name: Tidy
Expand All @@ -52,6 +52,9 @@ jobs:
- name: Check BUILD files are up to date
run: make check-gazelle

- name: Check generated proto files are up to date
run: make check-proto

# ---------------------------------------------------------------------------
# BUILD AND UNIT TESTS
# ---------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions .protocversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
29.3
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ use_repo(
go_deps,
"com_github_data_dog_go_sqlmock",
"com_github_go_sql_driver_mysql",
"com_github_gogo_protobuf",
"com_github_spf13_cobra",
"com_github_stretchr_testify",
"com_github_uber_go_tally_v4",
"in_gopkg_yaml_v3",
"org_golang_google_grpc",
"org_golang_google_grpc_cmd_protoc_gen_go_grpc",
"org_golang_google_protobuf",
"org_golang_x_oauth2",
"org_uber_go_fx",
Expand Down
36 changes: 27 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Bazel wrapper
BAZEL = ./tool/bazel

# protoc wrapper (hermetic; pinned by .protocversion)
PROTOC = ./tool/protoc

# protoc plugins (hermetic; versions pinned by the `tool` directives in go.mod).
# Passed explicitly so protoc never resolves a plugin from the host $PATH.
PROTOC_PLUGINS = \
--plugin=protoc-gen-go=$(CURDIR)/tool/protoc-gen-go \
--plugin=protoc-gen-go-grpc=$(CURDIR)/tool/protoc-gen-go-grpc \
--plugin=protoc-gen-yarpc-go-v2=$(CURDIR)/tool/protoc-gen-yarpc-go-v2

# Docker Compose wrapper
COMPOSE = docker-compose

Expand Down Expand Up @@ -40,7 +50,7 @@ define assert_clean
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
.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-proto 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
Expand Down Expand Up @@ -94,6 +104,10 @@ check-mocks: mocks ## Check mock files are up to date
$(call assert_clean,make mocks)
@echo "Mock files are up to date."

check-proto: proto ## Check generated proto files are up to date
$(call assert_clean,make proto)
@echo "Proto 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."
Expand Down Expand Up @@ -339,22 +353,26 @@ mocks: ## Generate mock files using mockgen

proto: ## Generate protobuf files from .proto definitions
@echo "Generating protobuf files with protoc..."
@protoc --go_out=submitqueue/gateway/protopb --go_opt=paths=source_relative \
@$(PROTOC) $(PROTOC_PLUGINS) --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 \
--yarpc-go-v2_out=submitqueue/gateway/protopb --yarpc-go-v2_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 \
@$(PROTOC) $(PROTOC_PLUGINS) --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 \
--yarpc-go-v2_out=submitqueue/orchestrator/protopb --yarpc-go-v2_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 \
@$(PROTOC) $(PROTOC_PLUGINS) --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 \
--yarpc-go-v2_out=stovepipe/gateway/protopb --yarpc-go-v2_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 \
@$(PROTOC) $(PROTOC_PLUGINS) --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 \
--yarpc-go-v2_out=stovepipe/orchestrator/protopb --yarpc-go-v2_opt=paths=source_relative \
--proto_path=stovepipe/orchestrator/proto stovepipe/orchestrator/proto/orchestrator.proto
@echo "Formatting generated files with goimports..."
@go run golang.org/x/tools/cmd/goimports@$(GOIMPORTS_VERSION) -w \
submitqueue/gateway/protopb submitqueue/orchestrator/protopb \
stovepipe/gateway/protopb stovepipe/orchestrator/protopb
@echo "Protobuf files generated successfully!"

# Bazel query helpers
Expand Down
23 changes: 13 additions & 10 deletions doc/howto/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Prerequisites

- **Go 1.24+** — needed for `gopls`, `go mod`, and installing protoc plugins. Download from [go.dev/dl](https://go.dev/dl/). Note: Bazel manages its own Go toolchain for builds, but a local Go installation is required for editor tooling and dependency management.
- **Go 1.24+** — needed for `gopls`, `go mod`, and running the hermetic protoc plugins (via `go tool`). Download from [go.dev/dl](https://go.dev/dl/). Note: Bazel manages its own Go toolchain for builds, but a local Go installation is required for editor tooling and dependency management.
- **Docker** and **Docker Compose** — for integration and e2e tests, and for running services locally.
- **direnv** (recommended) — automatically loads `.envrc` so you can use `bazel` directly instead of `./tool/bazel`.

Expand Down Expand Up @@ -85,15 +85,17 @@ GoLand works with Go modules automatically. Open the project root and GoLand wil
## Optional Tools

```bash
# macOS
brew install protobuf grpcurl

# Go protoc plugins (only if modifying .proto files)
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
go install go.uber.org/yarpc/encoding/protobuf/protoc-gen-yarpc-go@latest
# macOS — grpcurl for poking at running services (optional)
brew install grpcurl
```

Proto generation is fully hermetic and needs no manual installs: `make proto`
downloads a pinned `protoc` via `./tool/protoc` (see `.protocversion`) and runs
the `protoc-gen-go`, `protoc-gen-go-grpc`, and `protoc-gen-yarpc-go-v2` plugins
at the versions pinned by the `tool` directives in `go.mod` (via `go tool`). A
Go toolchain (and network access on the first run, to fetch protoc and the
plugin modules) is the only requirement.
Comment on lines +92 to +97

## Common Make Targets

| Target | Description |
Expand Down Expand Up @@ -138,8 +140,9 @@ See [TESTING.md](TESTING.md) for the full testing guide, including integration a
## Troubleshooting

**Proto generation fails:**
- Ensure all three protoc plugins are installed (see Optional Tools above)
- Check that `protoc` is in your PATH: `which protoc`
- `make proto` is hermetic — it needs no host `protoc` or plugins, only a Go toolchain and (on the first run) network access to download pinned `protoc` and the plugin modules.
- To bump versions: edit `.protocversion` (and add the new platform checksums in `./tool/protoc`) for protoc, or `go get -tool <plugin>@<version>` followed by `make tidy` for a plugin.
Comment on lines 142 to +144
- Run `make check-proto` to confirm the committed generated files match a fresh `make proto`.

**Build fails after proto changes:**
- Run `make proto` to regenerate proto files
Expand Down
10 changes: 7 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ go 1.24.5
require (
github.com/DATA-DOG/go-sqlmock v1.5.0
github.com/go-sql-driver/mysql v1.6.0
github.com/gogo/protobuf v1.3.2
github.com/spf13/cobra v1.10.2
github.com/stretchr/testify v1.11.1
github.com/uber-go/tally/v4 v4.1.17
Expand All @@ -24,8 +23,6 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/status v1.1.0 // indirect
github.com/golang/mock v1.7.0-rc.1 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
Expand Down Expand Up @@ -56,6 +53,13 @@ require (
golang.org/x/tools v0.41.0 // indirect
golang.org/x/tools/go/expect v0.1.1-deprecated // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241230172942-26aa7a208def // indirect
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
honnef.co/go/tools v0.4.3 // indirect
)

tool (
go.uber.org/yarpc/encoding/protobuf/protoc-gen-yarpc-go-v2
google.golang.org/grpc/cmd/protoc-gen-go-grpc
google.golang.org/protobuf/cmd/protoc-gen-go
)
Loading