From a97b081df100cb43398fabb925ffae3f35b9816a Mon Sep 17 00:00:00 2001 From: "M. J. Fromberger" Date: Mon, 22 Nov 2021 12:03:24 -0800 Subject: [PATCH] Partial backport of protobuf generation changes. (#7302) This is a manual backport of the changes to how we build and run the protobuf toolchain images in Docker. The main effect here is to point to the new image from ghcr.io/tendermint/docker-proto-builder, but to make that work it is also necessary to update some of the branch pointers. This change does NOT include the changes from #7269 and #7291 to point to the proto files in the spec repo. To do that, we will need to create a branch or tag on the spec that has the released version, which does not exist in the spec history as it currently stands. --- Makefile | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 7f5dc677c..73ab548f1 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,9 @@ endif LD_FLAGS = -X github.com/tendermint/tendermint/version.TMVersion=$(VERSION) BUILD_FLAGS = -mod=readonly -ldflags "$(LD_FLAGS)" HTTPS_GIT := https://github.com/tendermint/tendermint.git -DOCKER_BUF := docker run -v $(shell pwd):/workspace --workdir /workspace bufbuild/buf +BUILD_IMAGE := ghcr.io/tendermint/docker-build-proto +BASE_BRANCH := v0.35.x +DOCKER_PROTO := docker run -v $(shell pwd):/workspace --workdir /workspace $(BUILD_IMAGE) CGO_ENABLED ?= 0 # handle nostrip @@ -83,26 +85,28 @@ proto-all: proto-gen proto-lint proto-check-breaking .PHONY: proto-all proto-gen: - @docker pull -q tendermintdev/docker-build-proto - @echo "Generating Protobuf files" - @docker run -v $(shell pwd):/workspace --workdir /workspace tendermintdev/docker-build-proto sh ./scripts/protocgen.sh + @echo "Generating Go packages for .proto files" + @$(DOCKER_PROTO) sh ./scripts/protocgen.sh .PHONY: proto-gen proto-lint: - @$(DOCKER_BUF) check lint --error-format=json + @echo "Running lint checks for .proto files" + @$(DOCKER_PROTO) buf lint --error-format=json .PHONY: proto-lint proto-format: - @echo "Formatting Protobuf files" - docker run -v $(shell pwd):/workspace --workdir /workspace tendermintdev/docker-build-proto find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {} \; + @echo "Formatting .proto files" + @$(DOCKER_PROTO) find ./ -not -path "./third_party/*" -name '*.proto' -exec clang-format -i {} \; .PHONY: proto-format proto-check-breaking: - @$(DOCKER_BUF) check breaking --against-input .git#branch=master + @echo "Checking for breaking changes in .proto files" + @$(DOCKER_PROTO) buf breaking --against .git#branch=$(BASE_BRANCH) .PHONY: proto-check-breaking proto-check-breaking-ci: - @$(DOCKER_BUF) check breaking --against-input $(HTTPS_GIT)#branch=master + @echo "Checking for breaking changes in .proto files" + @$(DOCKER_PROTO) buf breaking --against $(HTTPS_GIT)#branch=$(BASE_BRANCH) .PHONY: proto-check-breaking-ci ###############################################################################