mirror of https://github.com/istio/proxy.git
Update common files (#2441)
This commit is contained in:
parent
3db215daba
commit
004532ce6f
|
|
@ -1 +0,0 @@
|
||||||
a76704447c3f006d06fc5c5a76cfbb464d87331d
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
*.descriptor linguist-generated=true
|
||||||
|
*.descriptor -diff -merge
|
||||||
|
*.descriptor_set linguist-generated=true
|
||||||
|
*.descriptor_set -diff -merge
|
||||||
|
*.pb.html linguist-generated=true
|
||||||
|
*.pb.go linguist-generated=true
|
||||||
|
*.gen.go linguist-generated=true
|
||||||
|
*.gen.yaml linguist-generated=true
|
||||||
|
*_pb2.py linguist-generated=true
|
||||||
166
Makefile
166
Makefile
|
|
@ -1,102 +1,102 @@
|
||||||
## Copyright 2017 Istio Authors
|
# WARNING: DO NOT EDIT, THIS FILE IS PROBABLY A COPY
|
||||||
##
|
#
|
||||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
# The original version of this file is located in the https://github.com/istio/common-files repo.
|
||||||
## you may not use this file except in compliance with the License.
|
# If you're looking at this file in a different repo and want to make a change, please go to the
|
||||||
## You may obtain a copy of the License at
|
# common-files repo, make the change there and check it in. Then come back to this repo and run
|
||||||
##
|
# "make update-common".
|
||||||
## http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
##
|
|
||||||
## Unless required by applicable law or agreed to in writing, software
|
|
||||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
## See the License for the specific language governing permissions and
|
|
||||||
## limitations under the License.
|
|
||||||
|
|
||||||
TOP := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
# Copyright Istio Authors
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
SHELL := /bin/bash
|
# allow optional per-repo overrides
|
||||||
BAZEL_STARTUP_ARGS ?=
|
-include Makefile.overrides.mk
|
||||||
BAZEL_BUILD_ARGS ?=
|
|
||||||
BAZEL_TARGETS ?= //...
|
|
||||||
# Some tests run so slowly under the santizers that they always timeout.
|
|
||||||
SANITIZER_EXCLUSIONS ?= -test/integration:mixer_fault_test
|
|
||||||
HUB ?=
|
|
||||||
TAG ?=
|
|
||||||
|
|
||||||
ifeq "$(origin CC)" "default"
|
# Set the environment variable BUILD_WITH_CONTAINER to use a container
|
||||||
CC := clang
|
# to build the repo. The only dependencies in this mode are to have make and
|
||||||
endif
|
# docker. If you'd rather build with a local tool chain instead, you'll need to
|
||||||
ifeq "$(origin CXX)" "default"
|
# figure out all the tools you need in your environment to make that work.
|
||||||
CXX := clang++
|
export BUILD_WITH_CONTAINER ?= 0
|
||||||
endif
|
|
||||||
PATH := /usr/lib/llvm-9/bin:$(PATH)
|
|
||||||
|
|
||||||
VERBOSE ?=
|
LOCAL_ARCH := $(shell uname -m)
|
||||||
ifeq "$(VERBOSE)" "1"
|
ifeq ($(LOCAL_ARCH),x86_64)
|
||||||
BAZEL_STARTUP_ARGS := --client_debug $(BAZEL_STARTUP_ARGS)
|
TARGET_ARCH ?= amd64
|
||||||
BAZEL_BUILD_ARGS := -s --sandbox_debug --verbose_failures $(BAZEL_BUILD_ARGS)
|
else ifeq ($(shell echo $(LOCAL_ARCH) | head -c 5),armv8)
|
||||||
|
TARGET_ARCH ?= arm64
|
||||||
|
else ifeq ($(shell echo $(LOCAL_ARCH) | head -c 4),armv)
|
||||||
|
TARGET_ARCH ?= arm
|
||||||
|
else
|
||||||
|
$(error This system's architecture $(LOCAL_ARCH) isn't supported)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
UNAME := $(shell uname)
|
LOCAL_OS := $(shell uname)
|
||||||
ifeq ($(UNAME),Linux)
|
ifeq ($(LOCAL_OS),Linux)
|
||||||
BAZEL_CONFIG_DEV = --config=libc++
|
TARGET_OS ?= linux
|
||||||
BAZEL_CONFIG_REL = --config=libc++ --config=release
|
READLINK_FLAGS="-f"
|
||||||
BAZEL_CONFIG_ASAN = --config=libc++ --config=clang-asan
|
else ifeq ($(LOCAL_OS),Darwin)
|
||||||
BAZEL_CONFIG_TSAN = --config=libc++ --config=clang-tsan
|
TARGET_OS ?= darwin
|
||||||
endif
|
READLINK_FLAGS=""
|
||||||
ifeq ($(UNAME),Darwin)
|
else
|
||||||
BAZEL_CONFIG_DEV = # macOS always links against libc++
|
$(error This system's OS $(LOCAL_OS) isn't supported)
|
||||||
BAZEL_CONFIG_REL = --config=release
|
|
||||||
BAZEL_CONFIG_ASAN = --config=macos-asan
|
|
||||||
BAZEL_CONFIG_TSAN = # no working config
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
build:
|
export TARGET_OUT ?= $(shell pwd)/out/$(TARGET_ARCH)_$(TARGET_OS)
|
||||||
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) && bazel $(BAZEL_STARTUP_ARGS) build $(BAZEL_BUILD_ARGS) $(BAZEL_CONFIG_DEV) $(BAZEL_TARGETS)
|
|
||||||
|
|
||||||
build_envoy:
|
ifeq ($(BUILD_WITH_CONTAINER),1)
|
||||||
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) && bazel $(BAZEL_STARTUP_ARGS) build $(BAZEL_BUILD_ARGS) $(BAZEL_CONFIG_REL) //src/envoy:envoy
|
export TARGET_OUT = /work/out/$(TARGET_ARCH)_$(TARGET_OS)
|
||||||
|
CONTAINER_CLI ?= docker
|
||||||
|
DOCKER_SOCKET_MOUNT ?= -v /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
IMG ?= gcr.io/istio-testing/build-tools:2019-10-11T13-37-52
|
||||||
|
UID = $(shell id -u)
|
||||||
|
PWD = $(shell pwd)
|
||||||
|
|
||||||
clean:
|
$(info Building with the build container: $(IMG).)
|
||||||
@bazel clean
|
|
||||||
|
|
||||||
test:
|
# Determine the timezone across various platforms to pass into the
|
||||||
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) && bazel $(BAZEL_STARTUP_ARGS) build $(BAZEL_BUILD_ARGS) $(BAZEL_CONFIG_DEV) //src/envoy:envoy
|
# docker run operation. This operation assumes zoneinfo is within
|
||||||
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) && bazel $(BAZEL_STARTUP_ARGS) test $(BAZEL_BUILD_ARGS) $(BAZEL_CONFIG_DEV) $(BAZEL_TARGETS)
|
# the path of the file.
|
||||||
GO111MODULE=on go test ./...
|
TIMEZONE=`readlink $(READLINK_FLAGS) /etc/localtime | sed -e 's/^.*zoneinfo\///'`
|
||||||
|
|
||||||
test_asan:
|
RUN = $(CONTAINER_CLI) run -t -i --sig-proxy=true -u $(UID):docker --rm \
|
||||||
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) && bazel $(BAZEL_STARTUP_ARGS) build $(BAZEL_BUILD_ARGS) $(BAZEL_CONFIG_ASAN) //src/envoy:envoy
|
-e IN_BUILD_CONTAINER="$(BUILD_WITH_CONTAINER)" \
|
||||||
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) && bazel $(BAZEL_STARTUP_ARGS) test $(BAZEL_BUILD_ARGS) $(BAZEL_CONFIG_ASAN) -- $(BAZEL_TARGETS) $(SANITIZER_EXCLUSIONS)
|
-e TZ="$(TIMEZONE)" \
|
||||||
GO111MODULE=on go test ./...
|
-e TARGET_ARCH="$(TARGET_ARCH)" \
|
||||||
|
-e TARGET_OS="$(TARGET_OS)" \
|
||||||
|
-e TARGET_OUT="$(TARGET_OUT)" \
|
||||||
|
-e HUB="$(HUB)" \
|
||||||
|
-e TAG="$(TAG)" \
|
||||||
|
-v /etc/passwd:/etc/passwd:ro \
|
||||||
|
$(DOCKER_SOCKET_MOUNT) \
|
||||||
|
$(CONTAINER_OPTIONS) \
|
||||||
|
--mount type=bind,source="$(PWD)",destination="/work" \
|
||||||
|
--mount type=volume,source=go,destination="/go" \
|
||||||
|
--mount type=volume,source=gocache,destination="/gocache" \
|
||||||
|
-w /work $(IMG)
|
||||||
|
|
||||||
test_tsan:
|
MAKE = $(RUN) make --no-print-directory -e -f Makefile.core.mk
|
||||||
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) && bazel $(BAZEL_STARTUP_ARGS) build $(BAZEL_BUILD_ARGS) $(BAZEL_CONFIG_TSAN) //src/envoy:envoy
|
|
||||||
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) && bazel $(BAZEL_STARTUP_ARGS) test $(BAZEL_BUILD_ARGS) $(BAZEL_CONFIG_TSAN) --test_env=TSAN_OPTIONS=suppressions=$(TOP)/tsan.suppressions -- $(BAZEL_TARGETS) $(SANITIZER_EXCLUSIONS)
|
|
||||||
GO111MODULE=on go test ./...
|
|
||||||
|
|
||||||
check:
|
%:
|
||||||
@echo >&2 "Please use \"make lint\" instead."
|
@$(MAKE) $@
|
||||||
@false
|
|
||||||
|
|
||||||
lint:
|
default:
|
||||||
@scripts/check_license.sh
|
@$(MAKE)
|
||||||
@scripts/check-repository.sh
|
|
||||||
@scripts/check-style.sh
|
|
||||||
|
|
||||||
deb:
|
.PHONY: default
|
||||||
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) && bazel $(BAZEL_STARTUP_ARGS) build $(BAZEL_BUILD_ARGS) $(BAZEL_CONFIG_REL) //tools/deb:istio-proxy
|
|
||||||
|
|
||||||
artifacts:
|
else
|
||||||
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) BAZEL_BUILD_ARGS="$(BAZEL_BUILD_ARGS)" && ./scripts/push-debian.sh -p "$(ARTIFACTS_GCS_PATH)" -o "$(ARTIFACTS_DIR)"
|
|
||||||
|
|
||||||
test_release:
|
$(info Building with your local toolchain.)
|
||||||
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) BAZEL_BUILD_ARGS="$(BAZEL_BUILD_ARGS)" && ./scripts/release-binary.sh -i
|
GOBIN ?= $(GOPATH)/bin
|
||||||
|
include Makefile.core.mk
|
||||||
|
|
||||||
push_release:
|
endif
|
||||||
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) BAZEL_BUILD_ARGS="$(BAZEL_BUILD_ARGS)" && ./scripts/release-binary.sh -d "$(RELEASE_GCS_PATH)"
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: build clean test check artifacts
|
|
||||||
|
|
||||||
include Makefile.common.mk
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
## Copyright 2017 Istio Authors
|
||||||
|
##
|
||||||
|
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
## you may not use this file except in compliance with the License.
|
||||||
|
## You may obtain a copy of the License at
|
||||||
|
##
|
||||||
|
## http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
##
|
||||||
|
## Unless required by applicable law or agreed to in writing, software
|
||||||
|
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
## See the License for the specific language governing permissions and
|
||||||
|
## limitations under the License.
|
||||||
|
|
||||||
|
TOP := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||||
|
|
||||||
|
SHELL := /bin/bash
|
||||||
|
BAZEL_STARTUP_ARGS ?=
|
||||||
|
BAZEL_BUILD_ARGS ?=
|
||||||
|
BAZEL_TARGETS ?= //...
|
||||||
|
# Some tests run so slowly under the santizers that they always timeout.
|
||||||
|
SANITIZER_EXCLUSIONS ?= -test/integration:mixer_fault_test
|
||||||
|
HUB ?=
|
||||||
|
TAG ?=
|
||||||
|
|
||||||
|
ifeq "$(origin CC)" "default"
|
||||||
|
CC := clang
|
||||||
|
endif
|
||||||
|
ifeq "$(origin CXX)" "default"
|
||||||
|
CXX := clang++
|
||||||
|
endif
|
||||||
|
PATH := /usr/lib/llvm-9/bin:$(PATH)
|
||||||
|
|
||||||
|
VERBOSE ?=
|
||||||
|
ifeq "$(VERBOSE)" "1"
|
||||||
|
BAZEL_STARTUP_ARGS := --client_debug $(BAZEL_STARTUP_ARGS)
|
||||||
|
BAZEL_BUILD_ARGS := -s --sandbox_debug --verbose_failures $(BAZEL_BUILD_ARGS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
UNAME := $(shell uname)
|
||||||
|
ifeq ($(UNAME),Linux)
|
||||||
|
BAZEL_CONFIG_DEV = --config=libc++
|
||||||
|
BAZEL_CONFIG_REL = --config=libc++ --config=release
|
||||||
|
BAZEL_CONFIG_ASAN = --config=libc++ --config=clang-asan
|
||||||
|
BAZEL_CONFIG_TSAN = --config=libc++ --config=clang-tsan
|
||||||
|
endif
|
||||||
|
ifeq ($(UNAME),Darwin)
|
||||||
|
BAZEL_CONFIG_DEV = # macOS always links against libc++
|
||||||
|
BAZEL_CONFIG_REL = --config=release
|
||||||
|
BAZEL_CONFIG_ASAN = --config=macos-asan
|
||||||
|
BAZEL_CONFIG_TSAN = # no working config
|
||||||
|
endif
|
||||||
|
|
||||||
|
build:
|
||||||
|
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) && bazel $(BAZEL_STARTUP_ARGS) build $(BAZEL_BUILD_ARGS) $(BAZEL_CONFIG_DEV) $(BAZEL_TARGETS)
|
||||||
|
|
||||||
|
build_envoy:
|
||||||
|
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) && bazel $(BAZEL_STARTUP_ARGS) build $(BAZEL_BUILD_ARGS) $(BAZEL_CONFIG_REL) //src/envoy:envoy
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@bazel clean
|
||||||
|
|
||||||
|
test:
|
||||||
|
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) && bazel $(BAZEL_STARTUP_ARGS) build $(BAZEL_BUILD_ARGS) $(BAZEL_CONFIG_DEV) //src/envoy:envoy
|
||||||
|
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) && bazel $(BAZEL_STARTUP_ARGS) test $(BAZEL_BUILD_ARGS) $(BAZEL_CONFIG_DEV) $(BAZEL_TARGETS)
|
||||||
|
GO111MODULE=on go test ./...
|
||||||
|
|
||||||
|
test_asan:
|
||||||
|
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) && bazel $(BAZEL_STARTUP_ARGS) build $(BAZEL_BUILD_ARGS) $(BAZEL_CONFIG_ASAN) //src/envoy:envoy
|
||||||
|
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) && bazel $(BAZEL_STARTUP_ARGS) test $(BAZEL_BUILD_ARGS) $(BAZEL_CONFIG_ASAN) -- $(BAZEL_TARGETS) $(SANITIZER_EXCLUSIONS)
|
||||||
|
GO111MODULE=on go test ./...
|
||||||
|
|
||||||
|
test_tsan:
|
||||||
|
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) && bazel $(BAZEL_STARTUP_ARGS) build $(BAZEL_BUILD_ARGS) $(BAZEL_CONFIG_TSAN) //src/envoy:envoy
|
||||||
|
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) && bazel $(BAZEL_STARTUP_ARGS) test $(BAZEL_BUILD_ARGS) $(BAZEL_CONFIG_TSAN) --test_env=TSAN_OPTIONS=suppressions=$(TOP)/tsan.suppressions -- $(BAZEL_TARGETS) $(SANITIZER_EXCLUSIONS)
|
||||||
|
GO111MODULE=on go test ./...
|
||||||
|
|
||||||
|
check:
|
||||||
|
@echo >&2 "Please use \"make lint\" instead."
|
||||||
|
@false
|
||||||
|
|
||||||
|
lint: lint-copyright-banner
|
||||||
|
@scripts/check-repository.sh
|
||||||
|
@scripts/check-style.sh
|
||||||
|
|
||||||
|
deb:
|
||||||
|
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) && bazel $(BAZEL_STARTUP_ARGS) build $(BAZEL_BUILD_ARGS) $(BAZEL_CONFIG_REL) //tools/deb:istio-proxy
|
||||||
|
|
||||||
|
artifacts:
|
||||||
|
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) BAZEL_BUILD_ARGS="$(BAZEL_BUILD_ARGS)" && ./scripts/push-debian.sh -p "$(ARTIFACTS_GCS_PATH)" -o "$(ARTIFACTS_DIR)"
|
||||||
|
|
||||||
|
test_release:
|
||||||
|
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) BAZEL_BUILD_ARGS="$(BAZEL_BUILD_ARGS)" && ./scripts/release-binary.sh -i
|
||||||
|
|
||||||
|
push_release:
|
||||||
|
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) BAZEL_BUILD_ARGS="$(BAZEL_BUILD_ARGS)" && ./scripts/release-binary.sh -d "$(RELEASE_GCS_PATH)"
|
||||||
|
|
||||||
|
.PHONY: build clean test check artifacts
|
||||||
|
|
||||||
|
include common/Makefile.common.mk
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
# Copyright 2019 Istio Authors
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
# this repo is not on the container plan by default
|
||||||
|
BUILD_WITH_CONTAINER ?= 0
|
||||||
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
Here are some resources to help you understand and use Istio:
|
Here are some resources to help you understand and use Istio:
|
||||||
|
|
||||||
- For in-depth information about how to use Istio, visit [istio.io](https://istio.io)
|
- For in-depth information about how to use Istio, visit [istio.io](https://istio.io)
|
||||||
- To ask questions and get assistance from our community, visit [discuss.istio.io](https://discuss.istio.io)
|
- To ask questions and get assistance from our community, visit [discuss.istio.io](https://discuss.istio.io)
|
||||||
- To learn how to participate in our overall community, visit [our community page](https://istio.io/about/community)
|
- To learn how to participate in our overall community, visit [our community page](https://istio.io/about/community)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
6c1a9ea348417a19b3d970ba46a6fcb52601dc97
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
# WARNING: DO NOT EDIT, THIS FILE IS PROBABLY A COPY
|
||||||
|
#
|
||||||
|
# The original version of this file is located in the https://github.com/istio/common-files repo.
|
||||||
|
# If you're looking at this file in a different repo and want to make a change, please go to the
|
||||||
|
# common-files repo, make the change there and check it in. Then come back to this repo and run
|
||||||
|
# "make update-common".
|
||||||
|
|
||||||
|
# Copyright Istio Authors
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
FINDFILES=find . \( -path ./common-protos -o -path ./.git -o -path ./.github \) -prune -o -type f
|
||||||
|
XARGS = xargs -0 -r
|
||||||
|
|
||||||
|
lint-dockerfiles:
|
||||||
|
@${FINDFILES} -name 'Dockerfile*' -print0 | ${XARGS} hadolint -c ./common/config/.hadolint.yml
|
||||||
|
|
||||||
|
lint-scripts:
|
||||||
|
@${FINDFILES} -name '*.sh' -print0 | ${XARGS} shellcheck
|
||||||
|
|
||||||
|
lint-yaml:
|
||||||
|
@${FINDFILES} \( -name '*.yml' -o -name '*.yaml' \) -print0 | ${XARGS} grep -L -e "{{" | xargs -r yamllint -c ./common/config/.yamllint.yml
|
||||||
|
|
||||||
|
lint-helm:
|
||||||
|
@${FINDFILES} -name 'Chart.yaml' -print0 | ${XARGS} -L 1 dirname | xargs -r helm lint --strict
|
||||||
|
|
||||||
|
lint-copyright-banner:
|
||||||
|
@${FINDFILES} \( -name '*.go' -o -name '*.cc' -o -name '*.h' -o -name '*.proto' -o -name '*.py' -o -name '*.sh' \) \( ! \( -name '*.gen.go' -o -name '*.pb.go' -o -name '*_pb2.py' \) \) -print0 |\
|
||||||
|
${XARGS} common/scripts/lint_copyright_banner.sh
|
||||||
|
|
||||||
|
lint-go:
|
||||||
|
@${FINDFILES} -name '*.go' \( ! \( -name '*.gen.go' -o -name '*.pb.go' \) \) -print0 | ${XARGS} common/scripts/lint_go.sh
|
||||||
|
|
||||||
|
lint-python:
|
||||||
|
@${FINDFILES} -name '*.py' \( ! \( -name '*_pb2.py' \) \) -print0 | ${XARGS} autopep8 --max-line-length 160 --exit-code -d
|
||||||
|
|
||||||
|
lint-markdown:
|
||||||
|
@${FINDFILES} -name '*.md' -print0 | ${XARGS} mdl --ignore-front-matter --style common/config/mdl.rb
|
||||||
|
@${FINDFILES} -name '*.md' -print0 | ${XARGS} awesome_bot --skip-save-results --allow_ssl --allow-timeout --allow-dupe --allow-redirect --white-list ${MARKDOWN_LINT_WHITELIST}
|
||||||
|
|
||||||
|
lint-sass:
|
||||||
|
@${FINDFILES} -name '*.scss' -print0 | ${XARGS} sass-lint -c common/config/sass-lint.yml --verbose
|
||||||
|
|
||||||
|
lint-typescript:
|
||||||
|
@${FINDFILES} -name '*.ts' -print0 | ${XARGS} tslint -c common/config/tslint.json
|
||||||
|
|
||||||
|
lint-protos:
|
||||||
|
@if test -d common-protos; then $(FINDFILES) -name '*.proto' -print0 | $(XARGS) -L 1 prototool lint --protoc-bin-path=/usr/bin/protoc --protoc-wkt-path=common-protos; fi
|
||||||
|
|
||||||
|
lint-licenses:
|
||||||
|
@-go mod download
|
||||||
|
@license-lint --config common/config/license-lint.yml
|
||||||
|
|
||||||
|
lint-all: lint-dockerfiles lint-scripts lint-yaml lint-helm lint-copyright-banner lint-go lint-python lint-markdown lint-sass lint-typescript lint-protos lint-licenses
|
||||||
|
|
||||||
|
format-go:
|
||||||
|
@${FINDFILES} -name '*.go' \( ! \( -name '*.gen.go' -o -name '*.pb.go' \) \) -print0 | ${XARGS} goimports -w -local "istio.io"
|
||||||
|
|
||||||
|
format-python:
|
||||||
|
@${FINDFILES} -name '*.py' -print0 | ${XARGS} autopep8 --max-line-length 160 --aggressive --aggressive -i
|
||||||
|
|
||||||
|
format-protos:
|
||||||
|
@$(FINDFILES) -name '*.proto' -print0 | $(XARGS) -L 1 prototool format -w
|
||||||
|
|
||||||
|
dump-licenses:
|
||||||
|
@go mod download
|
||||||
|
@license-lint --config common/config/license-lint.yml --report
|
||||||
|
|
||||||
|
dump-licenses-csv:
|
||||||
|
@go mod download
|
||||||
|
@license-lint --config common/config/license-lint.yml --csv
|
||||||
|
|
||||||
|
update-common:
|
||||||
|
@git clone -q --depth 1 --single-branch --branch master https://github.com/istio/common-files
|
||||||
|
@cd common-files ; git rev-parse HEAD >files/common/.commonfiles.sha
|
||||||
|
@rm -fr common
|
||||||
|
@cp -rT common-files/files .
|
||||||
|
@rm -fr common-files
|
||||||
|
|
||||||
|
update-common-protos:
|
||||||
|
@git clone -q --depth 1 --single-branch --branch master https://github.com/istio/common-files
|
||||||
|
@cd common-files ; git rev-parse HEAD > common-protos/.commonfiles.sha
|
||||||
|
@rm -fr common-protos
|
||||||
|
@cp -ar common-files/common-protos common-protos
|
||||||
|
@rm -fr common-files
|
||||||
|
|
||||||
|
check-clean-repo:
|
||||||
|
@common/scripts/check_clean_repo.sh
|
||||||
|
|
||||||
|
.PHONY: lint-dockerfiles lint-scripts lint-yaml lint-copyright-banner lint-go lint-python lint-helm lint-markdown lint-sass lint-typescript lint-protos lint-all format-go format-python format-protos update-common update-common-protos lint-licenses dump-licenses dump-licenses-csv check-clean-repo
|
||||||
|
|
@ -3,11 +3,11 @@
|
||||||
# The original version of this file is located in the https://github.com/istio/common-files repo.
|
# The original version of this file is located in the https://github.com/istio/common-files repo.
|
||||||
# If you're looking at this file in a different repo and want to make a change, please go to the
|
# If you're looking at this file in a different repo and want to make a change, please go to the
|
||||||
# common-files repo, make the change there and check it in. Then come back to this repo and run
|
# common-files repo, make the change there and check it in. Then come back to this repo and run
|
||||||
# "make updatecommon".
|
# "make update-common".
|
||||||
|
|
||||||
service:
|
service:
|
||||||
# When updating this, also update bin/linters.sh accordingly
|
# When updating this, also update the version stored in docker/build-tools/Dockerfile in the istio/tools repo.
|
||||||
golangci-lint-version: 1.16.x # use the fixed version to not introduce new linters unexpectedly
|
golangci-lint-version: 1.18.x # use the fixed version to not introduce new linters unexpectedly
|
||||||
run:
|
run:
|
||||||
# timeout for analysis, e.g. 30s, 5m, default is 1m
|
# timeout for analysis, e.g. 30s, 5m, default is 1m
|
||||||
deadline: 20m
|
deadline: 20m
|
||||||
|
|
@ -42,6 +42,8 @@ linters:
|
||||||
- nakedret
|
- nakedret
|
||||||
- prealloc
|
- prealloc
|
||||||
- scopelint
|
- scopelint
|
||||||
|
- funlen
|
||||||
|
- bodyclose
|
||||||
fast: false
|
fast: false
|
||||||
|
|
||||||
linters-settings:
|
linters-settings:
|
||||||
|
|
@ -74,6 +76,8 @@ linters-settings:
|
||||||
# Default is to use a neutral variety of English.
|
# Default is to use a neutral variety of English.
|
||||||
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
|
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
|
||||||
locale: US
|
locale: US
|
||||||
|
ignore-words:
|
||||||
|
- cancelled
|
||||||
lll:
|
lll:
|
||||||
# max line length, lines longer will be reported. Default is 120.
|
# max line length, lines longer will be reported. Default is 120.
|
||||||
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
|
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
|
||||||
|
|
@ -142,9 +146,9 @@ linters-settings:
|
||||||
- unslice
|
- unslice
|
||||||
- valSwap
|
- valSwap
|
||||||
- weakCond
|
- weakCond
|
||||||
- yodaStyleExpr
|
|
||||||
|
|
||||||
# Unused
|
# Unused
|
||||||
|
# - yodaStyleExpr
|
||||||
# - appendAssign
|
# - appendAssign
|
||||||
# - commentFormatting
|
# - commentFormatting
|
||||||
# - emptyStringTest
|
# - emptyStringTest
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
# WARNING: DO NOT EDIT, THIS FILE IS PROBABLY A COPY
|
||||||
|
#
|
||||||
|
# The original version of this file is located in the https://github.com/istio/common-files repo.
|
||||||
|
# If you're looking at this file in a different repo and want to make a change, please go to the
|
||||||
|
# common-files repo, make the change there and check it in. Then come back to this repo and run
|
||||||
|
# "make update-common".
|
||||||
|
|
||||||
|
ignored:
|
||||||
|
|
||||||
|
trustedRegistries:
|
||||||
|
- gcr.io
|
||||||
|
- docker.io
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
# WARNING: DO NOT EDIT, THIS FILE IS PROBABLY A COPY
|
||||||
|
#
|
||||||
|
# The original version of this file is located in the https://github.com/istio/common-files repo.
|
||||||
|
# If you're looking at this file in a different repo and want to make a change, please go to the
|
||||||
|
# common-files repo, make the change there and check it in. Then come back to this repo and run
|
||||||
|
# "make update-common".
|
||||||
|
|
||||||
|
rules:
|
||||||
|
braces: disable
|
||||||
|
brackets: disable
|
||||||
|
colons: enable
|
||||||
|
commas: disable
|
||||||
|
comments: disable
|
||||||
|
comments-indentation: disable
|
||||||
|
document-end: disable
|
||||||
|
document-start: disable
|
||||||
|
empty-lines: disable
|
||||||
|
empty-values: enable
|
||||||
|
hyphens: enable
|
||||||
|
indentation: disable
|
||||||
|
key-duplicates: enable
|
||||||
|
key-ordering: disable
|
||||||
|
line-length: disable
|
||||||
|
new-line-at-end-of-file: disable
|
||||||
|
new-lines: enable
|
||||||
|
octal-values: enable
|
||||||
|
quoted-strings: disable
|
||||||
|
trailing-spaces: disable
|
||||||
|
truthy: disable
|
||||||
|
|
@ -0,0 +1,141 @@
|
||||||
|
unrestricted_licenses:
|
||||||
|
- Apache-2.0
|
||||||
|
- ISC
|
||||||
|
- AFL-2.1
|
||||||
|
- AFL-3.0
|
||||||
|
- Artistic-1.0
|
||||||
|
- Artistic-2.0
|
||||||
|
- Apache-1.1
|
||||||
|
- BSD-1-Clause
|
||||||
|
- BSD-2-Clause
|
||||||
|
- BSD-3-Clause
|
||||||
|
- FTL
|
||||||
|
- LPL-1.02
|
||||||
|
- MS-PL
|
||||||
|
- MIT
|
||||||
|
- NCSA
|
||||||
|
- OpenSSL
|
||||||
|
- PHP-3.0
|
||||||
|
- TCP-wrappers
|
||||||
|
- W3C
|
||||||
|
- Xnet
|
||||||
|
- Zlib
|
||||||
|
|
||||||
|
reciprocal_licenses:
|
||||||
|
- CC0-1.0
|
||||||
|
- APSL-2.0
|
||||||
|
- CDDL-1.0
|
||||||
|
- CDDL-1.1
|
||||||
|
- CPL-1.0
|
||||||
|
- EPL-1.0
|
||||||
|
- IPL-1.0
|
||||||
|
- MPL-1.0
|
||||||
|
- MPL-1.1
|
||||||
|
- MPL-2.0
|
||||||
|
- Ruby
|
||||||
|
|
||||||
|
restricted_licenses:
|
||||||
|
- GPL-1.0-only
|
||||||
|
- GPL-1.0-or-later
|
||||||
|
- GPL-2.0-only
|
||||||
|
- GPL-2.0-or-later
|
||||||
|
- GPL-3.0-only
|
||||||
|
- GPL-3.0-or-later
|
||||||
|
- LGPL-2.0-only
|
||||||
|
- LGPL-2.0-or-later
|
||||||
|
- LGPL-2.1-only
|
||||||
|
- LGPL-2.1-or-later
|
||||||
|
- LGPL-3.0-only
|
||||||
|
- LGPL-3.0-or-later
|
||||||
|
- NPL-1.0
|
||||||
|
- NPL-1.1
|
||||||
|
- OSL-1.0
|
||||||
|
- OSL-1.1
|
||||||
|
- OSL-2.0
|
||||||
|
- OSL-2.1
|
||||||
|
- OSL-3.0
|
||||||
|
- QPL-1.0
|
||||||
|
- Sleepycat
|
||||||
|
|
||||||
|
whitelisted_modules:
|
||||||
|
- bitbucket.org/ww/goautoneg
|
||||||
|
- git.apache.org/thrift.git
|
||||||
|
- github.com/alicebob/gopher-json
|
||||||
|
- github.com/antlr/antlr4
|
||||||
|
- github.com/apache/thrift
|
||||||
|
- github.com/bazelbuild/buildtools
|
||||||
|
- github.com/bgentry/speakeasy
|
||||||
|
- github.com/bmizerany/assert
|
||||||
|
- github.com/BurntSushi/xgb
|
||||||
|
- github.com/DATA-DOG/go-sqlmock
|
||||||
|
- github.com/daviddengcn/go-colortext
|
||||||
|
- github.com/dchest/siphash
|
||||||
|
- github.com/dnaeon/go-vcr
|
||||||
|
- github.com/docker/docker
|
||||||
|
- github.com/duosecurity/duo_api_golang
|
||||||
|
- github.com/dustin/go-humanize
|
||||||
|
- github.com/facebookgo/stack
|
||||||
|
- github.com/facebookgo/stackerr
|
||||||
|
- github.com/ghodss/yaml
|
||||||
|
- github.com/globalsign/mgo
|
||||||
|
- github.com/gogo/protobuf
|
||||||
|
- github.com/google/cadvisor
|
||||||
|
- github.com/google/pprof
|
||||||
|
- github.com/gophercloud/gophercloud
|
||||||
|
- github.com/gotestyourself/gotestyourself
|
||||||
|
- github.com/hashicorp/consul
|
||||||
|
- github.com/hashicorp/serf
|
||||||
|
- github.com/hashicorp/vault
|
||||||
|
- github.com/heketi/heketi
|
||||||
|
- github.com/heketi/utils
|
||||||
|
- github.com/inconshreveable/mousetrap
|
||||||
|
- github.com/JeffAshton/win_pdh
|
||||||
|
- github.com/jmespath/go-jmespath
|
||||||
|
- github.com/jteeuwen/go-bindata
|
||||||
|
- github.com/juju/errors
|
||||||
|
- github.com/juju/loggo
|
||||||
|
- github.com/juju/testing
|
||||||
|
- github.com/julienschmidt/httprouter
|
||||||
|
- github.com/koneu/natend
|
||||||
|
- github.com/kr/logfmt
|
||||||
|
- github.com/libopenstorage/openstorage
|
||||||
|
- github.com/logrusorgru/aurora
|
||||||
|
- github.com/magiconair/properties
|
||||||
|
- github.com/Masterminds/semver
|
||||||
|
- github.com/Masterminds/sprig
|
||||||
|
- github.com/mesos/mesos-go
|
||||||
|
- github.com/miekg/dns
|
||||||
|
- github.com/munnerz/goautoneg
|
||||||
|
- github.com/Nvveen/Gotty
|
||||||
|
- github.com/NYTimes/gziphandler
|
||||||
|
- github.com/opencontainers/runc
|
||||||
|
- github.com/openshift/origin
|
||||||
|
- github.com/pascaldekloe/goe
|
||||||
|
- github.com/pmezard/go-difflib
|
||||||
|
- github.com/projectcalico/go-yaml
|
||||||
|
- github.com/projectcalico/go-yaml-wrapper
|
||||||
|
- github.com/rcrowley/go-metrics
|
||||||
|
- github.com/russross/blackfriday
|
||||||
|
- github.com/russross/blackfriday/v2
|
||||||
|
- github.com/sean-/seed
|
||||||
|
- github.com/signalfx/com_signalfx_metrics_protobuf
|
||||||
|
- github.com/smartystreets/assertions
|
||||||
|
- github.com/smartystreets/goconvey
|
||||||
|
- github.com/storageos/go-api
|
||||||
|
- github.com/technosophos/moniker
|
||||||
|
- github.com/ulikunitz/xz
|
||||||
|
- github.com/xeipuuv/gojsonpointer
|
||||||
|
- github.com/xeipuuv/gojsonreference
|
||||||
|
- github.com/xi2/xz
|
||||||
|
- github.com/ziutek/mymysql
|
||||||
|
- gopkg.in/check.v1
|
||||||
|
- gopkg.in/mgo.v2
|
||||||
|
- gopkg.in/tomb.v1
|
||||||
|
- gopkg.in/yaml.v1
|
||||||
|
- gopkg.in/yaml.v3
|
||||||
|
- gotest.tools
|
||||||
|
- istio.io/tools
|
||||||
|
- k8s.io/helm
|
||||||
|
- k8s.io/kubernetes
|
||||||
|
- modernc.org/cc
|
||||||
|
- sigs.k8s.io/yaml
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
all
|
||||||
|
rule 'MD002', :level => 1
|
||||||
|
rule 'MD007', :indent => 4
|
||||||
|
rule 'MD013', :line_length => 160, :code_blocks => false, :tables => false
|
||||||
|
rule 'MD026', :punctuation => ".,;:!"
|
||||||
|
exclude_rule 'MD013'
|
||||||
|
exclude_rule 'MD014'
|
||||||
|
exclude_rule 'MD030'
|
||||||
|
exclude_rule 'MD032'
|
||||||
|
exclude_rule 'MD033'
|
||||||
|
exclude_rule 'MD041'
|
||||||
|
exclude_rule 'MD046'
|
||||||
|
|
@ -0,0 +1,98 @@
|
||||||
|
#########################
|
||||||
|
## Config for sass-lint
|
||||||
|
#########################
|
||||||
|
# Linter Options
|
||||||
|
options:
|
||||||
|
# Don't merge default rules
|
||||||
|
merge-default-rules: false
|
||||||
|
# Raise an error if more than 50 warnings are generated
|
||||||
|
max-warnings: 500
|
||||||
|
# Rule Configuration
|
||||||
|
rules:
|
||||||
|
attribute-quotes:
|
||||||
|
- 2
|
||||||
|
-
|
||||||
|
include: false
|
||||||
|
bem-depth: 2
|
||||||
|
border-zero: 2
|
||||||
|
brace-style: 2
|
||||||
|
class-name-format: 2
|
||||||
|
clean-import-paths: 2
|
||||||
|
declarations-before-nesting: 2
|
||||||
|
empty-args: 2
|
||||||
|
empty-line-between-blocks: 2
|
||||||
|
extends-before-declarations: 2
|
||||||
|
extends-before-mixins: 2
|
||||||
|
final-newline: 2
|
||||||
|
force-attribute-nesting: 0
|
||||||
|
force-element-nesting: 0
|
||||||
|
force-pseudo-nesting: 0
|
||||||
|
function-name-format: 2
|
||||||
|
hex-length: 0
|
||||||
|
hex-notation: 2
|
||||||
|
id-name-format: 2
|
||||||
|
indentation:
|
||||||
|
- 2
|
||||||
|
-
|
||||||
|
size: 4
|
||||||
|
leading-zero:
|
||||||
|
- 2
|
||||||
|
-
|
||||||
|
include: false
|
||||||
|
max-file-line-count: 0
|
||||||
|
max-file-length: 0
|
||||||
|
mixins-before-declarations: 2
|
||||||
|
no-attribute-selectors: 0
|
||||||
|
no-color-hex: 0
|
||||||
|
no-color-keywords: 0
|
||||||
|
no-color-literals: 0
|
||||||
|
no-combinators: 0
|
||||||
|
no-css-comments: 2
|
||||||
|
no-debug: 2
|
||||||
|
no-disallowed-properties: 2
|
||||||
|
no-duplicate-properties: 2
|
||||||
|
no-empty-rulesets: 2
|
||||||
|
no-extends: 2
|
||||||
|
no-ids: 0
|
||||||
|
no-invalid-hex: 2
|
||||||
|
no-important: 0
|
||||||
|
no-mergeable-selectors: 2
|
||||||
|
no-misspelled-properties: 2
|
||||||
|
no-qualifying-elements: 0
|
||||||
|
no-trailing-whitespace: 2
|
||||||
|
no-trailing-zero: 2
|
||||||
|
no-transition-all: 0
|
||||||
|
no-url-domains: 2
|
||||||
|
no-url-protocols: 2
|
||||||
|
no-warn: 2
|
||||||
|
one-declaration-per-line: 2
|
||||||
|
placeholder-in-extend: 2
|
||||||
|
placeholder-name-format: 2
|
||||||
|
property-sort-order: 0
|
||||||
|
property-units: 2
|
||||||
|
pseudo-element: 2
|
||||||
|
quotes:
|
||||||
|
- 2
|
||||||
|
-
|
||||||
|
style: double
|
||||||
|
shorthand-values: 2
|
||||||
|
single-line-per-selector: 0
|
||||||
|
space-after-bang: 2
|
||||||
|
space-after-colon: 2
|
||||||
|
space-after-comma: 2
|
||||||
|
space-around-operator: 2
|
||||||
|
space-before-bang: 2
|
||||||
|
space-before-brace: 2
|
||||||
|
space-before-colon: 2
|
||||||
|
space-between-parens: 2
|
||||||
|
trailing-semicolon: 2
|
||||||
|
url-quotes: 2
|
||||||
|
variable-for-property:
|
||||||
|
- 0
|
||||||
|
-
|
||||||
|
properties:
|
||||||
|
- color
|
||||||
|
- background-color
|
||||||
|
- fill
|
||||||
|
variable-name-format: 0
|
||||||
|
zero-unit: 2
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"defaultSeverity": "error",
|
||||||
|
"extends": [
|
||||||
|
"tslint:recommended"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"max-line-length": {
|
||||||
|
"options": [160]
|
||||||
|
},
|
||||||
|
"arrow-parens": false,
|
||||||
|
"new-parens": true,
|
||||||
|
"no-arg": true,
|
||||||
|
"no-bitwise": true,
|
||||||
|
"no-conditional-assignment": true,
|
||||||
|
"no-consecutive-blank-lines": true,
|
||||||
|
"no-console": {
|
||||||
|
"severity": "warning",
|
||||||
|
"options": ["debug", "info", "log", "time", "timeEnd", "trace"]
|
||||||
|
},
|
||||||
|
"no-shadowed-variable": false,
|
||||||
|
"eofline": false
|
||||||
|
},
|
||||||
|
"jsRules": {},
|
||||||
|
"rulesDirectory": []
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright 2019 Istio Authors
|
||||||
|
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
if [[ -n $(git status --porcelain) ]]; then
|
||||||
|
git status
|
||||||
|
echo "ERROR: Some files need to be updated, please run make and include any changed files in your PR"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# WARNING: DO NOT EDIT, THIS FILE IS PROBABLY A COPY
|
||||||
|
#
|
||||||
|
# The original version of this file is located in the https://github.com/istio/common-files repo.
|
||||||
|
# If you're looking at this file in a different repo and want to make a change, please go to the
|
||||||
|
# common-files repo, make the change there and check it in. Then come back to this repo and run
|
||||||
|
# "make update-common".
|
||||||
|
|
||||||
|
# Copyright Istio Authors. All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
# This script builds and version stamps the output
|
||||||
|
|
||||||
|
VERBOSE=${VERBOSE:-"0"}
|
||||||
|
V=""
|
||||||
|
if [[ "${VERBOSE}" == "1" ]];then
|
||||||
|
V="-x"
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
|
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
OUT=${1:?"output path"}
|
||||||
|
shift
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
BUILD_GOOS=${GOOS:-linux}
|
||||||
|
BUILD_GOARCH=${GOARCH:-amd64}
|
||||||
|
GOBINARY=${GOBINARY:-go}
|
||||||
|
GOPKG="$GOPATH/pkg"
|
||||||
|
BUILDINFO=${BUILDINFO:-""}
|
||||||
|
STATIC=${STATIC:-1}
|
||||||
|
LDFLAGS=${LDFLAGS:--extldflags -static}
|
||||||
|
GOBUILDFLAGS=${GOBUILDFLAGS:-""}
|
||||||
|
# Split GOBUILDFLAGS by spaces into an array called GOBUILDFLAGS_ARRAY.
|
||||||
|
IFS=' ' read -r -a GOBUILDFLAGS_ARRAY <<< "$GOBUILDFLAGS"
|
||||||
|
|
||||||
|
GCFLAGS=${GCFLAGS:-}
|
||||||
|
export CGO_ENABLED=0
|
||||||
|
|
||||||
|
if [[ "${STATIC}" != "1" ]];then
|
||||||
|
LDFLAGS=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# gather buildinfo if not already provided
|
||||||
|
# For a release build BUILDINFO should be produced
|
||||||
|
# at the beginning of the build and used throughout
|
||||||
|
if [[ -z ${BUILDINFO} ]];then
|
||||||
|
BUILDINFO=$(mktemp)
|
||||||
|
"${SCRIPTPATH}/report_build_info.sh" > "${BUILDINFO}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# BUILD LD_EXTRAFLAGS
|
||||||
|
LD_EXTRAFLAGS=""
|
||||||
|
|
||||||
|
while read -r line; do
|
||||||
|
LD_EXTRAFLAGS="${LD_EXTRAFLAGS} -X ${line}"
|
||||||
|
done < "${BUILDINFO}"
|
||||||
|
|
||||||
|
# verify go version before build
|
||||||
|
# NB. this was copied verbatim from Kubernetes hack
|
||||||
|
minimum_go_version=go1.13 # supported patterns: go1.x, go1.x.x (x should be a number)
|
||||||
|
IFS=" " read -ra go_version <<< "$(${GOBINARY} version)"
|
||||||
|
if [[ "${minimum_go_version}" != $(echo -e "${minimum_go_version}\n${go_version[2]}" | sort -s -t. -k 1,1 -k 2,2n -k 3,3n | head -n1) && "${go_version[2]}" != "devel" ]]; then
|
||||||
|
echo "Warning: Detected that you are using an older version of the Go compiler. Istio requires ${minimum_go_version} or greater."
|
||||||
|
fi
|
||||||
|
|
||||||
|
OPTIMIZATION_FLAGS="-trimpath"
|
||||||
|
if [ "${DEBUG}" == "1" ]; then
|
||||||
|
OPTIMIZATION_FLAGS=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
time GOOS=${BUILD_GOOS} GOARCH=${BUILD_GOARCH} ${GOBINARY} build \
|
||||||
|
${V} "${GOBUILDFLAGS_ARRAY[@]}" ${GCFLAGS:+-gcflags "${GCFLAGS}"} \
|
||||||
|
-o "${OUT}" \
|
||||||
|
${OPTIMIZATION_FLAGS} \
|
||||||
|
-pkgdir="${GOPKG}/${BUILD_GOOS}_${BUILD_GOARCH}" \
|
||||||
|
-ldflags "${LDFLAGS} ${LD_EXTRAFLAGS}" "${@}"
|
||||||
|
|
@ -5,9 +5,9 @@
|
||||||
# The original version of this file is located in the https://github.com/istio/common-files repo.
|
# The original version of this file is located in the https://github.com/istio/common-files repo.
|
||||||
# If you're looking at this file in a different repo and want to make a change, please go to the
|
# If you're looking at this file in a different repo and want to make a change, please go to the
|
||||||
# common-files repo, make the change there and check it in. Then come back to this repo and run
|
# common-files repo, make the change there and check it in. Then come back to this repo and run
|
||||||
# "make updatecommon".
|
# "make update-common".
|
||||||
|
|
||||||
# Copyright 2019 Istio Authors
|
# Copyright Istio Authors
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|
@ -23,18 +23,17 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
ec=0
|
||||||
ROOTDIR=$(dirname "${SCRIPTPATH}")
|
for fn in "$@"; do
|
||||||
cd "${ROOTDIR}"
|
if ! grep -L -q -e "Apache License, Version 2" "${fn}"; then
|
||||||
|
echo "Missing license: ${fn}"
|
||||||
|
ec=1
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$1" == "--fix" ]]
|
if ! grep -L -q -e "Copyright" "${fn}"; then
|
||||||
then
|
echo "Missing copyright: ${fn}"
|
||||||
FIX="--fix"
|
ec=1
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# if you want to update this version, also change the version number in .golangci.yml
|
exit $ec
|
||||||
GOLANGCI_VERSION="v1.16.0"
|
|
||||||
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b "$GOPATH"/bin "$GOLANGCI_VERSION"
|
|
||||||
golangci-lint --version
|
|
||||||
# For tuning and when switching versions PLEASE REFERENCE: https://github.com/istio/istio/issues/14888
|
|
||||||
env GOGC=25 golangci-lint run ${FIX} -j 8 -v ./...
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
# WARNING: DO NOT EDIT, THIS FILE IS PROBABLY A COPY
|
# WARNING: DO NOT EDIT, THIS FILE IS PROBABLY A COPY
|
||||||
#
|
#
|
||||||
# The original version of this file is located in the https://github.com/istio/common-files repo.
|
# The original version of this file is located in the https://github.com/istio/common-files repo.
|
||||||
# If you're looking at this file in a different repo and want to make a change, please go to the
|
# If you're looking at this file in a different repo and want to make a change, please go to the
|
||||||
# common-files repo, make the change there and check it in. Then come back to this repo and run
|
# common-files repo, make the change there and check it in. Then come back to this repo and run
|
||||||
# "make updatecommon".
|
# "make update-common".
|
||||||
|
|
||||||
# Copyright 2018 Istio Authors
|
# Copyright Istio Authors
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|
@ -19,9 +21,4 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
updatecommon:
|
GOGC=25 golangci-lint run -c ./common/config/.golangci.yml
|
||||||
@git clone https://github.com/istio/common-files
|
|
||||||
@cd common-files
|
|
||||||
@git rev-parse HEAD >.commonfiles.sha
|
|
||||||
@cp -r common-files/files/* common-files/files/.[^.]* .
|
|
||||||
@rm -fr common-files
|
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# WARNING: DO NOT EDIT, THIS FILE IS PROBABLY A COPY
|
||||||
|
#
|
||||||
|
# The original version of this file is located in the https://github.com/istio/common-files repo.
|
||||||
|
# If you're looking at this file in a different repo and want to make a change, please go to the
|
||||||
|
# common-files repo, make the change there and check it in. Then come back to this repo and run
|
||||||
|
# "make update-common".
|
||||||
|
|
||||||
|
# Copyright Istio Authors
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
if BUILD_GIT_REVISION=$(git rev-parse HEAD 2> /dev/null); then
|
||||||
|
if [[ -n "$(git status --porcelain 2>/dev/null)" ]]; then
|
||||||
|
BUILD_GIT_REVISION=${BUILD_GIT_REVISION}"-dirty"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
BUILD_GIT_REVISION=unknown
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check for local changes
|
||||||
|
if git diff-index --quiet HEAD --; then
|
||||||
|
tree_status="Clean"
|
||||||
|
else
|
||||||
|
tree_status="Modified"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# security wanted VERSION='unknown'
|
||||||
|
VERSION="${BUILD_GIT_REVISION}"
|
||||||
|
if [[ -n ${ISTIO_VERSION} ]]; then
|
||||||
|
VERSION="${ISTIO_VERSION}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
GIT_DESCRIBE_TAG=$(git describe --tags)
|
||||||
|
|
||||||
|
# used by common/scripts/gobuild.sh
|
||||||
|
echo "istio.io/pkg/version.buildVersion=${VERSION}"
|
||||||
|
echo "istio.io/pkg/version.buildGitRevision=${BUILD_GIT_REVISION}"
|
||||||
|
echo "istio.io/pkg/version.buildStatus=${tree_status}"
|
||||||
|
echo "istio.io/pkg/version.buildTag=${GIT_DESCRIBE_TAG}"
|
||||||
|
|
@ -1,3 +1,18 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright Istio Authors
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
docker run -e uid="$(id -u)" -e gid="$(id -g)" -v $PWD:/work -w /work -v $(realpath $PWD/../../extensions):/work/extensions wasmsdk:v1 bash /build_wasm.sh
|
docker run -e uid="$(id -u)" -e gid="$(id -g)" -v $PWD:/work -w /work -v $(realpath $PWD/../../extensions):/work/extensions wasmsdk:v1 bash /build_wasm.sh
|
||||||
rmdir extensions
|
rmdir extensions
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,18 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright Istio Authors
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
docker run -e uid="$(id -u)" -e gid="$(id -g)" -v $PWD:/work -w /work -v $(realpath $PWD/../../extensions):/work/extensions wasmsdk:v1 bash /build_wasm.sh
|
docker run -e uid="$(id -u)" -e gid="$(id -g)" -v $PWD:/work -w /work -v $(realpath $PWD/../../extensions):/work/extensions wasmsdk:v1 bash /build_wasm.sh
|
||||||
rmdir extensions
|
rmdir extensions
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,17 @@
|
||||||
|
# Copyright Istio Authors
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
WD=$(dirname $0)
|
WD=$(dirname $0)
|
||||||
WD=$(cd $WD; pwd)
|
WD=$(cd $WD; pwd)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,83 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# WARNING: DO NOT EDIT, THIS FILE IS PROBABLY A COPY
|
|
||||||
#
|
|
||||||
# The original version of this file is located in the https://github.com/istio/common-files repo.
|
|
||||||
# If you're looking at this file in a different repo and want to make a change, please go to the
|
|
||||||
# common-files repo, make the change there and check it in. Then come back to this repo and run
|
|
||||||
# "make updatecommon".
|
|
||||||
|
|
||||||
# Copyright 2018 Istio Authors
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
ROOTDIR=$(dirname "${SCRIPTPATH}")
|
|
||||||
cd "${ROOTDIR}"
|
|
||||||
|
|
||||||
ADD_LICENSE=$1
|
|
||||||
THISYEAR=$(date +"%Y")
|
|
||||||
if [[ $ADD_LICENSE == true ]]; then
|
|
||||||
echo "Check License script is running in ADD_LICENSE mode. It will automatically add any missing licenses for you."
|
|
||||||
fi
|
|
||||||
|
|
||||||
ret=0
|
|
||||||
for fn in $(find "${ROOTDIR}" -type f \( -name '*.go' -o -name '*.cc' -o -name '*.h' -o -name '*.proto' \) | grep -v vendor | grep -v testdata); do
|
|
||||||
if [[ $fn == *.pb.go ]];then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if head -20 "$fn" | grep "auto\\-generated" > /dev/null; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if head -20 "$fn" | grep "DO NOT EDIT" > /dev/null; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if head -20 "$fn" | grep "Code generated by go-bindata" > /dev/null; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! head -20 "$fn" | grep "Apache License, Version 2" > /dev/null; then
|
|
||||||
if [[ $ADD_LICENSE == true ]]; then
|
|
||||||
echo "// Copyright ${THISYEAR} Istio Authors
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the \"License\");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an \"AS IS\" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
$(cat "${fn}")" > "${fn}"
|
|
||||||
else
|
|
||||||
echo "${fn} missing license"
|
|
||||||
ret=$((ret+1))
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! head -20 "$fn" | grep Copyright > /dev/null; then
|
|
||||||
echo "${fn} missing Copyright"
|
|
||||||
ret=$((ret+1))
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
exit $ret
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# WARNING: DO NOT EDIT, THIS FILE IS PROBABLY A COPY
|
|
||||||
#
|
|
||||||
# The original version of this file is located in the https://github.com/istio/common-files repo.
|
|
||||||
# If you're looking at this file in a different repo and want to make a change, please go to the
|
|
||||||
# common-files repo, make the change there and check it in. Then come back to this repo and run
|
|
||||||
# "make updatecommon".
|
|
||||||
|
|
||||||
# Copyright 2018 Istio Authors
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
# Applies requisite code formatters to the source tree
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
ROOTDIR=$(dirname "${SCRIPTPATH}")
|
|
||||||
cd "${ROOTDIR}"
|
|
||||||
|
|
||||||
# Go format tool to use
|
|
||||||
# While 'goimports' is preferred we temporarily use 'gofmt' until https://github.com/golang/go/issues/28200 is resolved
|
|
||||||
GO_FMT_TOOL=goimportsdocker
|
|
||||||
|
|
||||||
PKGS=${PKGS:-"."}
|
|
||||||
if [[ -z ${GO_FILES} ]];then
|
|
||||||
GO_FILES=$(find "${PKGS}" -type f -name '*.go' ! -name '*.gen.go' ! -name '*.pb.go' ! -name '*mock*.go' | grep -v ./vendor)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# need to pin goimports to align with golangci-lint. SHA is from x/tools repo
|
|
||||||
if [ $GO_FMT_TOOL = "goimportsdocker" ]; then
|
|
||||||
GO_IMPORTS_DOCKER="gcr.io/istio-testing/goimports:379209517ffe"
|
|
||||||
tool="docker run -i --rm -v ${ROOTDIR}:${ROOTDIR} -w ${ROOTDIR} ${GO_IMPORTS_DOCKER} /goimports"
|
|
||||||
fmt_args="-w -local istio.io"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $GO_FMT_TOOL = "gofmt" ]; then
|
|
||||||
tool=gofmt
|
|
||||||
fmt_args="-w"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Formatting the source files"
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
$tool ${fmt_args} ${GO_FILES}
|
|
||||||
exit $?
|
|
||||||
Loading…
Reference in New Issue