Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
defaults: &defaults
working_directory: /src/istio.io/api
docker:
- image: gcr.io/istio-testing/api-build-tools:2018-10-24
- image: gcr.io/istio-testing/api-build-tools:2018-10-31
environment:
GOPATH: /go
OUT_PATH: /src
Expand All @@ -16,6 +16,7 @@ jobs:
command: |
./scripts/generate-protos.sh || die "could not generate *.pb.go"
make proto-commit || die "could not regenerate proto.lock"
make lint || die "Lint errors"
if [[ -n $(git status --porcelain) ]]; then
git status
git --no-pager diff
Expand Down
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ repo_dir = .
docker_gen = /usr/bin/protoc -I/protobuf -I$(repo_dir)
out_path = $(OUT_PATH)
docker_lock = protolock
docker_tool = prototool
else
gen_img := gcr.io/istio-testing/protoc:2018-06-12
lock_img := gcr.io/istio-testing/protolock:2018-10-23
all_img := gcr.io/istio-testing/api-build-tools:2018-10-31
pwd := $(shell pwd)
mount_dir := /src
repo_dir := istio.io/api
repo_mount := $(mount_dir)/istio.io/api
docker_gen := docker run --rm -v $(pwd):$(repo_mount) -w $(mount_dir) $(gen_img) -I$(repo_dir)
out_path = .
docker_lock = docker run --rm -v $(pwd):$(repo_mount) -w $(repo_mount) $(lock_img)
docker_tool = docker run --rm -v $(pwd):$(repo_mount) -w $(repo_mount) $(all_img) prototool
endif

########################
Expand Down Expand Up @@ -344,9 +347,17 @@ clean-envoy:
#####################
# Protolock
#####################

proto-commit:
@$(docker_lock) commit

#####################
# Lint
#####################

lint:
@$(docker_tool) lint --protoc-bin-path=/usr/bin/protoc --protoc-wkt-path=/protobuf

#####################
# Cleanup
#####################
Expand Down
29 changes: 29 additions & 0 deletions prototool.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
protoc:
# This is ignored because we always run with
# --protoc-bin-path=/usr/bin/protoc to use the protoc from our
# container
version: 3.6.1

lint:
# Linter files to ignore.
ignores:
- id: MESSAGE_FIELD_NAMES_LOWER_SNAKE_CASE
files:
- rbac/v1alpha1/rbac.proto
- id: REQUEST_RESPONSE_TYPES_IN_SAME_FILE
files:
- mixer/v1/service.proto
- id: ENUM_FIELD_NAMES_UPPER_SNAKE_CASE
files:
- networking/v1alpha3/gateway.proto

# Linter rules.
rules:
# The specific linters to remove.
remove:
- FILE_OPTIONS_REQUIRE_JAVA_MULTIPLE_FILES
- FILE_OPTIONS_REQUIRE_JAVA_OUTER_CLASSNAME
- FILE_OPTIONS_REQUIRE_JAVA_PACKAGE
- FILE_OPTIONS_EQUAL_GO_PACKAGE_PB_SUFFIX
- ENUM_FIELD_PREFIXES
- ENUM_ZERO_VALUES_INVALID
1 change: 1 addition & 0 deletions prow/api-presubmit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ cd ${ROOT}

./scripts/generate-protos.sh || die "Could not generate *.pb.go"
make proto-commit || die "Could not commit new proto.lock"
make lint || die "Lint errors"

if [[ -n $(git status --porcelain) ]]; then
git status
Expand Down
3 changes: 3 additions & 0 deletions scripts/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ if [ $BRANCH_NAME != '(no branch)' ]; then

echo "Updating proto.lock"
make proto-commit

echo "Checking lint"
make lint
fi
15 changes: 15 additions & 0 deletions tools/all/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
FROM alpine:3.7 as prototool_download

RUN apk update && \
apk add curl && \
curl -sSL https://github.com/uber/prototool/releases/download/v1.3.0/prototool-Linux-x86_64 \
-o /usr/bin/prototool && \
chmod +x /usr/bin/prototool

FROM gcr.io/istio-testing/protolock:2018-10-23 as protolock

FROM gcr.io/istio-testing/protoc:2018-06-12
Expand All @@ -6,4 +14,11 @@ COPY --from=protolock \
/usr/bin/protolock \
/usr/bin/

COPY --from=prototool_download \
/usr/bin/prototool \
/usr/bin/

RUN apk update && \
apk add libc6-compat

ENTRYPOINT []