Skip to content

Commit

Permalink
fixup: Remove support for running protobuf with dockerfile
Browse files Browse the repository at this point in the history
Nobody seems to be using it and this avoids the need to maintain the
golang version in the Dockerfile.
  • Loading branch information
maru-ava committed May 1, 2024
1 parent f974b72 commit 0d90a3d
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 43 deletions.
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,6 @@ scripts/protobuf_codegen.sh

For more information, refer to the [GRPC Golang Quick Start Guide](https://grpc.io/docs/languages/go/quickstart/).

### Running protobuf codegen from docker

```sh
docker build -t avalanche:protobuf_codegen -f api/Dockerfile.buf .
docker run -t -i -v $(pwd):/opt/avalanche -w/opt/avalanche avalanche:protobuf_codegen bash -c "scripts/protobuf_codegen.sh"
```

### Running mock codegen

To regenerate the [gomock](https://github.com/uber-go/mock) code, run `scripts/mock.gen.sh` from the root of the repo.
Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/ava-labs/avalanchego

// The minimum golang version defined here will also be used for image builds.
// Make sure to keep proto/Dockerfile.buf updated with the same version.
// TODO(marun) Find a way to automatically update Dockerfile.buf
go 1.21.9

require (
Expand Down
22 changes: 0 additions & 22 deletions proto/Dockerfile.buf

This file was deleted.

5 changes: 2 additions & 3 deletions proto/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ Protobuf linting and generation for this project is managed by
[buf](https://github.com/bufbuild/buf).

Please find installation instructions on
[https://docs.buf.build/installation/](https://docs.buf.build/installation/) or
use `Dockerfile.buf` provided in the `proto/` directory of AvalancheGo.
[https://docs.buf.build/installation/](https://docs.buf.build/installation/).

Any changes made to proto definition can be updated by running
`protobuf_codegen.sh` located in the `scripts/` directory of AvalancheGo.
Expand All @@ -34,4 +33,4 @@ subnet vm must use the same protocol version to be compatible.
- Publish new tag to buf registry. `buf push -t v26`

Note: Publishing requires auth to the ava-labs org in buf
https://buf.build/ava-labs/repositories
https://buf.build/ava-labs/repositories
10 changes: 1 addition & 9 deletions scripts/protobuf_codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,14 @@ if ! [[ "$0" =~ scripts/protobuf_codegen.sh ]]; then
exit 255
fi

## install "buf"
# any version changes here should also be bumped in Dockerfile.buf
# ref. https://docs.buf.build/installation
# ref. https://github.com/bufbuild/buf/releases
## ensure the correct version of "buf" is installed
BUF_VERSION='1.31.0'
if [[ $(buf --version | cut -f2 -d' ') != "${BUF_VERSION}" ]]; then
echo "could not find buf ${BUF_VERSION}, is it installed + in PATH?"
exit 255
fi

## install "protoc-gen-go"
# any version changes here should also be bumped in Dockerfile.buf
# ref. https://github.com/protocolbuffers/protobuf-go/releases
PROTOC_GEN_GO_VERSION='v1.33.0'
go install -v google.golang.org/protobuf/cmd/protoc-gen-go@${PROTOC_GEN_GO_VERSION}
if [[ $(protoc-gen-go --version | cut -f2 -d' ') != "${PROTOC_GEN_GO_VERSION}" ]]; then
Expand All @@ -29,9 +24,6 @@ if [[ $(protoc-gen-go --version | cut -f2 -d' ') != "${PROTOC_GEN_GO_VERSION}" ]
fi

### install "protoc-gen-go-grpc"
# any version changes here should also be bumped in Dockerfile.buf
# ref. https://pkg.go.dev/google.golang.org/grpc/cmd/protoc-gen-go-grpc
# ref. https://github.com/grpc/grpc-go/blob/master/cmd/protoc-gen-go-grpc/main.go
PROTOC_GEN_GO_GRPC_VERSION='1.3.0'
go install -v google.golang.org/grpc/cmd/protoc-gen-go-grpc@v${PROTOC_GEN_GO_GRPC_VERSION}
if [[ $(protoc-gen-go-grpc --version | cut -f2 -d' ') != "${PROTOC_GEN_GO_GRPC_VERSION}" ]]; then
Expand Down

0 comments on commit 0d90a3d

Please sign in to comment.