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
This commit is contained in:
Mahmood Ali 2020-11-20 09:26:02 -05:00
parent de6b023af2
commit ecbae03cf3
1 changed files with 10 additions and 1 deletions

View File

@ -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