From ecbae03cf3dbfb093c374b84e685488a42b92410 Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Fri, 20 Nov 2020 09:26:02 -0500 Subject: [PATCH] Parameterize buf compatibility target Parameterize it so we can arbitrary target other versions, if we are doing some manual checking, specially in the beginning when we may want to validate compatibilities for skip release upgrades. Also, introduce `checkbuf` target so we can run buf linter without the rest. use beta --- GNUmakefile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/GNUmakefile b/GNUmakefile index 04efa4fd5..88c939f4c 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -16,6 +16,10 @@ else GOTEST_PKGS=$(shell go list ./... | sed 's/github.com\/hashicorp\/nomad/./' | egrep -v "^($(GOTEST_PKGS_EXCLUDE))(/.*)?$$") endif +# tag corresponding to latest release we maintain backward compatibility with +# NOTE: using a pre-release, as buf fails to build the latest official release now +PROTO_COMPARE_TAG ?= v1.0.0-beta3$(if $(findstring ent,$(GO_TAGS)),+ent,) + default: help ifeq (,$(findstring $(THIS_OS),Darwin Linux FreeBSD Windows MSYS_NT)) @@ -204,7 +208,7 @@ check: ## Lint the source code @misspell -error -source=text website/pages/ @echo "==> Checking for breaking changes in protos..." - @buf check breaking --config tools/buf/buf.yaml --against-config tools/buf/buf.yaml --against .git#tag=v1.0.0-beta3 + @buf check breaking --config tools/buf/buf.yaml --against-config tools/buf/buf.yaml --against .git#tag=$(PROTO_COMPARE_TAG) @echo "==> Check proto files are in-sync..." @$(MAKE) proto @@ -234,6 +238,11 @@ checkscripts: ## Lint shell scripts @echo "==> Linting scripts..." @find scripts -type f -name '*.sh' | xargs shellcheck +.PHONY: checkproto +checkproto: ## Lint protobuf files + @echo "==> Checking for breaking changes in protos..." + @buf check breaking --config tools/buf/buf.yaml --against-config tools/buf/buf.yaml --against .git#tag=$(PROTO_COMPARE_TAG) + .PHONY: generate-all generate-all: generate-structs proto generate-examples