forked from vectordotdev/vector
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
287 lines (188 loc) · 9.9 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
.PHONY: help
.DEFAULT_GOAL := help
RUN := $(shell realpath $(shell dirname $(firstword $(MAKEFILE_LIST)))/scripts/run.sh)
export USE_CONTAINER ?= docker
# Begin OS detection
ifeq ($(OS),Windows_NT) # is Windows_NT on XP, 2000, 7, Vista, 10...
export OPERATING_SYSTEM := Windows
export DEFAULT_FEATURES = default-msvc
else
export OPERATING_SYSTEM := $(shell uname) # same as "uname -s"
export DEFAULT_FEATURES = default
endif
help:
@echo " __ __ __"
@echo " \ \ / / / /"
@echo " \ V / / / "
@echo " \_/ \/ "
@echo ""
@echo " V E C T O R"
@echo ""
@echo "---------------------------------------------------------------------------------------"
@echo ""
@awk 'BEGIN {FS = ":.*##"; printf "Usage: make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-46s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
##@ Default
all: check build-all package-all test-docker test-behavior verify ## Run all tests, checks, and verifications
##@ Building
build: ## Build the project natively in release mode
$(RUN) build
build-all: build-x86_64-unknown-linux-musl build-armv7-unknown-linux-musleabihf build-aarch64-unknown-linux-musl ## Build the project in release mode for all supported platforms
build-x86_64-unknown-linux-musl: ## Build the project in release mode for the x86_64 architecture
$(RUN) build-x86_64-unknown-linux-musl
build-armv7-unknown-linux-musleabihf: load-qemu-binfmt ## Build the project in release mode for the armv7 architecture
$(RUN) build-armv7-unknown-linux-musleabihf
build-aarch64-unknown-linux-musl: load-qemu-binfmt ## Build the project in release mode for the aarch64 architecture
$(RUN) build-aarch64-unknown-linux-musl
##@ Developing
bench: build ## Run benchmarks in /benches
$(RUN) bench
test: test-behavior test-integration test-unit ## Runs all tests, unit, behaviorial, and integration.
test-behavior: build ## Runs behaviorial tests
$(RUN) test-behavior
test-integration: ## Runs all integration tests
$(RUN) test-integration
test-integration-aws: ## Runs Clickhouse integration tests
$(RUN) test-integration-aws
test-integration-clickhouse: ## Runs Clickhouse integration tests
$(RUN) test-integration-clickhouse
test-integration-docker: ## Runs Docker integration tests
$(RUN) test-integration-docker
test-integration-elasticsearch: ## Runs Elasticsearch integration tests
$(RUN) test-integration-elasticsearch
test-integration-gcp: ## Runs GCP integration tests
$(RUN) test-integration-gcp
test-integration-influxdb: ## Runs Kafka integration tests
$(RUN) test-integration-influxdb
test-integration-kafka: ## Runs Kafka integration tests
$(RUN) test-integration-kafka
test-integration-loki: ## Runs Loki integration tests
$(RUN) test-integration-loki
test-integration-pulsar: ## Runs Kafka integration tests
$(RUN) test-integration-pulsar
test-integration-splunk: ## Runs Kafka integration tests
$(RUN) test-integration-splunk
test-unit: ## Runs unit tests, tests which do not require additional services to be present
$(RUN) test-unit
##@ Checking
check: check-all ## Default target, check everything
check-all: check-code check-fmt check-style check-markdown check-generate check-blog check-version check-examples check-component-features ## Check everything
check-code: ## Check code
$(RUN) check-code
check-component-features: ## Check that all component features are setup properly
$(RUN) check-component-features
check-fmt: ## Check that all files are formatted properly
$(RUN) check-fmt
check-style: ## Check that all files are styled properly
$(RUN) check-style
check-markdown: ## Check that markdown is styled properly
$(RUN) check-markdown
check-generate: ## Check that no files are pending generation
$(RUN) check-generate
check-version: ## Check that Vector's version is correct accounting for recent changes
$(RUN) check-version
check-examples: build ## Check that the config/exmaples files are valid
$(RUN) check-examples
check-blog: ## Check that all blog posts are signed and valid
$(RUN) check-blog
##@ Packaging
package-all: package-archive-all package-deb-all package-rpm-all ## Build all packages
package-x86_64-unknown-linux-musl-all: package-archive-x86_64-unknown-linux-musl package-deb-x86_64 package-rpm-x86_64 # Build all x86_64 MUSL packages
package-armv7-unknown-linux-musleabihf-all: package-archive-armv7-unknown-linux-musleabihf package-deb-armv7 package-rpm-armv7 # Build all armv7 MUSL packages
package-aarch64-unknown-linux-musl-all: package-archive-aarch64-unknown-linux-musl package-deb-aarch64 package-rpm-aarch64 # Build all aarch64 MUSL packages
# archives
package-archive: build ## Build the Vector archive
$(RUN) package-archive
package-archive-all: package-archive-x86_64-unknown-linux-musl package-archive-armv7-unknown-linux-musleabihf package-archive-aarch64-unknown-linux-musl ## Build all archives
package-archive-x86_64-unknown-linux-musl: build-x86_64-unknown-linux-musl ## Build the x86_64 archive
$(RUN) package-archive-x86_64-unknown-linux-musl
package-archive-armv7-unknown-linux-musleabihf: build-armv7-unknown-linux-musleabihf ## Build the armv7 archive
$(RUN) package-archive-armv7-unknown-linux-musleabihf
package-archive-aarch64-unknown-linux-musl: build-aarch64-unknown-linux-musl ## Build the aarch64 archive
$(RUN) package-archive-aarch64-unknown-linux-musl
# debs
package-deb: ## Build the deb package
$(RUN) package-deb
package-deb-all: package-deb-x86_64 package-deb-armv7 package-deb-aarch64 ## Build all deb packages
package-deb-x86_64: package-archive-x86_64-unknown-linux-musl ## Build the x86_64 deb package
$(RUN) package-deb-x86_64
package-deb-armv7: package-archive-armv7-unknown-linux-musleabihf ## Build the armv7 deb package
$(RUN) package-deb-armv7
package-deb-aarch64: package-archive-aarch64-unknown-linux-musl ## Build the aarch64 deb package
$(RUN) package-deb-aarch64
# rpms
package-rpm: ## Build the rpm package
$(RUN) package-rpm
package-rpm-all: package-rpm-x86_64 package-rpm-armv7 package-rpm-aarch64 ## Build all rpm packages
package-rpm-x86_64: package-archive-x86_64-unknown-linux-musl ## Build the x86_64 rpm package
$(RUN) package-rpm-x86_64
package-rpm-armv7: package-archive-armv7-unknown-linux-musleabihf ## Build the armv7 rpm package
$(RUN) package-rpm-armv7
package-rpm-aarch64: package-archive-aarch64-unknown-linux-musl ## Build the aarch64 rpm package
$(RUN) package-rpm-aarch64
##@ Releasing
release: release-prepare generate release-commit ## Release a new Vector version
release-commit: ## Commits release changes
$(RUN) release-commit
release-docker: ## Release to Docker Hub
$(RUN) release-docker
release-github: ## Release to Github
$(RUN) release-github
release-homebrew: ## Release to timberio Homebrew tap
$(RUN) release-homebrew
release-prepare: ## Prepares the release with metadata and highlights
$(RUN) release-prepare
release-push: ## Push new Vector version
$(RUN) release-push
release-rollback: ## Rollback pending release changes
$(RUN) release-rollback
release-s3: ## Release artifacts to S3
$(RUN) release-s3
sync-install: ## Sync the install.sh script for access via sh.vector.dev
@aws s3 cp distribution/install.sh s3://sh.vector.dev --sse --acl public-read
##@ Verifying
verify: verify-rpm verify-deb ## Default target, verify all packages
verify-rpm: verify-rpm-amazonlinux-1 verify-rpm-amazonlinux-2 verify-rpm-centos-7 ## Verify all rpm packages
verify-rpm-amazonlinux-1: package-rpm-x86_64 ## Verify the rpm package on Amazon Linux 1
$(RUN) verify-rpm-amazonlinux-1
verify-rpm-amazonlinux-2: package-rpm-x86_64 ## Verify the rpm package on Amazon Linux 2
$(RUN) verify-rpm-amazonlinux-2
verify-rpm-centos-7: package-rpm-x86_64 ## Verify the rpm package on CentOS 7
$(RUN) verify-rpm-centos-7
verify-deb: verify-deb-artifact-on-deb-8 verify-deb-artifact-on-deb-9 verify-deb-artifact-on-deb-10 verify-deb-artifact-on-ubuntu-16-04 verify-deb-artifact-on-ubuntu-18-04 verify-deb-artifact-on-ubuntu-19-04 ## Verify all deb packages
verify-deb-artifact-on-deb-8: package-deb-x86_64 ## Verify the deb package on Debian 8
$(RUN) verify-deb-artifact-on-deb-8
verify-deb-artifact-on-deb-9: package-deb-x86_64 ## Verify the deb package on Debian 9
$(RUN) verify-deb-artifact-on-deb-9
verify-deb-artifact-on-deb-10: package-deb-x86_64 ## Verify the deb package on Debian 10
$(RUN) verify-deb-artifact-on-deb-10
verify-deb-artifact-on-ubuntu-16-04: package-deb-x86_64 ## Verify the deb package on Ubuntu 16.04
$(RUN) verify-deb-artifact-on-ubuntu-16-04
verify-deb-artifact-on-ubuntu-18-04: package-deb-x86_64 ## Verify the deb package on Ubuntu 18.04
$(RUN) verify-deb-artifact-on-ubuntu-18-04
verify-deb-artifact-on-ubuntu-19-04: package-deb-x86_64 ## Verify the deb package on Ubuntu 19.04
$(RUN) verify-deb-artifact-on-ubuntu-19-04
verify-nixos: ## Verify that Vector can be built on NixOS
$(RUN) verify-nixos
##@ Website
generate: ## Generates files across the repo using the data in /.meta
$(RUN) generate
export ARTICLE ?= true
sign-blog: ## Sign newly added blog articles using GPG
$(RUN) sign-blog
##@ Utility
clean: ## Clean everything
$(RUN) clean
fmt: ## Format code
$(RUN) fmt
init-target-dir: ## Create target directory owned by the current user
$(RUN) init-target-dir
load-qemu-binfmt: ## Load `binfmt-misc` kernel module which required to use `qemu-user`
$(RUN) load-qemu-binfmt
signoff: ## Signsoff all previous commits since branch creation
$(RUN) signoff
slim-builds: ## Updates the Cargo config to product disk optimized builds, useful for CI
$(RUN) slim-builds
target-graph: ## Display dependencies between targets in this Makefile
@cd $(shell realpath $(shell dirname $(firstword $(MAKEFILE_LIST))))/.. && docker-compose run --rm target-graph $(TARGET)
version: ## Get the current Vector version
$(RUN) version