File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ version: 2
22defaults : &defaults
33 working_directory : /src/istio.io/api
44 docker :
5- - image : gcr.io/istio-testing/api-build-tools:2018-10-24
5+ - image : gcr.io/istio-testing/api-build-tools:2018-10-31
66 environment :
77 GOPATH : /go
88 OUT_PATH : /src
1616 command : |
1717 ./scripts/generate-protos.sh || die "could not generate *.pb.go"
1818 make proto-commit || die "could not regenerate proto.lock"
19+ make lint || die "Lint errors"
1920 if [[ -n $(git status --porcelain) ]]; then
2021 git status
2122 git --no-pager diff
Original file line number Diff line number Diff line change @@ -11,16 +11,19 @@ repo_dir = .
1111docker_gen = /usr/bin/protoc -I/protobuf -I$(repo_dir )
1212out_path = $(OUT_PATH )
1313docker_lock = protolock
14+ docker_tool = prototool
1415else
1516gen_img := gcr.io/istio-testing/protoc:2018-06-12
1617lock_img := gcr.io/istio-testing/protolock:2018-10-23
18+ all_img := gcr.io/istio-testing/api-build-tools:2018-10-31
1719pwd := $(shell pwd)
1820mount_dir := /src
1921repo_dir := istio.io/api
2022repo_mount := $(mount_dir ) /istio.io/api
2123docker_gen := docker run --rm -v $(pwd ) :$(repo_mount ) -w $(mount_dir ) $(gen_img ) -I$(repo_dir )
2224out_path = .
2325docker_lock = docker run --rm -v $(pwd ) :$(repo_mount ) -w $(repo_mount ) $(lock_img )
26+ docker_tool = docker run --rm -v $(pwd ) :$(repo_mount ) -w $(repo_mount ) $(all_img ) prototool
2427endif
2528
2629# #######################
@@ -344,9 +347,17 @@ clean-envoy:
344347# ####################
345348# Protolock
346349# ####################
350+
347351proto-commit :
348352 @$(docker_lock ) commit
349353
354+ # ####################
355+ # Lint
356+ # ####################
357+
358+ lint :
359+ @$(docker_tool ) lint --protoc-bin-path=/usr/bin/protoc --protoc-wkt-path=/protobuf
360+
350361# ####################
351362# Cleanup
352363# ####################
Original file line number Diff line number Diff line change 1+ protoc :
2+ # This is ignored because we always run with
3+ # --protoc-bin-path=/usr/bin/protoc to use the protoc from our
4+ # container
5+ version : 3.6.1
6+
7+ lint :
8+ # Linter files to ignore.
9+ ignores :
10+ - id : MESSAGE_FIELD_NAMES_LOWER_SNAKE_CASE
11+ files :
12+ - rbac/v1alpha1/rbac.proto
13+ - id : REQUEST_RESPONSE_TYPES_IN_SAME_FILE
14+ files :
15+ - mixer/v1/service.proto
16+ - id : ENUM_FIELD_NAMES_UPPER_SNAKE_CASE
17+ files :
18+ - networking/v1alpha3/gateway.proto
19+
20+ # Linter rules.
21+ rules :
22+ # The specific linters to remove.
23+ remove :
24+ - FILE_OPTIONS_REQUIRE_JAVA_MULTIPLE_FILES
25+ - FILE_OPTIONS_REQUIRE_JAVA_OUTER_CLASSNAME
26+ - FILE_OPTIONS_REQUIRE_JAVA_PACKAGE
27+ - FILE_OPTIONS_EQUAL_GO_PACKAGE_PB_SUFFIX
28+ - ENUM_FIELD_PREFIXES
29+ - ENUM_ZERO_VALUES_INVALID
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ cd ${ROOT}
4242
4343./scripts/generate-protos.sh || die " Could not generate *.pb.go"
4444make proto-commit || die " Could not commit new proto.lock"
45+ make lint || die " Lint errors"
4546
4647if [[ -n $( git status --porcelain) ]]; then
4748 git status
Original file line number Diff line number Diff line change @@ -35,4 +35,7 @@ if [ $BRANCH_NAME != '(no branch)' ]; then
3535
3636 echo " Updating proto.lock"
3737 make proto-commit
38+
39+ echo " Checking lint"
40+ make lint
3841fi
Original file line number Diff line number Diff line change 1+ FROM alpine:3.7 as prototool_download
2+
3+ RUN apk update && \
4+ apk add curl && \
5+ curl -sSL https://github.com/uber/prototool/releases/download/v1.3.0/prototool-Linux-x86_64 \
6+ -o /usr/bin/prototool && \
7+ chmod +x /usr/bin/prototool
8+
19FROM gcr.io/istio-testing/protolock:2018-10-23 as protolock
210
311FROM gcr.io/istio-testing/protoc:2018-06-12
@@ -6,4 +14,11 @@ COPY --from=protolock \
614 /usr/bin/protolock \
715 /usr/bin/
816
17+ COPY --from=prototool_download \
18+ /usr/bin/prototool \
19+ /usr/bin/
20+
21+ RUN apk update && \
22+ apk add libc6-compat
23+
924ENTRYPOINT []
You can’t perform that action at this time.
0 commit comments