Skip to content

Commit

Permalink
Build update (istio#17508)
Browse files Browse the repository at this point in the history
- Update common files & common protos

- Introduce license file linting.

- Introduce the gen-check rule which will be used by a new CI rule to
ensure all generated files are up to date before allowing a PR through.

- Regenerate go sources, given latest gogo.
  • Loading branch information
geeknoid authored Oct 2, 2019
1 parent bbeddd4 commit ea5b2dd
Show file tree
Hide file tree
Showing 63 changed files with 269 additions and 1,091 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ TARGET_OUT ?= $(HOME)/istio_out/$(REPO_NAME)
ifeq ($(BUILD_WITH_CONTAINER),1)
CONTAINER_CLI ?= docker
DOCKER_SOCKET_MOUNT ?= -v /var/run/docker.sock:/var/run/docker.sock
IMG ?= gcr.io/istio-testing/build-tools:2019-09-25T19-39-04
IMG ?= gcr.io/istio-testing/build-tools:2019-10-01T21-32-16
UID = $(shell id -u)
PWD = $(shell pwd)

Expand All @@ -68,7 +68,7 @@ $(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 -t -i --sig-proxy=true -u $(UID):docker --rm \
-e TZ="$(TIMEZONE)" \
-e TARGET_ARCH="$(TARGET_ARCH)" \
-e TARGET_OS="$(TARGET_OS)" \
Expand Down
11 changes: 2 additions & 9 deletions Makefile.core.mk
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ $(foreach bin,$(BINARIES),$(shell basename $(bin))): build

MARKDOWN_LINT_WHITELIST=localhost:8080,storage.googleapis.com/istio-artifacts/pilot/,http://ratings.default.svc.cluster.local:9080/ratings

lint: lint-python lint-copyright-banner lint-scripts lint-dockerfiles lint-markdown lint-yaml gen check-clean
lint: lint-python lint-copyright-banner lint-scripts lint-dockerfiles lint-markdown lint-yaml lint-licenses
@bin/check_helm.sh
@bin/check_samples.sh
@bin/check_dashboards.sh
Expand All @@ -393,14 +393,7 @@ gen:
@go build -o /tmp/bin/mixgen "${REPO_ROOT}/mixer/tools/mixgen/main.go"
@PATH=${PATH}:/tmp/bin go generate ./...

CHANGES=$(shell git status --porcelain)

check-clean:
ifneq ($(CHANGES),)
@git diff
@echo "Please run 'make gen' and include any changed files in your PR"
@exit 1
endif
gen-check: gen check-clean-repo

#-----------------------------------------------------------------------------
# Target: go build
Expand Down
2 changes: 1 addition & 1 deletion common-protos/.commonfiles.sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
495981b2386daebbf27c170f9034193fc88ae8ff
9f111cfd1e041496728a058466f95b5affe8365e
2 changes: 1 addition & 1 deletion common/.commonfiles.sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
db78a1cefc89e0941d93942f3850e0fad0b32b49
9f111cfd1e041496728a058466f95b5affe8365e
19 changes: 17 additions & 2 deletions common/Makefile.common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ lint-typescript:
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-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:
@-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"
Expand All @@ -68,6 +72,14 @@ format-python:
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
Expand All @@ -82,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
check-clean-repo:
@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
140 changes: 140 additions & 0 deletions common/config/license-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
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/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
21 changes: 21 additions & 0 deletions common/scripts/check_clean_repo.sh
Original file line number Diff line number Diff line change
@@ -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
11 changes: 5 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ require (
github.com/armon/go-radix v1.0.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
github.com/aws/aws-sdk-go v1.16.26
github.com/beorn7/perks v1.0.0 // indirect
github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 // indirect
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
github.com/cactus/go-statsd-client v3.1.1+incompatible
Expand Down Expand Up @@ -63,7 +62,6 @@ require (
github.com/fsnotify/fsnotify v1.4.7
github.com/garyburd/redigo v1.6.0 // indirect
github.com/ghodss/yaml v1.0.0
github.com/go-logfmt/logfmt v0.4.0 // indirect
github.com/go-redis/redis v6.10.2+incompatible
github.com/go-sql-driver/mysql v1.4.1 // indirect
github.com/gocql/gocql v0.0.0-20190423091413-b99afaf3b163 // indirect
Expand All @@ -81,7 +79,7 @@ require (
github.com/gophercloud/gophercloud v0.0.0-20190424031112-b9b92a825806 // indirect
github.com/gorilla/mux v1.7.2
github.com/gorilla/websocket v1.4.0
github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20171214222146-0e7658f8ee99
Expand All @@ -98,6 +96,7 @@ require (
github.com/hashicorp/vault v0.10.0
github.com/howeyc/fsnotify v0.9.0
github.com/jefferai/jsonx v1.0.0 // indirect
github.com/json-iterator/go v1.1.7 // indirect
github.com/juju/errors v0.0.0-20190207033735-e65537c515d7 // indirect
github.com/juju/loggo v0.0.0-20190212223446-d976af380377 // indirect
github.com/juju/testing v0.0.0-20190429233213-dfc56b8c09fc // indirect
Expand All @@ -123,10 +122,9 @@ require (
github.com/pkg/errors v0.8.1
github.com/pmezard/go-difflib v1.0.0
github.com/pquerna/cachecontrol v0.0.0-20180306154005-525d0eb5f91d // indirect
github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829
github.com/prometheus/client_golang v0.9.3
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4
github.com/prometheus/common v0.4.0
github.com/prometheus/procfs v0.0.0-20190425082905-87a4384529e0 // indirect
github.com/prometheus/prom2json v1.2.1
github.com/ryanuber/go-glob v0.0.0-20160226084822-572520ed46db // indirect
github.com/satori/go.uuid v1.2.0
Expand All @@ -136,7 +134,7 @@ require (
github.com/signalfx/golib v1.1.6
github.com/spf13/cobra v0.0.5
github.com/spf13/pflag v1.0.3
github.com/spf13/viper v1.3.2
github.com/spf13/viper v1.4.0
github.com/stretchr/testify v1.3.0
github.com/tinylib/msgp v1.0.2 // indirect
github.com/uber/jaeger-client-go v0.0.0-20190228190846-ecf2d03a9e80
Expand Down Expand Up @@ -172,6 +170,7 @@ require (
k8s.io/cli-runtime v0.0.0
k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible
k8s.io/helm v2.14.3+incompatible
k8s.io/klog v0.4.0 // indirect
k8s.io/kubernetes v1.13.1
sigs.k8s.io/yaml v1.1.0
)
Expand Down
Loading

0 comments on commit ea5b2dd

Please sign in to comment.