istio

Форк
0
/
Makefile.core.mk 
528 строк · 22.1 Кб
1
## Copyright Istio Authors
2
##
3
## Licensed under the Apache License, Version 2.0 (the "License");
4
## you may not use this file except in compliance with the License.
5
## You may obtain a copy of the License at
6
##
7
##     http://www.apache.org/licenses/LICENSE-2.0
8
##
9
## Unless required by applicable law or agreed to in writing, software
10
## distributed under the License is distributed on an "AS IS" BASIS,
11
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
## See the License for the specific language governing permissions and
13
## limitations under the License.
14

15
# Our build tools, post jammy, breaks old versions of docker.
16
# These old versions are surprisingly common, so build in a check here
17
define warning
18
Docker version is too old, please upgrade to a newer version.
19
endef
20
ifneq ($(findstring google,$(HOSTNAME)),)
21
warning+=Googlers: go/installdocker\#the-version-of-docker-thats-installed-is-old-eg-1126
22
endif
23
# The old docker issue manifests as not being able to run *any* binary. So we can test
24
# by trying to run a trivial program and ensuring it actually ran. If not, emit our warning.
25
# Note: we cannot do anything like $(shell docker version) to check, since that would also fail.
26
CAN_RUN := $(shell echo "can I run echo")
27
ifeq ($(CAN_RUN),)
28
$(error $(warning))
29
endif
30

31
#-----------------------------------------------------------------------------
32
# Global Variables
33
#-----------------------------------------------------------------------------
34
ISTIO_GO := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
35
export ISTIO_GO
36
SHELL := /bin/bash -o pipefail
37

38
# Version can be defined:
39
# (1) in a $VERSION shell variable, which takes precedence; or
40
# (2) in the VERSION file, in which we will append "-dev" to it
41
ifeq ($(VERSION),)
42
VERSION_FROM_FILE := $(shell cat VERSION)
43
ifeq ($(VERSION_FROM_FILE),)
44
$(error VERSION not detected. Make sure it's stored in the VERSION file or defined in VERSION variable)
45
endif
46
VERSION := $(VERSION_FROM_FILE)-dev
47
endif
48

49
export VERSION
50

51
# Base version of Istio image to use
52
BASE_VERSION ?= master-2024-03-28T19-01-22
53
ISTIO_BASE_REGISTRY ?= gcr.io/istio-release
54

55
export GO111MODULE ?= on
56
export GOPROXY ?= https://proxy.golang.org
57
export GOSUMDB ?= sum.golang.org
58

59
# If GOPATH is not set by the env, set it to a sane value
60
GOPATH ?= $(shell cd ${ISTIO_GO}/../../..; pwd)
61
export GOPATH
62

63
# If GOPATH is made up of several paths, use the first one for our targets in this Makefile
64
GO_TOP := $(shell echo ${GOPATH} | cut -d ':' -f1)
65
export GO_TOP
66

67
GO ?= go
68

69
GOARCH_LOCAL := $(TARGET_ARCH)
70
GOOS_LOCAL := $(TARGET_OS)
71

72
#-----------------------------------------------------------------------------
73
# Output control
74
#-----------------------------------------------------------------------------
75
# Invoke make VERBOSE=1 to enable echoing of the command being executed
76
export VERBOSE ?= 0
77
# Place the variable Q in front of a command to control echoing of the command being executed.
78
Q = $(if $(filter 1,$VERBOSE),,@)
79
# Use the variable H to add a header (equivalent to =>) to informational output
80
H = $(shell printf "\033[34;1m=>\033[0m")
81

82
ifeq ($(origin DEBUG), undefined)
83
  BUILDTYPE_DIR:=release
84
else ifeq ($(DEBUG),0)
85
  BUILDTYPE_DIR:=release
86
else
87
  BUILDTYPE_DIR:=debug
88
  export GCFLAGS:=all=-N -l
89
  $(info $(H) Build with debugger information)
90
endif
91

92
# Optional file including user-specific settings (HUB, TAG, etc)
93
-include .istiorc.mk
94

95
# Environment for tests, the directory containing istio and deps binaries.
96
# Typically same as GOPATH/bin, so tests work seamlessly with IDEs.
97

98
export ISTIO_BIN=$(GOBIN)
99

100
# If we are running in the Linux build container on non Linux hosts, we add the
101
# linux binaries to the build dependencies, BUILD_DEPS, which can be added to other targets
102
# that would need the Linux binaries (ex. tests).
103
BUILD_DEPS:=
104
ifeq ($(IN_BUILD_CONTAINER),1)
105
  ifneq ($(GOOS_LOCAL),"linux")
106
    BUILD_DEPS += build-linux
107
  endif
108
endif
109

110
export ARTIFACTS ?= $(TARGET_OUT)
111
export JUNIT_OUT ?= $(ARTIFACTS)/junit.xml
112
export REPO_ROOT := $(shell git rev-parse --show-toplevel)
113

114
# Make directories needed by the build system
115
$(shell mkdir -p $(TARGET_OUT_LINUX))
116
$(shell mkdir -p $(TARGET_OUT_LINUX)/logs)
117
$(shell mkdir -p $(dir $(JUNIT_OUT)))
118

119
# Need separate target for init:
120
$(TARGET_OUT):
121
	@mkdir -p $@
122

123
# If the hub is not explicitly set, use default to istio.
124
HUB ?=istio
125
ifeq ($(HUB),)
126
  $(error "HUB cannot be empty")
127
endif
128

129
# For dockerx builds, allow HUBS which is a space separated list of hubs. Default to HUB.
130
HUBS ?= $(HUB)
131

132
# If tag not explicitly set in users' .istiorc.mk or command line, default to the git sha.
133
TAG ?= $(shell git rev-parse --verify HEAD)
134
ifeq ($(TAG),)
135
  $(error "TAG cannot be empty")
136
endif
137

138
VARIANT :=
139
ifeq ($(VARIANT),)
140
  TAG_VARIANT:=${TAG}
141
else
142
  TAG_VARIANT:=${TAG}-${VARIANT}
143
endif
144

145
PULL_POLICY ?= IfNotPresent
146
ifeq ($(TAG),latest)
147
  PULL_POLICY = Always
148
endif
149
ifeq ($(PULL_POLICY),)
150
  $(error "PULL_POLICY cannot be empty")
151
endif
152

153
PROW_ARTIFACTS_BASE ?= https://gcsweb.istio.io/gcs/istio-prow
154

155
include tools/proto/proto.mk
156

157
.PHONY: default
158
default: init build test
159

160
.PHONY: init
161
# Downloads envoy, based on the SHA defined in the base pilot Dockerfile
162
init: $(TARGET_OUT)/istio_is_init init-ztunnel-rs
163
	@mkdir -p ${TARGET_OUT}/logs
164
	@mkdir -p ${TARGET_OUT}/release
165

166
# I tried to make this dependent on what I thought was the appropriate
167
# lock file, but it caused the rule for that file to get run (which
168
# seems to be about obtaining a new version of the 3rd party libraries).
169
$(TARGET_OUT)/istio_is_init: bin/init.sh istio.deps | $(TARGET_OUT)
170
	@# Add a retry, as occasionally we see transient connection failures to GCS
171
	@# Like `curl: (56) OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 104`
172
	TARGET_OUT=$(TARGET_OUT) ISTIO_BIN=$(ISTIO_BIN) GOOS_LOCAL=$(GOOS_LOCAL) bin/retry.sh SSL_ERROR_SYSCALL bin/init.sh
173
	touch $(TARGET_OUT)/istio_is_init
174

175
.PHONY: init-ztunnel-rs
176
init-ztunnel-rs:
177
	TARGET_OUT=$(TARGET_OUT) bin/build_ztunnel.sh
178

179
# Pull dependencies such as envoy
180
depend: init | $(TARGET_OUT)
181

182
DIRS_TO_CLEAN := $(TARGET_OUT)
183
DIRS_TO_CLEAN += $(TARGET_OUT_LINUX)
184

185
$(OUTPUT_DIRS):
186
	@mkdir -p $@
187

188
.PHONY: ${GEN_CERT}
189
GEN_CERT := ${ISTIO_BIN}/generate_cert
190
${GEN_CERT}:
191
	GOOS=$(GOOS_LOCAL) && GOARCH=$(GOARCH_LOCAL) && common/scripts/gobuild.sh $@ ./security/tools/generate_cert
192

193
#-----------------------------------------------------------------------------
194
# Target: precommit
195
#-----------------------------------------------------------------------------
196
.PHONY: precommit format lint
197

198
# Target run by the pre-commit script, to automate formatting and lint
199
# If pre-commit script is not used, please run this manually.
200
precommit: format lint
201

202
format: fmt ## Auto formats all code. This should be run before sending a PR.
203

204
fmt: format-go format-python tidy-go
205

206
ifeq ($(DEBUG),1)
207
# gobuild script uses custom linker flag to set the variables.
208
RELEASE_LDFLAGS=''
209
else
210
RELEASE_LDFLAGS='-extldflags -static -s -w'
211
endif
212

213
# List of all binaries to build
214
# We split the binaries into "agent" binaries and standard ones. This corresponds to build "agent".
215
# This allows conditional compilation to avoid pulling in costly dependencies to the agent, such as XDS and k8s.
216
AGENT_BINARIES:=./pilot/cmd/pilot-agent
217
STANDARD_BINARIES:=./istioctl/cmd/istioctl \
218
  ./pilot/cmd/pilot-discovery \
219
  ./pkg/test/echo/cmd/client \
220
  ./pkg/test/echo/cmd/server \
221
  ./samples/extauthz/cmd/extauthz \
222
  ./operator/cmd/operator
223

224
# These are binaries that require Linux to build, and should
225
# be skipped on other platforms. Notably this includes the current Linux-only Istio CNI plugin
226
LINUX_AGENT_BINARIES:=./cni/cmd/istio-cni \
227
  ./cni/cmd/install-cni \
228
  $(AGENT_BINARIES)
229

230
BINARIES:=$(STANDARD_BINARIES) $(AGENT_BINARIES) $(LINUX_AGENT_BINARIES)
231

232
# List of binaries that have their size tested
233
RELEASE_SIZE_TEST_BINARIES:=pilot-discovery pilot-agent istioctl envoy ztunnel client server
234

235
# agent: enables agent-specific files. Usually this is used to trim dependencies where they would be hard to trim through standard refactoring
236
# disable_pgv: disables protoc-gen-validation. This is not used buts adds many MB to Envoy protos
237
# not set vtprotobuf: this adds some performance improvement, but at a binary cost increase that is not worth it for the agent
238
AGENT_TAGS=agent,disable_pgv
239
# disable_pgv: disables protoc-gen-validation. This is not used buts adds many MB to Envoy protos
240
# vtprotobuf: enables optimized protobuf marshalling. Disabled until https://github.com/istio/istio/issues/49790 lands
241
STANDARD_TAGS=disable_pgv
242

243
.PHONY: build
244
build: depend ## Builds all go binaries.
245
	GOOS=$(GOOS_LOCAL) GOARCH=$(GOARCH_LOCAL) LDFLAGS=$(RELEASE_LDFLAGS) common/scripts/gobuild.sh $(TARGET_OUT)/ -tags=$(STANDARD_TAGS) $(STANDARD_BINARIES)
246
	GOOS=$(GOOS_LOCAL) GOARCH=$(GOARCH_LOCAL) LDFLAGS=$(RELEASE_LDFLAGS) common/scripts/gobuild.sh $(TARGET_OUT)/ -tags=$(AGENT_TAGS) $(AGENT_BINARIES)
247

248
# The build-linux target is responsible for building binaries used within containers.
249
# This target should be expanded upon as we add more Linux architectures: i.e. build-arm64.
250
# Then a new build target can be created such as build-container-bin that builds these
251
# various platform images.
252
.PHONY: build-linux
253
build-linux: depend
254
	GOOS=linux GOARCH=$(GOARCH_LOCAL) LDFLAGS=$(RELEASE_LDFLAGS) common/scripts/gobuild.sh $(TARGET_OUT_LINUX)/ -tags=$(STANDARD_TAGS) $(STANDARD_BINARIES)
255
	GOOS=linux GOARCH=$(GOARCH_LOCAL) LDFLAGS=$(RELEASE_LDFLAGS) common/scripts/gobuild.sh $(TARGET_OUT_LINUX)/ -tags=$(AGENT_TAGS) $(LINUX_AGENT_BINARIES)
256

257
# Create targets for TARGET_OUT_LINUX/binary
258
# There are two use cases here:
259
# * Building all docker images (generally in CI). In this case we want to build everything at once, so they share work
260
# * Building a single docker image (generally during dev). In this case we just want to build the single binary alone
261
BUILD_ALL ?= true
262
define build-linux
263
.PHONY: $(TARGET_OUT_LINUX)/$(shell basename $(1))
264
ifeq ($(BUILD_ALL),true)
265
$(TARGET_OUT_LINUX)/$(shell basename $(1)): build-linux
266
	@:
267
else
268
$(TARGET_OUT_LINUX)/$(shell basename $(1)): $(TARGET_OUT_LINUX)
269
	GOOS=linux GOARCH=$(GOARCH_LOCAL) LDFLAGS=$(RELEASE_LDFLAGS) common/scripts/gobuild.sh $(TARGET_OUT_LINUX)/ -tags=$(2) $(1)
270
endif
271
endef
272

273
$(foreach bin,$(STANDARD_BINARIES),$(eval $(call build-linux,$(bin),$(STANDARD_TAGS))))
274
$(foreach bin,$(LINUX_AGENT_BINARIES),$(eval $(call build-linux,$(bin),$(AGENT_TAGS))))
275

276
# Create helper targets for each binary, like "pilot-discovery"
277
# As an optimization, these still build everything
278
$(foreach bin,$(BINARIES),$(shell basename $(bin))): build
279
ifneq ($(TARGET_OUT_LINUX),$(LOCAL_OUT))
280
# if we are on linux already, then this rule is handled by build-linux above, which handles BUILD_ALL variable
281
$(foreach bin,$(BINARIES),${LOCAL_OUT}/$(shell basename $(bin))): build
282
endif
283

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

286
lint-helm-global:
287
	find manifests -name 'Chart.yaml' -print0 | ${XARGS} -L 1 dirname | xargs -r helm lint
288

289
lint: lint-python lint-copyright-banner lint-scripts lint-go lint-dockerfiles lint-markdown lint-yaml lint-licenses lint-helm-global check-agent-deps ## Runs all linters.
290
	@bin/check_samples.sh
291
	@testlinter
292
	@envvarlinter istioctl pilot security
293

294
.PHONY: check-agent-deps
295
check-agent-deps:
296
	@go list -f '{{ join .Deps "\n" }}' \
297
			./security/pkg/nodeagent/caclient/... \
298
			./security/pkg/nodeagent/plugin/... \
299
			./security/pkg/nodeagent/cache/... \
300
			./pkg/bootstrap/... \
301
			./pkg/envoy/... |\
302
		(! grep -P 'k8s.io/api/|k8s.io/apiextensions-apiserver|k8s.io/client-go|sigs.k8s.io/gateway-api|cel|antlr|go-control-plane/envoy/extensions/filters')
303

304
go-gen:
305
	@mkdir -p /tmp/bin
306
	@PATH="${PATH}":/tmp/bin go generate ./...
307

308
refresh-goldens:
309
	@REFRESH_GOLDEN=true go test ${GOBUILDFLAGS} ./operator/... \
310
		./pkg/bootstrap/... \
311
		./pkg/kube/inject/... \
312
		./pilot/pkg/security/authz/builder/... \
313
		./cni/pkg/plugin/...
314

315
update-golden: refresh-goldens
316

317
# Keep dummy target since some build pipelines depend on this
318
gen-charts:
319
	@echo "This target is no longer required and will be removed in the future"
320

321
gen-addons:
322
	manifests/addons/gen.sh
323

324
gen: \
325
	mod-download-go \
326
	go-gen \
327
	mirror-licenses \
328
	format \
329
	update-crds \
330
	proto \
331
	copy-templates \
332
	gen-addons \
333
	update-golden ## Update all generated code.
334

335
gen-check: gen check-clean-repo
336

337
CHARTS = gateway default ztunnel istio-operator base "gateways/istio-ingress" "gateways/istio-egress" "istio-control/istio-discovery" istiod-remote istio-cni
338
copy-templates:
339
	rm manifests/charts/istiod-remote/templates/*
340
	rm manifests/charts/gateways/istio-egress/templates/*
341

342
	# gateway charts
343
	cp -r manifests/charts/gateways/istio-ingress/templates/* manifests/charts/gateways/istio-egress/templates
344
	find ./manifests/charts/gateways/istio-egress/templates -type f -exec sed -i -e 's/ingress/egress/g' {} \;
345
	find ./manifests/charts/gateways/istio-egress/templates -type f -exec sed -i -e 's/Ingress/Egress/g' {} \;
346

347
	# external istiod remote cluster charts
348
	cp manifests/charts/base/templates/services.yaml manifests/charts/istiod-remote/templates
349
	cp manifests/charts/base/templates/endpoints.yaml manifests/charts/istiod-remote/templates
350
	cp manifests/charts/base/templates/reader-serviceaccount.yaml manifests/charts/istiod-remote/templates
351
	cp manifests/charts/istio-control/istio-discovery/templates/mutatingwebhook.yaml manifests/charts/istiod-remote/templates
352
	cp manifests/charts/istio-control/istio-discovery/templates/reader-clusterrole.yaml manifests/charts/istiod-remote/templates
353
	cp manifests/charts/istio-control/istio-discovery/templates/reader-clusterrolebinding.yaml manifests/charts/istiod-remote/templates
354

355
	# external istiod config cluster charts
356
	cp manifests/charts/istio-control/istio-discovery/files/injection-template.yaml manifests/charts/istiod-remote/files
357
	cp manifests/charts/istio-control/istio-discovery/files/gateway-injection-template.yaml manifests/charts/istiod-remote/files
358
	cp manifests/charts/istio-control/istio-discovery/templates/istiod-injector-configmap.yaml manifests/charts/istiod-remote/templates
359
	cp manifests/charts/istio-control/istio-discovery/templates/configmap.yaml manifests/charts/istiod-remote/templates
360
	cp manifests/charts/istio-control/istio-discovery/templates/_helpers.tpl manifests/charts/istiod-remote/templates
361
	sed -e '1 i {{- if .Values.global.configCluster }}' -e '$$ a {{- end }}' manifests/charts/base/crds/crd-all.gen.yaml > manifests/charts/istiod-remote/templates/crd-all.gen.yaml
362
	sed -e '1 i {{- if .Values.global.configCluster }}' -e '$$ a {{- end }}' manifests/charts/base/templates/default.yaml > manifests/charts/istiod-remote/templates/default.yaml
363
	sed -e '1 i {{- if .Values.global.configCluster }}' -e '$$ a {{- end }}' manifests/charts/istio-control/istio-discovery/templates/validatingwebhookconfiguration.yaml > manifests/charts/istiod-remote/templates/validatingwebhookconfiguration.yaml
364
	sed -e '1 i {{- if .Values.global.configCluster }}' -e '$$ a {{- end }}' manifests/charts/istio-control/istio-discovery/templates/serviceaccount.yaml > manifests/charts/istiod-remote/templates/serviceaccount.yaml
365
	sed -e '1 i {{- if .Values.global.configCluster }}' -e '$$ a {{- end }}' manifests/charts/istio-control/istio-discovery/templates/role.yaml > manifests/charts/istiod-remote/templates/role.yaml
366
	sed -e '1 i {{- if .Values.global.configCluster }}' -e '$$ a {{- end }}' manifests/charts/istio-control/istio-discovery/templates/rolebinding.yaml > manifests/charts/istiod-remote/templates/rolebinding.yaml
367
	sed -e '1 i {{- if .Values.global.configCluster }}' -e '$$ a {{- end }}' manifests/charts/istio-control/istio-discovery/templates/clusterrole.yaml > manifests/charts/istiod-remote/templates/clusterrole.yaml
368
	sed -e '1 i {{- if .Values.global.configCluster }}' -e '$$ a {{- end }}' manifests/charts/istio-control/istio-discovery/templates/clusterrolebinding.yaml > manifests/charts/istiod-remote/templates/clusterrolebinding.yaml
369

370
	# copy istio-discovery values, but apply some local customizations
371
	cp manifests/charts/istio-control/istio-discovery/values.yaml manifests/charts/istiod-remote/
372
	yq -i '.defaults.telemetry.enabled=false | .defaults.global.externalIstiod=true | .defaults.global.omitSidecarInjectorConfigMap=true | .defaults.pilot.configMap=false' manifests/charts/istiod-remote/values.yaml
373
	for chart in $(CHARTS) ; do \
374
		for profile in manifests/helm-profiles/*.yaml ; do \
375
			cp $$profile manifests/charts/$$chart/files/profile-$$(basename $$profile) ; \
376
		done; \
377
		cp manifests/zzz_profile.yaml manifests/charts/$$chart/templates ; \
378
	done
379

380
#-----------------------------------------------------------------------------
381
# Target: go build
382
#-----------------------------------------------------------------------------
383

384
# Non-static istioctl targets. These are typically a build artifact.
385
${TARGET_OUT}/release/istioctl-linux-amd64:
386
	GOOS=linux GOARCH=amd64 LDFLAGS=$(RELEASE_LDFLAGS) common/scripts/gobuild.sh $@ ./istioctl/cmd/istioctl
387
${TARGET_OUT}/release/istioctl-linux-armv7:
388
	GOOS=linux GOARCH=arm GOARM=7 LDFLAGS=$(RELEASE_LDFLAGS) common/scripts/gobuild.sh $@ ./istioctl/cmd/istioctl
389
${TARGET_OUT}/release/istioctl-linux-arm64:
390
	GOOS=linux GOARCH=arm64 LDFLAGS=$(RELEASE_LDFLAGS) common/scripts/gobuild.sh $@ ./istioctl/cmd/istioctl
391
${TARGET_OUT}/release/istioctl-osx:
392
	GOOS=darwin GOARCH=amd64 LDFLAGS=$(RELEASE_LDFLAGS) common/scripts/gobuild.sh $@ ./istioctl/cmd/istioctl
393
${TARGET_OUT}/release/istioctl-osx-arm64:
394
	GOOS=darwin GOARCH=arm64 LDFLAGS=$(RELEASE_LDFLAGS) common/scripts/gobuild.sh $@ ./istioctl/cmd/istioctl
395
${TARGET_OUT}/release/istioctl-win.exe:
396
	GOOS=windows LDFLAGS=$(RELEASE_LDFLAGS) common/scripts/gobuild.sh $@ ./istioctl/cmd/istioctl
397

398
# generate the istioctl completion files
399
${TARGET_OUT}/release/istioctl.bash: ${LOCAL_OUT}/istioctl
400
	${LOCAL_OUT}/istioctl completion bash > ${TARGET_OUT}/release/istioctl.bash
401

402
${TARGET_OUT}/release/_istioctl: ${LOCAL_OUT}/istioctl
403
	${LOCAL_OUT}/istioctl completion zsh > ${TARGET_OUT}/release/_istioctl
404

405
.PHONY: binaries-test
406
binaries-test:
407
	go test ${GOBUILDFLAGS} ./tests/binary/... -v --base-dir ${TARGET_OUT} --binaries="$(RELEASE_SIZE_TEST_BINARIES)"
408

409
# istioctl-all makes all of the non-static istioctl executables for each supported OS
410
.PHONY: istioctl-all
411
istioctl-all: ${TARGET_OUT}/release/istioctl-linux-amd64 ${TARGET_OUT}/release/istioctl-linux-armv7 ${TARGET_OUT}/release/istioctl-linux-arm64 \
412
	${TARGET_OUT}/release/istioctl-osx \
413
	${TARGET_OUT}/release/istioctl-osx-arm64 \
414
	${TARGET_OUT}/release/istioctl-win.exe
415

416
.PHONY: istioctl.completion
417
istioctl.completion: ${TARGET_OUT}/release/istioctl.bash ${TARGET_OUT}/release/_istioctl
418

419
# istioctl-install builds then installs istioctl into $GOPATH/BIN
420
# Used for debugging istioctl during dev work
421
.PHONY: istioctl-install-container
422
istioctl-install-container: istioctl
423

424
#-----------------------------------------------------------------------------
425
# Target: test
426
#-----------------------------------------------------------------------------
427

428
.PHONY: test
429

430
# This target sets JUNIT_REPORT to the location of the  go-junit-report binary.
431
# This binary is provided in the build container. If it is not found, the build
432
# container is not being used, so ask the user to install go-junit-report.
433
JUNIT_REPORT := $(shell which go-junit-report 2> /dev/null || echo "${ISTIO_BIN}/go-junit-report")
434

435
${ISTIO_BIN}/go-junit-report:
436
	@echo "go-junit-report was not found in the build environment."
437
	@echo "Please install go-junit-report (ex. go install github.com/jstemmer/go-junit-report@latest)"
438
	@exit 1
439

440
# This is just an alias for racetest now
441
test: racetest ## Runs all unit tests
442

443
# For now, keep a minimal subset. This can be expanded in the future.
444
BENCH_TARGETS ?= ./pilot/...
445

446
PKG ?= ./...
447
.PHONY: racetest
448
racetest: $(JUNIT_REPORT)
449
	go test ${GOBUILDFLAGS} ${T} -race $(PKG) 2>&1 | tee >($(JUNIT_REPORT) > $(JUNIT_OUT))
450

451
.PHONY: benchtest
452
benchtest: $(JUNIT_REPORT) ## Runs all benchmarks
453
	prow/benchtest.sh run $(BENCH_TARGETS)
454
	prow/benchtest.sh compare
455

456
report-benchtest:
457
	prow/benchtest.sh report
458

459
#-----------------------------------------------------------------------------
460
# Target: clean
461
#-----------------------------------------------------------------------------
462
.PHONY: clean
463

464
clean: ## Cleans all the intermediate files and folders previously generated.
465
	rm -rf $(DIRS_TO_CLEAN)
466

467
#-----------------------------------------------------------------------------
468
# Target: docker
469
#-----------------------------------------------------------------------------
470
.PHONY: push
471

472
# for now docker is limited to Linux compiles - why ?
473
include tools/istio-docker.mk
474

475
push: docker.push ## Build and push docker images to registry defined by $HUB and $TAG
476

477
#-----------------------------------------------------------------------------
478
# Target: environment and tools
479
#-----------------------------------------------------------------------------
480
.PHONY: show.env show.goenv
481

482
show.env: ; $(info $(H) environment variables...)
483
	$(Q) printenv
484

485
show.goenv: ; $(info $(H) go environment...)
486
	$(Q) $(GO) version
487
	$(Q) $(GO) env
488

489
# show makefile variables. Usage: make show.<variable-name>
490
show.%: ; $(info $* $(H) $($*))
491
	$(Q) true
492

493
#-----------------------------------------------------------------------------
494
# Target: custom resource definitions
495
#-----------------------------------------------------------------------------
496

497
update-crds:
498
	bin/update_crds.sh
499

500
#-----------------------------------------------------------------------------
501
# Target: artifacts and distribution
502
#-----------------------------------------------------------------------------
503
# deb, rpm, etc packages
504
include tools/packaging/packaging.mk
505

506
#-----------------------------------------------------------------------------
507
# Target: integration tests
508
#-----------------------------------------------------------------------------
509
include tests/integration/tests.mk
510

511
#-----------------------------------------------------------------------------
512
# Target: bookinfo sample
513
#-----------------------------------------------------------------------------
514

515
export BOOKINFO_VERSION ?= 1.18.0
516

517
.PHONY: bookinfo.build bookinfo.push
518

519
bookinfo.build:
520
	@prow/buildx-create
521
	@BOOKINFO_TAG=${BOOKINFO_VERSION} BOOKINFO_HUB=${HUB} samples/bookinfo/src/build-services.sh
522

523
bookinfo.push: MULTI_ARCH=true
524
bookinfo.push:
525
	@prow/buildx-create
526
	@BOOKINFO_TAG=${BOOKINFO_VERSION} BOOKINFO_HUB=${HUB} samples/bookinfo/src/build-services.sh --push
527

528
include common/Makefile.common.mk
529

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.