diff --git a/Makefile b/Makefile index ee7b46f9b7..ee59476d35 100644 --- a/Makefile +++ b/Makefile @@ -36,28 +36,27 @@ else ifeq ($(shell echo $(LOCAL_ARCH) | head -c 5),armv8) else ifeq ($(shell echo $(LOCAL_ARCH) | head -c 4),armv) TARGET_ARCH ?= arm else - $(error "This system's architecture $(LOCAL_ARCH) isn't recognized/supported") + $(error This system's architecture $(LOCAL_ARCH) isn't supported) endif LOCAL_OS := $(shell uname) ifeq ($(LOCAL_OS),Linux) - TARGET_OS ?= linux - READLINK_FLAGS="-f" + TARGET_OS ?= linux + READLINK_FLAGS="-f" else ifeq ($(LOCAL_OS),Darwin) - TARGET_OS ?= darwin - READLINK_FLAGS="" + TARGET_OS ?= darwin + READLINK_FLAGS="" else - $(error "This system's OS $(LOCAL_OS) isn't recognized/supported") + $(error This system's OS $(LOCAL_OS) isn't supported) endif -REPO_ROOT = $(shell git rev-parse --show-toplevel) -REPO_NAME = $(shell basename $(REPO_ROOT)) -TARGET_OUT ?= $(HOME)/istio_out/$(REPO_NAME) +export TARGET_OUT ?= $(shell pwd)/out/$(TARGET_ARCH)_$(TARGET_OS) ifeq ($(BUILD_WITH_CONTAINER),1) +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-09-29T15-31-13 +IMG ?= gcr.io/istio-testing/build-tools:2019-10-09T18-20-54 UID = $(shell id -u) PWD = $(shell pwd) @@ -68,30 +67,31 @@ $(info Building with the build container: $(IMG).) # the path of the file. TIMEZONE=`readlink $(READLINK_FLAGS) /etc/localtime | sed -e 's/^.*zoneinfo\///'` -RUN = $(CONTAINER_CLI) run -t -i --sig-proxy=true -u $(UID) --rm \ +RUN = $(CONTAINER_CLI) run --net=host -t -i --sig-proxy=true -u $(UID):docker --rm \ + -e IN_BUILD_CONTAINER="$(BUILD_WITH_CONTAINER)" \ -e TZ="$(TIMEZONE)" \ -e TARGET_ARCH="$(TARGET_ARCH)" \ -e TARGET_OS="$(TARGET_OS)" \ + -e TARGET_OUT="$(TARGET_OUT)" \ -v /etc/passwd:/etc/passwd:ro \ $(DOCKER_SOCKET_MOUNT) \ $(CONTAINER_OPTIONS) \ --mount type=bind,source="$(PWD)",destination="/work" \ - --mount type=bind,source="$(TARGET_OUT)",destination="/targetout" \ - --mount type=volume,source=home,destination="/home" \ + --mount type=volume,source=go,destination="/go" \ + --mount type=volume,source=gocache,destination="/gocache" \ -w /work $(IMG) else $(info Building with your local toolchain.) RUN = +GOBIN ?= $(GOPATH)/bin endif MAKE = $(RUN) make --no-print-directory -e -f Makefile.core.mk %: - @mkdir -p $(TARGET_OUT) @$(MAKE) $@ default: - @mkdir -p $(TARGET_OUT) @$(MAKE) .PHONY: default diff --git a/common/.commonfiles.sha b/common/.commonfiles.sha index b1ee769ec7..aea30b4ab3 100644 --- a/common/.commonfiles.sha +++ b/common/.commonfiles.sha @@ -1 +1 @@ -1e9fc0310610c4f5a8b6a97510833bc368e00236 +23964a61fe765efb932204b72458f2915e1e17b7 diff --git a/common/Makefile.common.mk b/common/Makefile.common.mk index 9701724c9d..ece83dab3d 100644 --- a/common/Makefile.common.mk +++ b/common/Makefile.common.mk @@ -58,7 +58,7 @@ 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 + @-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 @@ -94,4 +94,7 @@ update-common-protos: @cp -ar common-files/common-protos common-protos @rm -fr common-files -.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: + @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 diff --git a/common/config/license-lint.yml b/common/config/license-lint.yml index 7cd9c00942..fbdf259624 100644 --- a/common/config/license-lint.yml +++ b/common/config/license-lint.yml @@ -58,14 +58,84 @@ restricted_licenses: - 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/magiconair/properties - - github.com/pmezard/go-difflib - - github.com/russross/blackfriday - - gopkg.in/check.v1 - - gopkg.in/tomb.v1 + - 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 diff --git a/common/scripts/check_clean_repo.sh b/common/scripts/check_clean_repo.sh new file mode 100755 index 0000000000..9631b195a1 --- /dev/null +++ b/common/scripts/check_clean_repo.sh @@ -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