Skip to content

Commit

Permalink
Bumping buf to v2 to build correctly and removing out of date or unus…
Browse files Browse the repository at this point in the history
…ed configuration. Bumping proto plugins to latest.
  • Loading branch information
andream16 committed Oct 14, 2024
1 parent 524ae58 commit a3ac4e8
Show file tree
Hide file tree
Showing 87 changed files with 1,419 additions and 2,291 deletions.
26 changes: 18 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ ARANGODB_NS=arangodb

DOCKER=docker
PROTOC=protoc
BUF_CONTAINER=buf:local

export

Expand Down Expand Up @@ -122,7 +123,6 @@ install-lint-tools:
@go install github.com/kisielk/errcheck@latest
@go install github.com/rhysd/actionlint/cmd/actionlint@latest
@go install github.com/client9/misspell/cmd/misspell@latest
@go install github.com/bufbuild/buf/cmd/[email protected]
@npm ci

install-go-test-tools:
Expand All @@ -140,10 +140,6 @@ migration-tests: cmd/draconctl/bin

test: go-tests migration-tests

fmt-proto:
@echo "Tidying up Proto files"
@buf format -w ./api/proto

install-go-fmt-tools:
@go install github.com/bufbuild/buf/cmd/[email protected]
@go install golang.org/x/tools/cmd/goimports@latest
Expand Down Expand Up @@ -315,9 +311,23 @@ dev-deploy: deploy-cluster dev-infra dev-dracon
dev-teardown:
@kind delete clusters dracon-demo

generate-protos: install-lint-tools
@echo "Generating Protos"
@buf generate
build_buf_container:
$(DOCKER) build . -t $(BUF_CONTAINER) -f containers/Dockerfile.buf

run_buf: build_buf_container
$(DOCKER) run --volume "$(shell pwd):/workspace" --workdir /workspace $(BUF_CONTAINER) $(ARGS)

fmt-proto: build_buf_container
@echo "Tidying up Proto files"
$(MAKE) run_buf ARGS="format -w"

lint-proto: build_buf_container
@echo "Linting Proto files"
$(MAKE) run_buf ARGS="lint --exclude-path vendor"

generate-proto: build_buf_container
@echo "Generating Proto files"
$(MAKE) run_buf ARGS="generate"

########################################
########### RELEASE UTILITIES ##########
Expand Down
74 changes: 15 additions & 59 deletions api/proto/v1/engine.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/proto/v1/engine.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ message ScanInfo {
map<string, string> scan_tags = 3;
}

/* LaunchToolReponse consists of a response built by a producer,
/* LaunchToolResponse consists of a response built by a producer,
* to be interpreted by a consumer */
message LaunchToolResponse {
// The scan information, see above for details
Expand Down
52 changes: 11 additions & 41 deletions api/proto/v1/issue.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 1 addition & 10 deletions buf.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,2 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: googleapis
repository: googleapis
commit: 75b4300737fb4efca0831636be94e517
- remote: buf.build
owner: grpc-ecosystem
repository: grpc-gateway
commit: a1ecdc58eccd49aa8bea2a7a9022dc27
version: v2
12 changes: 2 additions & 10 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
---
version: v1
version: v2
lint:
use:
- DEFAULT
- STANDARD
- COMMENTS
- UNARY_RPC
- PACKAGE_NO_IMPORT_CYCLE
except:
# we use Please to run protoc where we only need the last part of the
# package name to match the directory name.
- PACKAGE_DIRECTORY_MATCH

deps:
# buf requires us to add the third party protos here as deps.
# Run:
# $ ./pleasew run "//third_party/binary/bufbuild/buf:buf|buf" -- mod update
# when you update this to update the lock file.
- buf.build/googleapis/googleapis
- buf.build/grpc-ecosystem/grpc-gateway
12 changes: 12 additions & 0 deletions containers/Dockerfile.buf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM golang:alpine AS golang
ENV GO111MODULE=on

RUN go install google.golang.org/protobuf/cmd/[email protected]

FROM bufbuild/buf:1.45.0 AS buf

FROM scratch
COPY --from=golang /go/bin/protoc-gen-go /go/bin/protoc-gen-go
COPY --from=buf /usr/local/bin/buf /usr/local/bin/buf
ENV PATH="/go/bin:${PATH}"
ENTRYPOINT ["/usr/local/bin/buf"]
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ require (
go.mongodb.org/mongo-driver v1.10.0
golang.org/x/crypto v0.18.0
golang.org/x/oauth2 v0.16.0
golang.org/x/sync v0.6.0
google.golang.org/api v0.156.0
google.golang.org/protobuf v1.34.1
google.golang.org/protobuf v1.35.1
helm.sh/helm/v3 v3.14.4
k8s.io/api v0.29.0
k8s.io/apimachinery v0.29.0
Expand Down Expand Up @@ -77,7 +78,7 @@ require (
github.com/goccy/go-json v0.9.11 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/cel-go v0.20.0 // indirect
Expand Down Expand Up @@ -142,7 +143,6 @@ require (
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/term v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.16.1 // indirect
Expand Down
Loading

0 comments on commit a3ac4e8

Please sign in to comment.