forked from istio/istio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
601 lines (460 loc) · 21.4 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
## 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))))
SHELL := /bin/bash
# Current version, updated after a release.
VERSION ?= "0.5.0"
# If GOPATH is not set by the env, set it to a sane value
GOPATH ?= $(shell cd ../../..; 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 CGO_ENABLE=0
# OUT is the directory where dist artifacts and temp files will be created.
OUT=${GO_TOP}/out
GO ?= go
# Compile for linux/amd64 by default.
export GOOS ?= linux
export GOARCH ?= amd64
# Optional file including user-specific settings (HUB, TAG, etc)
-include .istiorc
# @todo allow user to run for a single $PKG only?
PACKAGES := $(shell $(GO) list ./...)
GO_EXCLUDE := /vendor/|.pb.go|.gen.go
GO_FILES := $(shell find . -name '*.go' | grep -v -E '$(GO_EXCLUDE)')
# Environment for tests, the directory containing istio and deps binaries.
# Typically same as GOPATH/bin, so tests work seemlessly with IDEs.
export ISTIO_BIN=${GO_TOP}/bin
hub = ""
tag = ""
HUB?=istio
ifneq ($(strip $(HUB)),)
hub =-hub ${HUB}
endif
# If tag not explicitly set in users' .istiorc or command line, default to the git sha.
TAG ?= $(shell git rev-parse --verify HEAD)
export TAG
export HUB
ifneq ($(strip $(TAG)),)
tag =-tag ${TAG}
endif
# Discover if user has dep installed -- prefer that
DEP := $(shell which dep || echo "${ISTIO_BIN}/dep" )
# Set Google Storage bucket if not set
GS_BUCKET ?= istio-artifacts
export GS_BUCKET
#-----------------------------------------------------------------------------
# Output control
#-----------------------------------------------------------------------------
VERBOSE ?= 0
V ?= $(or $(VERBOSE),0)
Q = $(if $(filter 1,$V),,@)
H = $(shell printf "\033[34;1m=>\033[0m")
.PHONY: default
default: depend build
checkvars:
@if test -z "$(TAG)"; then echo "TAG missing"; exit 1; fi
@if test -z "$(HUB)"; then echo "HUB missing"; exit 1; fi
setup: pilot/platform/kube/config
#-----------------------------------------------------------------------------
# Target: depend
#-----------------------------------------------------------------------------
.PHONY: depend depend.update
.PHONY: depend.status depend.ensure depend.graph
# Pull depdendencies, based on the checked in Gopkg.lock file.
# Developers must manually call dep.update if adding new deps or to pull recent
# changes.
depend: init
depend.ensure: init
# Target to update the Gopkg.lock with latest versions.
# Should be run when adding any new dependency and periodically.
depend.update: ${DEP} ; $(info $(H) ensuring dependencies are up to date...)
${DEP} ensure
${DEP} ensure -update
cp Gopkg.lock vendor/Gopkg.lock
${DEP}:
unset GOOS && go get -u github.com/golang/dep/cmd/dep
Gopkg.lock: Gopkg.toml | ${DEP} ; $(info $(H) generating) @
$(Q) ${DEP} ensure -update
depend.status: Gopkg.lock
$(Q) ${DEP} status > vendor/dep.txt
$(Q) ${DEP} status -dot > vendor/dep.dot
# Requires 'graphviz' package. Run as user
depend.view: depend.status
cat vendor/dep.dot | dot -T png > vendor/dep.png
display vendor/dep.pkg
lint:
SKIP_INIT=1 bin/linters.sh
# Target run by the pre-commit script, to automate formatting and lint
# If pre-commit script is not used, please run this manually.
pre-commit: fmt lint
# Downloads envoy, based on the SHA defined in the base pilot Dockerfile
# Will also check vendor, based on Gopkg.lock
init:
@bin/init.sh
# init.sh downloads envoy
${ISTIO_BIN}/envoy: init
#-----------------------------------------------------------------------------
# Target: precommit
#-----------------------------------------------------------------------------
.PHONY: precommit format check
.PHONY: fmt format.gofmt format.goimports
.PHONY: check.vet check.lint
precommit: format check
format: format.goimports
fmt: format.gofmt format.goimports # backward compatible with ./bin/fmt.sh
check: check.vet check.lint
format.gofmt: ; $(info $(H) formatting files with go fmt...)
$(Q) gofmt -s -w $(GO_FILES)
format.goimports: ; $(info $(H) formatting files with goimports...)
$(Q) goimports -w -local istio.io $(GO_FILES)
# @todo fail on vet errors? Currently uses `true` to avoid aborting on failure
check.vet: ; $(info $(H) running go vet on packages...)
$(Q) $(GO) vet $(PACKAGES) || true
# @todo fail on lint errors? Currently uses `true` to avoid aborting on failure
# @todo remove _test and mock_ from ignore list and fix the errors?
check.lint: ; $(info $(H) running golint on packages...)
$(eval LINT_EXCLUDE := $(GO_EXCLUDE)|_test.go|mock_)
$(Q) for p in $(PACKAGES); do \
golint $$p | grep -v -E '$(LINT_EXCLUDE)' ; \
done || true;
# @todo gometalinter targets?
build: setup go-build
#-----------------------------------------------------------------------------
# Target: go build
#-----------------------------------------------------------------------------
# gobuild script uses custom linker flag to set the variables.
# Params: OUT VERSION_PKG SRC
PILOT_GO_BINS:=${ISTIO_BIN}/pilot-discovery ${ISTIO_BIN}/pilot-agent \
${ISTIO_BIN}/istioctl ${ISTIO_BIN}/sidecar-initializer
$(PILOT_GO_BINS): depend
bin/gobuild.sh ${ISTIO_BIN}/$(@F) istio.io/istio/pilot/tools/version ./pilot/cmd/$(@F)
MIXER_GO_BINS:=${ISTIO_BIN}/mixs ${ISTIO_BIN}/mixc
$(MIXER_GO_BINS): depend
bin/gobuild.sh ${ISTIO_BIN}/$(@F) istio.io/istio/mixer/pkg/version ./mixer/cmd/$(@F)
${ISTIO_BIN}/servicegraph: depend
bin/gobuild.sh ${ISTIO_BIN}/servicegraph istio.io/istio/mixer/pkg/version ./mixer/example/servicegraph
SECURITY_GO_BINS:=${ISTIO_BIN}/node_agent ${ISTIO_BIN}/istio_ca
$(SECURITY_GO_BINS): depend
bin/gobuild.sh ${ISTIO_BIN}/$(@F) istio.io/istio/security/cmd/istio_ca/version ./security/cmd/$(@F)
.PHONY: go-build
go-build: $(PILOT_GO_BINS) $(MIXER_GO_BINS) $(SECURITY_GO_BINS)
# The following are convenience aliases for most of the go targets
# The first block is for aliases that are the same as the actual binary,
# while the ones that follow need slight adjustments to their names.
IDENTITY_ALIAS_LIST:=istioctl mixc mixs pilot-agent servicegraph sidecar-initializer
.PHONY: $(IDENTITY_ALIAS_LIST)
$(foreach ITEM,$(IDENTITY_ALIAS_LIST),$(eval $(ITEM): ${ISTIO_BIN}/$(ITEM)))
.PHONY: istio-ca
istio-ca: ${ISTIO_BIN}/istio_ca
.PHONY: node-agent
node-agent: ${ISTIO_BIN}/node_agent
.PHONY: pilot
pilot: ${ISTIO_BIN}/pilot-discovery
#-----------------------------------------------------------------------------
# Target: go test
#-----------------------------------------------------------------------------
.PHONY: go-test localTestEnv test-bins
GOTEST_PARALLEL ?= '-test.parallel=4'
GOTEST_P ?= -p 1
GOSTATIC = -ldflags '-extldflags "-static"'
PILOT_TEST_BINS:=${ISTIO_BIN}/pilot-test-server ${ISTIO_BIN}/pilot-test-client ${ISTIO_BIN}/pilot-test-eurekamirror
$(PILOT_TEST_BINS): depend
CGO_ENABLED=0 go build ${GOSTATIC} -o ${ISTIO_BIN}/$(@F) istio.io/istio/$(subst -,/,$(@F))
test-bins: $(PILOT_TEST_BINS)
go build -o ${ISTIO_BIN}/pilot-integration-test istio.io/istio/pilot/test/integration
localTestEnv: test-bins
bin/testEnvLocalK8S.sh ensure
# Temp. disable parallel test - flaky consul test.
# https://github.com/istio/istio/issues/2318
.PHONY: pilot-test
pilot-test: pilot-agent
go test ${GOTEST_P} ${T} ./pilot/...
.PHONY: mixer-test
mixer-test: mixs
# Some tests use relative path "testdata", must be run from mixer dir
(cd mixer; go test ${T} ${GOTEST_PARALLEL} ./...)
.PHONY: broker-test
broker-test: depend
go test ${T} ./broker/...
.PHONY: security-test
security-test:
go test ${T} ./security/pkg/...
go test ${T} ./security/cmd/...
common-test:
go test ${T} ./pkg/...
# Run coverage tests
go-test: pilot-test mixer-test security-test broker-test common-test
#-----------------------------------------------------------------------------
# Target: Code coverage ( go )
#-----------------------------------------------------------------------------
.PHONY: pilot-coverage
pilot-coverage:
bin/parallel-codecov.sh pilot
.PHONY: mixer-coverage
mixer-coverage:
bin/parallel-codecov.sh mixer
.PHONY: broker-coverage
broker-coverage:
bin/parallel-codecov.sh broker
.PHONY: security-coverage
security-coverage:
bin/parallel-codecov.sh security/pkg
bin/parallel-codecov.sh security/cmd
# Run coverage tests
coverage: pilot-coverage mixer-coverage security-coverage broker-coverage
#-----------------------------------------------------------------------------
# Target: go test -race
#-----------------------------------------------------------------------------
.PHONY: racetest
.PHONY: pilot-racetest
pilot-racetest: pilot-agent
go test ${GOTEST_P} ${T} -race ./pilot/...
.PHONY: mixer-racetest
mixer-racetest: mixs
# Some tests use relative path "testdata", must be run from mixer dir
(cd mixer; go test ${T} -race ${GOTEST_PARALLEL} ./...)
.PHONY: broker-racetest
broker-racetest: depend
go test ${T} -race ./broker/...
.PHONY: security-racetest
security-racetest:
go test ${T} -race ./security/...
common-racetest:
go test ${T} -race ./pkg/...
# Run race tests
racetest: pilot-racetest mixer-racetest security-racetest broker-racetest common-racetest
#-----------------------------------------------------------------------------
# Target: precommit
#-----------------------------------------------------------------------------
.PHONY: clean
.PHONY: clean.go
DIRS_TO_CLEAN:=
FILES_TO_CLEAN:=
clean: clean.go clean.installgen
rm -rf $(DIRS_TO_CLEAN)
rm -f $(FILES_TO_CLEAN)
clean.go: ; $(info $(H) cleaning...)
$(eval GO_CLEAN_FLAGS := -i -r)
$(Q) $(GO) clean $(GO_CLEAN_FLAGS)
$(MAKE) clean -C mixer
$(MAKE) clean -C pilot
$(MAKE) clean -C security
test: setup go-test
# Build all prod and debug images
docker:
time $(ISTIO_GO)/security/bin/push-docker ${hub} ${tag} -build-only
time $(ISTIO_GO)/mixer/bin/push-docker ${hub} ${tag} -build-only
time $(ISTIO_GO)/pilot/bin/push-docker ${hub} ${tag} -build-only
# Build docker images for pilot, mixer, ca using prebuilt binaries
docker.prebuilt:
cp ${ISTIO_BIN}/{pilot-discovery,pilot-agent,sidecar-initializer} pilot/docker
time (cd pilot/docker && docker build -t ${HUB}/proxy_debug:${TAG} -f Dockerfile.proxy_debug .)
time (cd pilot/docker && docker build -t ${HUB}/proxy_init:${TAG} -f Dockerfile.proxy_init .)
time (cd pilot/docker && docker build -t ${HUB}/sidecar_initializer:${TAG} -f Dockerfile.sidecar_initializer .)
time (cd pilot/docker && docker build -t ${HUB}/pilot:${TAG} -f Dockerfile.pilot .)
cp ${ISTIO_BIN}/mixs mixer/docker
cp docker/ca-certificates.tgz mixer/docker
time (cd mixer/docker && docker build -t ${HUB}/mixer_debug:${TAG} -f Dockerfile.debug .)
cp ${ISTIO_BIN}/{istio_ca,node_agent} security/docker
cp docker/ca-certificates.tgz security/docker/
time (cd security/docker && docker build -t ${HUB}/istio-ca:${TAG} -f Dockerfile.istio-ca .)
time (cd security/docker && docker build -t ${HUB}/node-agent:${TAG} -f Dockerfile.node-agent .)
cp ${ISTIO_BIN}/{pilot-test-client,pilot-test-server,pilot-test-eurekamirror} pilot/docker
time (cd pilot/docker && docker build -t ${HUB}/app:${TAG} -f Dockerfile.app .)
time (cd pilot/docker && docker build -t ${HUB}/eurekamirror:${TAG} -f Dockerfile.eurekamirror .)
# TODO: generate or checkin test CA and keys
## These are not used so far
security/bin/gen-keys.sh
time (cd security/docker && docker build -t ${HUB}/istio-ca-test:${TAG} -f Dockerfile.istio-ca-test .)
time (cd security/docker && docker build -t ${HUB}/node-agent-test:${TAG} -f Dockerfile.node-agent-test .)
##################################################################################
# static files that are already at proper location for docker build
PROXY_JSON_FILES:=pilot/docker/envoy_pilot.json \
pilot/docker/envoy_pilot_auth.json \
pilot/docker/envoy_mixer.json \
pilot/docker/envoy_mixer_auth.json
NODE_AGENT_TEST_FILES:=security/docker/start_app.sh \
security/docker/app.js \
security/docker/istio_ca.crt \
security/docker/node_agent.crt \
security/docker/node_agent.key
# copied/generated files for docker build
.SECONDEXPANSION: #allow $@ to be used in dependency list
# each of these files .../XXX is copied from ${ISTIO_BIN}/XXX
# NOTE: each of these are passed to rm -f during "make clean". Keep in mind
# cases where you might change any of these to be a new or former source code path
COPIED_FROM_ISTIO_BIN:=pilot/docker/pilot-agent pilot/docker/pilot-discovery \
pilot/docker/pilot-test-client pilot/docker/pilot-test-server \
pilot/docker/sidecar-initializer pilot/docker/pilot-test-eurekamirror \
mixer/docker/mixs mixer/example/servicegraph/docker/servicegraph \
security/docker/istio_ca security/docker/node_agent
$(COPIED_FROM_ISTIO_BIN): ${ISTIO_BIN}/$$(@F)
cp $< $(@D)
FILES_TO_CLEAN+=$(COPIED_FROM_ISTIO_BIN)
# this rule is an exxeption since "viz" is a directory rather than a file
mixer/example/servicegraph/docker/viz: mixer/example/servicegraph/js/viz
cp -r $< $(@D)
DIRS_TO_CLEAN+=mixer/example/servicegraph/docker/viz
mixer/docker/ca-certificates.tgz security/docker/ca-certificates.tgz: docker/ca-certificates.tgz
cp $< $(@D)
FILES_TO_CLEAN+=mixer/docker/ca-certificates.tgz security/docker/ca-certificates.tgz
# NOTE: this list is passed to rm -f during "make clean"
GENERATED_CERT_FILES:=security/docker/istio_ca.crt security/docker/istio_ca.key \
security/docker/node_agent.crt security/docker/node_agent.key
$(GENERATED_CERT_FILES): security/bin/gen-keys.sh
security/bin/gen-keys.sh
FILES_TO_CLEAN+=$(GENERATED_CERT_FILES)
# pilot docker images
docker.app: pilot/docker/pilot-test-client pilot/docker/pilot-test-server \
pilot/docker/certs/cert.crt pilot/docker/certs/cert.key
docker.eurekamirror: pilot/docker/pilot-test-eurekamirror
docker.pilot: pilot/docker/pilot-discovery
docker.proxy docker.proxy_debug: pilot/docker/pilot-agent ${PROXY_JSON_FILES}
docker.proxy_init: pilot/docker/prepare_proxy.sh
docker.sidecar_initializer: pilot/docker/sidecar-initializer
PILOT_DOCKER:=docker.app docker.eurekamirror docker.pilot docker.proxy \
docker.proxy_debug docker.proxy_init docker.sidecar_initializer
$(PILOT_DOCKER): pilot/docker/Dockerfile$$(suffix $$@)
time (cd pilot/docker && docker build -t $(subst docker.,,$@) -f Dockerfile$(suffix $@) .)
# mixer/example docker images
SERVICEGRAPH_DOCKER:=docker.servicegraph docker.servicegraph_debug
$(SERVICEGRAPH_DOCKER): mixer/example/servicegraph/docker/Dockerfile$$(if $$(findstring debug,$$@),.debug) \
mixer/example/servicegraph/docker/servicegraph mixer/example/servicegraph/docker/viz
time (cd mixer/example/servicegraph/docker && docker build -t servicegraph$(findstring _debug,$@) \
-f Dockerfile$(if $(findstring debug,$@),.debug) .)
# mixer docker images
MIXER_DOCKER:=docker.mixer docker.mixer_debug
$(MIXER_DOCKER): mixer/docker/Dockerfile$$(if $$(findstring debug,$$@),.debug) \
mixer/docker/ca-certificates.tgz mixer/docker/mixs
time (cd mixer/docker && docker build -t mixer$(findstring _debug,$@) \
-f Dockerfile$(if $(findstring debug,$@),.debug) .)
# security docker images
docker.istio-ca: security/docker/istio_ca security/docker/ca-certificates.tgz
docker.istio-ca-test: security/docker/istio_ca.crt security/docker/istio_ca.key
docker.node-agent: security/docker/node_agent
docker.node-agent-test: security/docker/node_agent ${NODE_AGENT_TEST_FILES}
SECURITY_DOCKER:=docker.istio-ca docker.istio-ca-test docker.node-agent docker.node-agent-test
$(SECURITY_DOCKER): security/docker/Dockerfile$$(suffix $$@)
time (cd security/docker && docker build -t $(subst docker.,,$@) -f Dockerfile$(suffix $@) .)
DOCKER_TARGETS:=$(PILOT_DOCKER) $(SERVICEGRAPH_DOCKER) $(MIXER_DOCKER) $(SECURITY_DOCKER)
docker.all: $(DOCKER_TARGETS)
# for each docker.XXX target create a tar.docker.XXX target that says how
# to make a $(OUT)/docker/XXX.tar.gz from the docker XXX image
# note that $(subst docker.,,$(TGT)) strips off the "docker." prefix, leaving just the XXX
$(foreach TGT,$(DOCKER_TARGETS),$(eval tar.$(TGT): $(TGT); \
time (mkdir -p ${OUT}/docker && \
docker save -o ${OUT}/docker/$(subst docker.,,$(TGT)).tar $(subst docker.,,$(TGT)) && \
gzip ${OUT}/docker/$(subst docker.,,$(TGT)).tar)))
# create a DOCKER_TAR_TARGETS that's each of DOCKER_TARGETS with a tar. prefix
DOCKER_TAR_TARGETS:=
$(foreach TGT,$(DOCKER_TARGETS),$(eval DOCKER_TAR_TARGETS+=tar.$(TGT)))
# this target saves a tar.gz of each docker image to ${OUT}/docker/
docker.save: $(DOCKER_TAR_TARGETS)
push: checkvars clean.installgen installgen
$(ISTIO_GO)/bin/push $(HUB) $(TAG) $(GS_BUCKET)
artifacts: docker
@echo 'To be added'
pilot/platform/kube/config:
touch $@
kubelink:
ln -fs ~/.kube/config pilot/platform/kube/
installgen:
install/updateVersion.sh -a ${HUB},${TAG}
clean.installgen:
rm -f install/consul/istio.yaml
rm -f install/eureka/istio.yaml
rm -f install/kubernetes/helm/istio/values.yaml
rm -f install/kubernetes/istio-auth.yaml
rm -f install/kubernetes/istio-ca-plugin-certs.yaml
rm -f install/kubernetes/istio-initializer.yaml
rm -f install/kubernetes/istio-one-namespace-auth.yaml
rm -f install/kubernetes/istio-one-namespace.yaml
rm -f install/kubernetes/istio.yaml
rm -f pilot/docker/pilot-test-client
rm -f pilot/docker/pilot-test-eurekamirror
rm -f pilot/docker/pilot-test-server
rm -f samples/bookinfo/consul/bookinfo.sidecars.yaml
rm -f samples/bookinfo/eureka/bookinfo.sidecars.yaml
rm -f security/docker/ca-certificates.tgz
.PHONY: artifacts build checkvars clean docker test setup push kubelink installgen clean.installgen
#-----------------------------------------------------------------------------
# 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
# show makefile variables. Usage: make show.<variable-name>
show.%: ; $(info $* $(H) $($*))
$(Q) true
#-----------------------------------------------------------------------------
# Target: artifacts and distribution
#-----------------------------------------------------------------------------
${OUT}/dist/Gopkg.lock:
mkdir -p ${OUT}/dist
cp Gopkg.lock ${OUT}/dist/
# Binary/built artifacts of the distribution
dist-bin: ${OUT}/dist/Gopkg.lock
dist: dist-bin
include .circleci/Makefile
.PHONY: docker.sidecar.deb sidecar.deb ${OUT}/istio-sidecar.deb
# Make the deb image using the CI/CD image and docker.
docker.sidecar.deb:
(cd ${TOP}; docker run --rm -u $(shell id -u) -it \
-v ${GO_TOP}:${GO_TOP} \
-w ${PWD} \
-e USER=${USER} \
--entrypoint /usr/bin/make ${CI_HUB}/ci:${CI_VERSION} \
sidecar.deb )
# Create the 'sidecar' deb, including envoy and istio agents and configs.
# This target uses a locally installed 'fpm' - use 'docker.sidecar.deb' to use
# the builder image.
# TODO: consistent layout, possibly /opt/istio-VER/...
sidecar.deb: ${OUT}/istio-sidecar.deb
ISTIO_SIDECAR_SRC=tools/deb/istio-start.sh \
tools/deb/istio-iptables.sh \
tools/deb/istio.service \
security/tools/deb/istio-auth-node-agent.service \
tools/deb/sidecar.env tools/deb/envoy.json
# --iteration 1 adds a "-1" suffix to the version that didn't exist before
${OUT}/istio-sidecar.deb: ${ISTIO_BIN}/envoy ${ISTIO_BIN}/pilot-agent ${ISTIO_BIN}/node_agent ${ISTIO_SIDECAR_SRC}
mkdir -p ${OUT}
fpm -s dir -t deb -n istio-sidecar -p ${OUT}/istio-sidecar.deb --version ${VERSION} -C ${GO_TOP} -f \
--url http://istio.io \
--license Apache \
--vendor istio.io \
--maintainer [email protected] \
--after-install tools/deb/postinst.sh \
--config-files /var/lib/istio/envoy/sidecar.env \
--config-files /var/lib/istio/envoy/envoy.json \
--description "Istio" \
src/istio.io/istio/tools/deb/istio-start.sh=/usr/local/bin/istio-start.sh \
src/istio.io/istio/tools/deb/istio-iptables.sh=/usr/local/bin/istio-iptables/sh \
src/istio.io/istio/tools/deb/istio.service=/lib/systemd/system/istio.service \
src/istio.io/istio/security/tools/deb/istio-auth-node-agent.service=/lib/systemd/system/istio-auth-node-agent.service \
bin/envoy=/usr/local/bin/envoy \
bin/pilot-agent=/usr/local/bin/pilot-agent \
bin/node_agent=/usr/local/istio/bin/node_agent \
src/istio.io/istio/tools/deb/sidecar.env=/var/lib/istio/envoy/sidecar.env \
src/istio.io/istio/tools/deb/envoy.json=/var/lib/istio/envoy/envoy.json
#-----------------------------------------------------------------------------
# Target: e2e tests
#-----------------------------------------------------------------------------
include tests/istio.mk