Skip to content

Commit

Permalink
Merge pull request #9414 from hashicorp/b-tweak-buf-linter
Browse files Browse the repository at this point in the history
Parameterize buf compatibility check
  • Loading branch information
Mahmood Ali authored Nov 25, 2020
2 parents c2aaa51 + dbf201b commit 8dc7cc0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
14 changes: 13 additions & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -238,6 +242,14 @@ checkscripts: ## Lint shell scripts
@echo "==> Linting scripts..."
@find scripts -type f -name '*.sh' | xargs shellcheck

.PHONY: checkproto
checkproto: ## Lint protobuf files
@echo "==> Lint proto files..."
@buf check lint --config tools/buf/buf.yaml

@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

Expand Down
7 changes: 6 additions & 1 deletion tools/buf/buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ lint:
- plugins/shared/structs/proto/attribute.proto
- plugins/shared/structs/proto/recoverable_error.proto
- plugins/shared/structs/proto/stats.proto
FIELD_LOWER_SNAKE_CASE:
- plugins/base/proto/base.proto
- plugins/device/proto/device.proto
- plugins/drivers/proto/driver.proto
- plugins/shared/hclspec/hcl_spec.proto
PACKAGE_VERSION_SUFFIX:
- client/logmon/proto/logmon.proto
- drivers/docker/docklog/proto/docker_logger.proto
Expand Down Expand Up @@ -56,4 +61,4 @@ lint:

breaking:
use:
- WIRE_JSON
- WIRE_JSON

0 comments on commit 8dc7cc0

Please sign in to comment.