加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Makefile.core.mk 22.23 KB
一键复制 编辑 原始数据 按行查看 历史
John Howard 提交于 2020-05-01 17:00 . Remove node_agent binary (#23437)
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
## 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.
#-----------------------------------------------------------------------------
# Global Variables
#-----------------------------------------------------------------------------
ISTIO_GO := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
export ISTIO_GO
SHELL := /bin/bash -o pipefail
VERSION ?= 1.7-dev
# Base version of Istio image to use
BASE_VERSION ?= 1.7-dev.0
export GO111MODULE ?= on
export GOPROXY ?= https://proxy.golang.org
export GOSUMDB ?= sum.golang.org
ISTIO_CNI_HUB ?= gcr.io/istio-testing
export ISTIO_CNI_HUB
ISTIO_CNI_TAG ?= latest
export ISTIO_CNI_TAG
# cumulatively track the directories/files to delete after a clean
DIRS_TO_CLEAN:=
FILES_TO_CLEAN:=
# If GOPATH is not set by the env, set it to a sane value
GOPATH ?= $(shell cd ${ISTIO_GO}/../../..; pwd)
export GOPATH
# If GOPATH is made up of several paths, use the first one for our targets in this Makefile
GO_TOP := $(shell echo ${GOPATH} | cut -d ':' -f1)
export GO_TOP
GO ?= go
GOARCH_LOCAL := $(TARGET_ARCH)
GOOS_LOCAL := $(TARGET_OS)
export ENABLE_COREDUMP ?= false
# NOTE: env var EXTRA_HELM_SETTINGS can contain helm chart override settings, example:
# EXTRA_HELM_SETTINGS="--set istio-cni.excludeNamespaces={} --set-string istio-cni.tag=v0.1-dev-foo"
#-----------------------------------------------------------------------------
# Output control
#-----------------------------------------------------------------------------
# Invoke make VERBOSE=1 to enable echoing of the command being executed
export VERBOSE ?= 0
# Place the variable Q in front of a command to control echoing of the command being executed.
Q = $(if $(filter 1,$VERBOSE),,@)
# Use the variable H to add a header (equivalent to =>) to informational output
H = $(shell printf "\033[34;1m=>\033[0m")
ifeq ($(origin DEBUG), undefined)
BUILDTYPE_DIR:=release
else ifeq ($(DEBUG),0)
BUILDTYPE_DIR:=release
else
BUILDTYPE_DIR:=debug
export GCFLAGS:=all=-N -l
$(info $(H) Build with debugger information)
endif
# Optional file including user-specific settings (HUB, TAG, etc)
-include .istiorc.mk
# Environment for tests, the directory containing istio and deps binaries.
# Typically same as GOPATH/bin, so tests work seemlessly with IDEs.
export ISTIO_BIN=$(GOBIN)
# Using same package structure as pkg/
export ISTIO_OUT:=$(TARGET_OUT)
export ISTIO_OUT_LINUX:=$(TARGET_OUT_LINUX)
# LOCAL_OUT should point to architecture where we are currently running versus the desired.
# This is used when we need to run a build artifact during tests or later as part of another
# target. If we are running in the Linux build container on non Linux hosts, we add the
# linux binaries to the build dependencies, BUILD_DEPS, which can be added to other targets
# that would need the Linux binaries (ex. tests).
BUILD_DEPS:=
ifeq ($(IN_BUILD_CONTAINER),1)
export LOCAL_OUT := $(ISTIO_OUT_LINUX)
ifneq ($(GOOS_LOCAL),"linux")
BUILD_DEPS += build-linux
endif
else
export LOCAL_OUT := $(ISTIO_OUT)
endif
export HELM=helm
export ARTIFACTS ?= $(ISTIO_OUT)
export JUNIT_OUT ?= $(ARTIFACTS)/junit.xml
export REPO_ROOT := $(shell git rev-parse --show-toplevel)
# Make directories needed by the build system
$(shell mkdir -p $(ISTIO_OUT_LINUX))
$(shell mkdir -p $(ISTIO_OUT_LINUX)/logs)
$(shell mkdir -p $(dir $(JUNIT_OUT)))
# Need seperate target for init:
$(ISTIO_OUT):
@mkdir -p $@
# scratch dir: this shouldn't be simply 'docker' since that's used for docker.save to store tar.gz files
ISTIO_DOCKER:=${ISTIO_OUT_LINUX}/docker_temp
# scratch dir for building isolated images. Please don't remove it again - using
# ISTIO_DOCKER results in slowdown, all files (including multiple copies of envoy) will be
# copied to the docker temp container - even if you add only a tiny file, >1G of data will
# be copied, for each docker image.
DOCKER_BUILD_TOP:=${ISTIO_OUT_LINUX}/docker_build
DOCKERX_BUILD_TOP:=${ISTIO_OUT_LINUX}/dockerx_build
# dir where tar.gz files from docker.save are stored
ISTIO_DOCKER_TAR:=${ISTIO_OUT_LINUX}/release/docker
# Populate the git version for istio/proxy (i.e. Envoy)
ifeq ($(PROXY_REPO_SHA),)
export PROXY_REPO_SHA:=$(shell grep PROXY_REPO_SHA istio.deps -A 4 | grep lastStableSHA | cut -f 4 -d '"')
endif
# Envoy binary variables Keep the default URLs up-to-date with the latest push from istio/proxy.
export ISTIO_ENVOY_BASE_URL ?= https://storage.googleapis.com/istio-build/proxy
# OS-neutral vars. These currently only work for linux.
export ISTIO_ENVOY_VERSION ?= ${PROXY_REPO_SHA}
export ISTIO_ENVOY_DEBUG_URL ?= $(ISTIO_ENVOY_BASE_URL)/envoy-debug-$(ISTIO_ENVOY_VERSION).tar.gz
export ISTIO_ENVOY_RELEASE_URL ?= $(ISTIO_ENVOY_BASE_URL)/envoy-alpha-$(ISTIO_ENVOY_VERSION).tar.gz
# Envoy Linux vars.
export ISTIO_ENVOY_LINUX_VERSION ?= ${ISTIO_ENVOY_VERSION}
export ISTIO_ENVOY_LINUX_DEBUG_URL ?= ${ISTIO_ENVOY_DEBUG_URL}
export ISTIO_ENVOY_LINUX_RELEASE_URL ?= ${ISTIO_ENVOY_RELEASE_URL}
# Variables for the extracted debug/release Envoy artifacts.
export ISTIO_ENVOY_LINUX_DEBUG_DIR ?= ${TARGET_OUT_LINUX}/debug
export ISTIO_ENVOY_LINUX_DEBUG_NAME ?= envoy-debug-${ISTIO_ENVOY_LINUX_VERSION}
export ISTIO_ENVOY_LINUX_DEBUG_PATH ?= ${ISTIO_ENVOY_LINUX_DEBUG_DIR}/${ISTIO_ENVOY_LINUX_DEBUG_NAME}
export ISTIO_ENVOY_LINUX_RELEASE_DIR ?= ${TARGET_OUT_LINUX}/release
export ISTIO_ENVOY_LINUX_RELEASE_NAME ?= envoy-${ISTIO_ENVOY_VERSION}
export ISTIO_ENVOY_LINUX_RELEASE_PATH ?= ${ISTIO_ENVOY_LINUX_RELEASE_DIR}/${ISTIO_ENVOY_LINUX_RELEASE_NAME}
# Envoy macOS vars.
# TODO Change url when official envoy release for macOS is available
export ISTIO_ENVOY_MACOS_VERSION ?= 1.0.2
export ISTIO_ENVOY_MACOS_RELEASE_URL ?= https://github.com/istio/proxy/releases/download/${ISTIO_ENVOY_MACOS_VERSION}/istio-proxy-${ISTIO_ENVOY_MACOS_VERSION}-macos.tar.gz
# Variables for the extracted debug/release Envoy artifacts.
export ISTIO_ENVOY_MACOS_RELEASE_DIR ?= ${TARGET_OUT}/release
export ISTIO_ENVOY_MACOS_RELEASE_NAME ?= envoy-${ISTIO_ENVOY_MACOS_VERSION}
export ISTIO_ENVOY_MACOS_RELEASE_PATH ?= ${ISTIO_ENVOY_MACOS_RELEASE_DIR}/${ISTIO_ENVOY_MACOS_RELEASE_NAME}
# Allow user-override for a local Envoy build.
export USE_LOCAL_PROXY ?= 0
ifeq ($(USE_LOCAL_PROXY),1)
export ISTIO_ENVOY_LOCAL ?= $(realpath ${ISTIO_GO}/../proxy/bazel-bin/src/envoy/envoy)
# Point the native paths to the local envoy build.
ifeq ($(GOOS_LOCAL), Darwin)
export ISTIO_ENVOY_MACOS_RELEASE_DIR = $(dir ${ISTIO_ENVOY_LOCAL})
export ISTIO_ENVOY_MACOS_RELEASE_PATH = ${ISTIO_ENVOY_LOCAL}
else
export ISTIO_ENVOY_LINUX_DEBUG_DIR = $(dir ${ISTIO_ENVOY_LOCAL})
export ISTIO_ENVOY_LINUX_RELEASE_DIR = $(dir ${ISTIO_ENVOY_LOCAL})
export ISTIO_ENVOY_LINUX_DEBUG_PATH = ${ISTIO_ENVOY_LOCAL}
export ISTIO_ENVOY_LINUX_RELEASE_PATH = ${ISTIO_ENVOY_LOCAL}
endif
endif
# Allow user-override envoy bootstrap config path.
export ISTIO_ENVOY_BOOTSTRAP_CONFIG_PATH ?= ${ISTIO_GO}/tools/packaging/common/envoy_bootstrap_v2.json
export ISTIO_ENVOY_BOOTSTRAP_CONFIG_DIR = $(dir ${ISTIO_ENVOY_BOOTSTRAP_CONFIG_PATH})
GO_VERSION_REQUIRED:=1.10
HUB?=istio
ifeq ($(HUB),)
$(error "HUB cannot be empty")
endif
# If tag not explicitly set in users' .istiorc.mk or command line, default to the git sha.
TAG ?= $(shell git rev-parse --verify HEAD)
ifeq ($(TAG),)
$(error "TAG cannot be empty")
endif
VARIANT :=
ifeq ($(VARIANT),)
TAG_VARIANT:=${TAG}
else
TAG_VARIANT:=${TAG}-${VARIANT}
endif
PULL_POLICY ?= IfNotPresent
ifeq ($(TAG),latest)
PULL_POLICY = Always
endif
ifeq ($(PULL_POLICY),)
$(error "PULL_POLICY cannot be empty")
endif
include operator/operator.mk
.PHONY: default
default: init build test
.PHONY: init
# Downloads envoy, based on the SHA defined in the base pilot Dockerfile
init: $(ISTIO_OUT)/istio_is_init
mkdir -p ${TARGET_OUT}/logs
mkdir -p ${TARGET_OUT}/release
# I tried to make this dependent on what I thought was the appropriate
# lock file, but it caused the rule for that file to get run (which
# seems to be about obtaining a new version of the 3rd party libraries).
$(ISTIO_OUT)/istio_is_init: bin/init.sh istio.deps | $(ISTIO_OUT)
ISTIO_OUT=$(ISTIO_OUT) ISTIO_BIN=$(ISTIO_BIN) GOOS_LOCAL=$(GOOS_LOCAL) bin/init.sh
touch $(ISTIO_OUT)/istio_is_init
# init.sh downloads envoy and webassembly plugins
${ISTIO_OUT}/envoy: init
${ISTIO_ENVOY_LINUX_DEBUG_PATH}: init
${ISTIO_ENVOY_LINUX_RELEASE_PATH}: init
${ISTIO_ENVOY_MACOS_RELEASE_PATH}: init
# Pull dependencies, based on the checked in Gopkg.lock file.
# Developers must manually run `dep ensure` if adding new deps
depend: init | $(ISTIO_OUT)
DIRS_TO_CLEAN := $(ISTIO_OUT)
DIRS_TO_CLEAN += $(ISTIO_OUT_LINUX)
$(OUTPUT_DIRS):
@mkdir -p $@
.PHONY: ${GEN_CERT}
GEN_CERT := ${ISTIO_BIN}/generate_cert
${GEN_CERT}:
GOOS=$(GOOS_LOCAL) && GOARCH=$(GOARCH_LOCAL) && CGO_ENABLED=1 common/scripts/gobuild.sh $@ ./security/tools/generate_cert
#-----------------------------------------------------------------------------
# Target: precommit
#-----------------------------------------------------------------------------
.PHONY: precommit format format.gofmt format.goimports lint buildcache
# Target run by the pre-commit script, to automate formatting and lint
# If pre-commit script is not used, please run this manually.
precommit: format lint
format: fmt
fmt: format-go format-python tidy-go
# Build with -i to store the build caches into $GOPATH/pkg
buildcache:
GOBUILDFLAGS=-i $(MAKE) -e -f Makefile.core.mk build
# List of all binaries to build
BINARIES:=./istioctl/cmd/istioctl \
./pilot/cmd/pilot-discovery \
./pilot/cmd/pilot-agent \
./mixer/cmd/mixs \
./mixer/cmd/mixc \
./mixer/tools/mixgen \
./security/tools/sdsclient \
./pkg/test/echo/cmd/client \
./pkg/test/echo/cmd/server \
./mixer/test/policybackend \
./operator/cmd/operator
# List of binaries included in releases
RELEASE_BINARIES:=pilot-discovery pilot-agent mixc mixs mixgen istioctl sdsclient
.PHONY: build
build: depend
STATIC=0 GOOS=$(GOOS_LOCAL) GOARCH=$(GOARCH_LOCAL) LDFLAGS='-extldflags -static -s -w' common/scripts/gobuild.sh $(ISTIO_OUT)/ $(BINARIES)
# The build-linux target is responsible for building binaries used within containers.
# This target should be expanded upon as we add more Linux architectures: i.e. buld-arm64.
# Then a new build target can be created such as build-container-bin that builds these
# various platform images.
.PHONY: build-linux
build-linux: depend
STATIC=0 GOOS=linux GOARCH=amd64 LDFLAGS='-extldflags -static -s -w' common/scripts/gobuild.sh $(ISTIO_OUT_LINUX)/ $(BINARIES)
# Create targets for ISTIO_OUT_LINUX/binary
# There are two use cases here:
# * Building all docker images (generally in CI). In this case we want to build everything at once, so they share work
# * Building a single docker image (generally during dev). In this case we just want to build the single binary alone
BUILD_ALL ?= true
define build-linux
.PHONY: $(ISTIO_OUT_LINUX)/$(shell basename $(1))
ifeq ($(BUILD_ALL),true)
$(ISTIO_OUT_LINUX)/$(shell basename $(1)): build-linux
else
$(ISTIO_OUT_LINUX)/$(shell basename $(1)): $(ISTIO_OUT_LINUX)
STATIC=0 GOOS=linux GOARCH=amd64 LDFLAGS='-extldflags -static -s -w' common/scripts/gobuild.sh $(ISTIO_OUT_LINUX)/ $(1)
endif
endef
$(foreach bin,$(BINARIES),$(eval $(call build-linux,$(bin))))
# Create helper targets for each binary, like "pilot-discovery"
# As an optimization, these still build everything
$(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
# To save on memory, run for each folder
lint-go-split:
@golangci-lint run -c ./common/config/.golangci.yml ./galley/...
@golangci-lint run -c ./common/config/.golangci.yml ./istioctl/...
@golangci-lint run -c ./common/config/.golangci.yml ./mixer/...
@golangci-lint run -c ./common/config/.golangci.yml ./pilot/...
@golangci-lint run -c ./common/config/.golangci.yml ./pkg/...
@golangci-lint run -c ./common/config/.golangci.yml ./samples/...
@golangci-lint run -c ./common/config/.golangci.yml ./security/...
@golangci-lint run -c ./common/config/.golangci.yml ./tests/...
@golangci-lint run -c ./common/config/.golangci.yml ./tools/...
@golangci-lint run -c ./common/config/.golangci.yml ./operator/...
lint-helm-global:
find manifests -name 'Chart.yaml' -print0 | ${XARGS} -L 1 dirname | xargs -r helm lint --strict -f manifests/charts/global.yaml
lint: lint-python lint-copyright-banner lint-scripts lint-go lint-dockerfiles lint-markdown lint-yaml lint-licenses lint-helm-global
@bin/check_samples.sh
@go run mixer/tools/adapterlinter/main.go ./mixer/adapter/...
@testlinter
@envvarlinter galley istioctl mixer pilot security
go-gen:
@mkdir -p /tmp/bin
@go build -o /tmp/bin/mixgen "${REPO_ROOT}/mixer/tools/mixgen/main.go"
@PATH="${PATH}":/tmp/bin go generate ./...
gen-charts:
@operator/scripts/create_assets_gen.sh
refresh-goldens:
@REFRESH_GOLDEN=true go test ${GOBUILDFLAGS} ./operator/...
@REFRESH_GOLDEN=true go test ${GOBUILDFLAGS} ./pkg/kube/inject/...
@REFRESH_GOLDEN=true go test ${GOBUILDFLAGS} ./pilot/pkg/security/authz/builder/...
update-golden: refresh-goldens
gen: go-gen mirror-licenses format update-crds operator-proto gen-kustomize update-golden
check-no-modify:
@bin/check_no_modify.sh
gen-check: check-no-modify gen check-clean-repo
# Generate kustomize templates.
gen-kustomize:
helm3 template istio --include-crds manifests/charts/base > manifests/charts/base/files/gen-istio-cluster.yaml
helm3 template istio --namespace istio-system manifests/charts/istio-control/istio-discovery \
-f manifests/charts/global.yaml > manifests/charts/istio-control/istio-discovery/files/gen-istio.yaml
#-----------------------------------------------------------------------------
# Target: go build
#-----------------------------------------------------------------------------
# gobuild script uses custom linker flag to set the variables.
# Params: OUT VERSION_PKG SRC
RELEASE_LDFLAGS='-extldflags -static -s -w'
DEBUG_LDFLAGS='-extldflags "-static"'
# Non-static istioctl targets. These are typically a build artifact.
${ISTIO_OUT}/release/istioctl-linux-amd64: depend
STATIC=0 GOOS=linux GOARCH=amd64 LDFLAGS=$(RELEASE_LDFLAGS) common/scripts/gobuild.sh $@ ./istioctl/cmd/istioctl
${ISTIO_OUT}/release/istioctl-linux-armv7: depend
STATIC=0 GOOS=linux GOARCH=arm GOARM=7 LDFLAGS=$(RELEASE_LDFLAGS) common/scripts/gobuild.sh $@ ./istioctl/cmd/istioctl
${ISTIO_OUT}/release/istioctl-linux-arm64: depend
STATIC=0 GOOS=linux GOARCH=arm64 LDFLAGS=$(RELEASE_LDFLAGS) common/scripts/gobuild.sh $@ ./istioctl/cmd/istioctl
${ISTIO_OUT}/release/istioctl-osx: depend
STATIC=0 GOOS=darwin LDFLAGS=$(RELEASE_LDFLAGS) common/scripts/gobuild.sh $@ ./istioctl/cmd/istioctl
${ISTIO_OUT}/release/istioctl-win.exe: depend
STATIC=0 GOOS=windows LDFLAGS=$(RELEASE_LDFLAGS) common/scripts/gobuild.sh $@ ./istioctl/cmd/istioctl
# generate the istioctl completion files
${ISTIO_OUT}/release/istioctl.bash: istioctl
${LOCAL_OUT}/istioctl collateral --bash && \
mv istioctl.bash ${ISTIO_OUT}/release/istioctl.bash
${ISTIO_OUT}/release/_istioctl: istioctl
${LOCAL_OUT}/istioctl collateral --zsh && \
mv _istioctl ${ISTIO_OUT}/release/_istioctl
.PHONY: binaries-test
binaries-test:
go test ${GOBUILDFLAGS} ./tests/binary/... -v --base-dir ${ISTIO_OUT} --binaries="$(RELEASE_BINARIES)"
# istioctl-all makes all of the non-static istioctl executables for each supported OS
.PHONY: istioctl-all
istioctl-all: ${ISTIO_OUT}/release/istioctl-linux-amd64 ${ISTIO_OUT}/release/istioctl-linux-armv7 ${ISTIO_OUT}/release/istioctl-linux-arm64 \
${ISTIO_OUT}/release/istioctl-osx \
${ISTIO_OUT}/release/istioctl-win.exe
.PHONY: istioctl.completion
istioctl.completion: ${ISTIO_OUT}/release/istioctl.bash ${ISTIO_OUT}/release/_istioctl
# istioctl-install builds then installs istioctl into $GOPATH/BIN
# Used for debugging istioctl during dev work
.PHONY: istioctl-install-container
istioctl-install-container: istioctl
#-----------------------------------------------------------------------------
# Target: test
#-----------------------------------------------------------------------------
.PHONY: test
JUNIT_REPORT := $(shell which go-junit-report 2> /dev/null || echo "${ISTIO_BIN}/go-junit-report")
${ISTIO_BIN}/go-junit-report:
@echo "go-junit-report not found. Installing it now..."
unset GOOS && unset GOARCH && CGO_ENABLED=1 go get -u github.com/jstemmer/go-junit-report
with_junit_report: | $(JUNIT_REPORT)
$(MAKE) -e $(TARGET) 2>&1 | tee >($(JUNIT_REPORT) > $(JUNIT_OUT))
# Run coverage tests
ifeq ($(WHAT),)
TEST_OBJ = common-test pilot-test mixer-test security-test galley-test istioctl-test operator-test
else
TEST_OBJ = selected-pkg-test
endif
test: | $(JUNIT_REPORT)
KUBECONFIG="$${KUBECONFIG:-$${REPO_ROOT}/tests/util/kubeconfig}" \
$(MAKE) -e -f Makefile.core.mk --keep-going $(TEST_OBJ) \
2>&1 | tee >($(JUNIT_REPORT) > $(JUNIT_OUT))
# TODO: remove the racetest targets and just have *-test targets that call race
.PHONY: pilot-test
pilot-test: pilot-racetest
.PHONY: istioctl-test
istioctl-test: istioctl-racetest
.PHONY: operator-test
operator-test:
go test ${GOBUILDFLAGS} ${T} ./operator/...
.PHONY: mixer-test
mixer-test: mixer-racetest
.PHONY: galley-test
galley-test: galley-racetest
.PHONY: security-test
security-test: security-racetest
.PHONY: common-test
common-test: common-racetest
.PHONY: selected-pkg-test
selected-pkg-test:
find ${WHAT} -name "*_test.go" | xargs -I {} dirname {} | uniq | xargs -I {} go test ${GOBUILDFLAGS} ${T} -race ./{}
#-----------------------------------------------------------------------------
# Target: coverage
#-----------------------------------------------------------------------------
.PHONY: coverage
# Run coverage tests
coverage: pilot-coverage mixer-coverage security-coverage galley-coverage common-coverage istioctl-coverage
coverage-diff:
./bin/codecov_diff.sh
.PHONY: pilot-coverage
pilot-coverage:
bin/codecov.sh pilot
.PHONY: istioctl-coverage
istioctl-coverage:
bin/codecov.sh istioctl
.PHONY: mixer-coverage
mixer-coverage:
bin/codecov.sh mixer
.PHONY: galley-coverage
galley-coverage:
bin/codecov.sh galley
.PHONY: security-coverage
security-coverage:
bin/codecov.sh security/pkg
bin/codecov.sh security/cmd
.PHONY: common-coverage
common-coverage:
bin/codecov.sh pkg
#-----------------------------------------------------------------------------
# Target: go test -race
#-----------------------------------------------------------------------------
.PHONY: racetest
RACE_TESTS ?= pilot-racetest mixer-racetest security-racetest galley-test common-racetest istioctl-racetest operator-racetest
racetest: $(JUNIT_REPORT)
$(MAKE) -e -f Makefile.core.mk --keep-going $(RACE_TESTS) \
2>&1 | tee >($(JUNIT_REPORT) > $(JUNIT_OUT))
.PHONY: pilot-racetest
pilot-racetest:
go test ${GOBUILDFLAGS} ${T} -race ./pilot/...
.PHONY: istioctl-racetest
istioctl-racetest:
go test ${GOBUILDFLAGS} ${T} -race ./istioctl/...
.PHONY: operator-racetest
operator-racetest:
RACE_TEST=true go test ${GOBUILDFLAGS} ${T} -race ./operator/...
.PHONY: mixer-racetest
mixer-racetest:
go test ${GOBUILDFLAGS} ${T} -race ./mixer/...
.PHONY: galley-racetest
galley-racetest:
go test ${GOBUILDFLAGS} ${T} -race ./galley/...
.PHONY: security-racetest
security-racetest:
go test ${GOBUILDFLAGS} ${T} -race ./security/pkg/... ./security/cmd/...
.PHONY: common-racetest
common-racetest: ${BUILD_DEPS}
go test ${GOBUILDFLAGS} ${T} -race ./pkg/... ./tests/common/... ./tools/istio-iptables/...
#-----------------------------------------------------------------------------
# Target: clean
#-----------------------------------------------------------------------------
.PHONY: clean
clean:
rm -rf $(DIRS_TO_CLEAN)
rm -f $(FILES_TO_CLEAN)
#-----------------------------------------------------------------------------
# Target: docker
#-----------------------------------------------------------------------------
.PHONY: push artifacts
# for now docker is limited to Linux compiles - why ?
include tools/istio-docker.mk
push: docker.push
FILES_TO_CLEAN+=install/consul/istio.yaml \
install/kubernetes/istio-auth.yaml \
install/kubernetes/istio-citadel-plugin-certs.yaml \
install/kubernetes/istio-citadel-with-health-check.yaml \
install/kubernetes/istio-one-namespace-auth.yaml \
install/kubernetes/istio-one-namespace-trust-domain.yaml \
install/kubernetes/istio-one-namespace.yaml \
install/kubernetes/istio.yaml \
samples/bookinfo/platform/consul/bookinfo.sidecars.yaml
#-----------------------------------------------------------------------------
# Target: environment and tools
#-----------------------------------------------------------------------------
.PHONY: show.env show.goenv
show.env: ; $(info $(H) environment variables...)
$(Q) printenv
show.goenv: ; $(info $(H) go environment...)
$(Q) $(GO) version
$(Q) $(GO) env
# tickle
# show makefile variables. Usage: make show.<variable-name>
show.%: ; $(info $* $(H) $($*))
$(Q) true
#-----------------------------------------------------------------------------
# Target: custom resource definitions
#-----------------------------------------------------------------------------
update-crds:
bin/update_crds.sh
#-----------------------------------------------------------------------------
# Target: artifacts and distribution
#-----------------------------------------------------------------------------
# deb, rpm, etc packages
include tools/packaging/packaging.mk
#-----------------------------------------------------------------------------
# Target: e2e tests
#-----------------------------------------------------------------------------
include tests/istio.mk
#-----------------------------------------------------------------------------
# Target: integration tests
#-----------------------------------------------------------------------------
include tests/integration/tests.mk
include common/Makefile.common.mk
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化