forked from DataDog/documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
286 lines (250 loc) · 12.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
# make
.PHONY: clean clean-all clean-build clean-examples clean-go-examples clean-java-examples clean-exe clean-integrations clean-auto-doc clean-node clean-virt help start stop
.DEFAULT_GOAL := help
PY3=$(shell if [ `which pyenv` ]; then \
if [ `pyenv which python3` ]; then \
printf `pyenv which python3`; \
fi \
elif command -v python3 > /dev/null 2>&1; then \
printf "python3"; \
else printf "false"; \
fi)
IMAGE_VERSION="latest"
# config
CONFIG_FILE := Makefile.config
ifeq ($(wildcard $(CONFIG_FILE)),)
_ := $(error $(CONFIG_FILE) not found. See $(CONFIG_FILE).example.)
endif
include $(CONFIG_FILE)
help:
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-25s\033[0m %s\n", $$1, $$2}'
clean: stop ## Clean all make installs.
@echo "cleaning up..."
make clean-build
make clean-integrations
make clean-auto-doc
clean-all: stop ## Clean everything.
make clean-build
make clean-exe
make clean-integrations
make clean-auto-doc
make clean-node
make clean-virt
make clean-examples
clean-build: ## Remove build artifacts.
@if [ -d public ]; then rm -rf public; fi
@if [ static/images/integrations_logos/2020w2.pdf ]; then \
rm -f static/images/integrations_logos/2020w2.pdf ;fi
clean-exe: ## Remove execs.
@rm -rf ${EXE_LIST}
clean-integrations: ## Remove built integrations files.
@rm -rf ./integrations_data/
@if [ -d data/integrations ]; then \
find ./data/integrations -type f -maxdepth 1 \
-a -not -name '*.fr.yaml' \
-a -not -name '*.ja.yaml' \
-a -not -name 'docker_daemon.yaml' \
-exec rm -rf {} \; ;fi
@if [ -d data/service_checks ]; then \
find ./data/service_checks -type f -maxdepth 1 \
-a -not -name '*.fr.json' \
-a -not -name '*.ja.json' \
-exec rm -rf {} \; ;fi
@find ./content/en/integrations -type f -maxdepth 1 \
-a -not -name '_index.md' \
-a -not -name 'adobe_experience_manager.md' \
-a -not -name 'kubernetes_audit_logs.md' \
-a -not -name 'alcide.md' \
-a -not -name 'amazon_guardduty.md' \
-a -not -name 'amazon_cloudhsm.md' \
-a -not -name 'apigee.md' \
-a -not -name 'pivotal_platform.md' \
-a -not -name 'carbon_black.md' \
-a -not -name 'cloudability.md' \
-a -not -name 'cloudcheckr.md' \
-a -not -name 'fluentbit.md' \
-a -not -name 'iam_access_analyzer.md' \
-a -not -name 'integration_sdk.md' \
-a -not -name 'journald.md' \
-a -not -name 'kubernetes.md' \
-a -not -name 'kubernetes_state_core.md' \
-a -not -name 'nxlog.md' \
-a -not -name 'rss.md' \
-a -not -name 'rsyslog.md' \
-a -not -name 'sidekiq.md' \
-a -not -name 'sinatra.md' \
-a -not -name 'snyk.md' \
-a -not -name 'stunnel.md' \
-a -not -name 'syslog_ng.md' \
-a -not -name 'system.md' \
-a -not -name 'tcp_rtt.md' \
-a -not -name 'uwsgi.md' \
-exec rm -rf {} \;
@find ./content/en/security_platform/default_rules -type f -maxdepth 1 \
-a -not -name '_index.md' \
-exec rm -rf {} \;
@if [ -d static/images/marketplace ]; then \
find ./static/images/marketplace -type f \
-exec rm -rf {} \; ;fi
clean-auto-doc: ##Remove all doc automatically created
@if [ -d content/en/developers/integrations ]; then \
find ./content/en/developers/integrations -type f -maxdepth 1 -exec rm -rf {} \; ;fi
@if [ content/en/agent/basic_agent_usage/ansible.md ]; then \
rm -f content/en/agent/basic_agent_usage/ansible.md ;fi
@if [ content/en/agent/basic_agent_usage/chef.md ]; then \
rm -f content/en/agent/basic_agent_usage/chef.md ;fi
@if [ content/en/agent/basic_agent_usage/heroku.md ]; then \
rm -f content/en/agent/basic_agent_usage/heroku.md ;fi
@if [ content/en/agent/basic_agent_usage/puppet.md ]; then \
rm -f content/en/agent/basic_agent_usage/puppet.md ;fi
@if [ content/en/agent/basic_agent_usage/saltstack.md ]; then \
rm -f content/en/agent/basic_agent_usage/saltstack.md ;fi
@if [ content/en/serverless/libraries_integrations/plugin.md ]; then \
rm -f content/en/serverless/libraries_integrations/plugin.md ;fi
@if [ content/en/serverless/libraries_integrations/macro.md ]; then \
rm -f content/en/serverless/libraries_integrations/macro.md ;fi
@if [ content/en/serverless/libraries_integrations/cli.md ]; then \
rm -f content/en/serverless/libraries_integrations/cli.md ;fi
@if [ content/en/serverless/libraries_integrations/extension.md ]; then \
rm -f content/en/serverless/libraries_integrations/extension.md ;fi
@if [ content/en/serverless/libraries_integrations/cdk.md ]; then \
rm -f content/en/serverless/libraries_integrations/cdk.md ;fi
@if [ content/en/synthetics/cicd_integrations/circleci_orb.md ]; then \
rm -f content/en/synthetics/cicd_integrations/circleci_orb.md ;fi
@if [ content/en/synthetics/cicd_integrations/github_actions.md ]; then \
rm -f content/en/synthetics/cicd_integrations/github_actions.md ;fi
@if [ content/en/real_user_monitoring/android/_index.md ]; then \
rm -f content/en/real_user_monitoring/android/_index.md ;fi
@if [ content/en/real_user_monitoring/android/data_collected.md ]; then \
rm -f content/en/real_user_monitoring/android/data_collected.md ;fi
@if [ content/en/real_user_monitoring/android/advanced_configuration.md ]; then \
rm -f content/en/real_user_monitoring/android/advanced_configuration.md ;fi
@if [ content/en/real_user_monitoring/android/integrated_libraries.md ]; then \
rm -f content/en/real_user_monitoring/android/integrated_libraries.md ;fi
@if [ content/en/real_user_monitoring/android/mobile_vitals.md ]; then \
rm -f content/en/real_user_monitoring/android/mobile_vitals.md ;fi
@if [ content/en/real_user_monitoring/android/troubleshooting.md ]; then \
rm -f content/en/real_user_monitoring/android/troubleshooting.md ;fi
@if [ content/en/real_user_monitoring/error_tracking/android.md ]; then \
rm -f content/en/real_user_monitoring/error_tracking/android.md ;fi
@if [ content/en/real_user_monitoring/error_tracking/ios.md ]; then \
rm -f content/en/real_user_monitoring/error_tracking/ios.md ;fi
@if [ content/en/real_user_monitoring/browser/_index.md ]; then \
rm -f content/en/real_user_monitoring/browser/_index.md ;fi
@if [ content/en/real_user_monitoring/ios/_index.md ]; then \
rm -f content/en/real_user_monitoring/ios/_index.md ;fi
@if [ content/en/real_user_monitoring/ios/crash_reporting.md ]; then \
rm -f content/en/real_user_monitoring/ios/crash_reporting.md ;fi
@if [ content/en/real_user_monitoring/ios/mobile_vitals.md ]; then \
rm -f content/en/real_user_monitoring/ios/mobile_vitals.md ;fi
@if [ -d content/en/real_user_monitoring/ios ]; then \
find ./content/en/real_user_monitoring/ios -type f -maxdepth 1 -exec rm -rf {} \; ;fi
@if [ content/en/real_user_monitoring/reactnative/_index.md ]; then \
rm -f content/en/real_user_monitoring/reactnative/_index.md ;fi
@if [ content/en/real_user_monitoring/reactnative/integrated_libraries.md ]; then \
rm -f content/en/real_user_monitoring/reactnative/integrated_libraries.md ;fi
@if [ content/en/real_user_monitoring/reactnative/mobile_vitals.md ]; then \
rm -f content/en/real_user_monitoring/reactnative/mobile_vitals.md ;fi
@if [ content/en/real_user_monitoring/flutter/_index.md ]; then \
rm -f content/en/real_user_monitoring/flutter/_index.md ;fi
@if [ content/en/tracing/setup/ruby.md ]; then \
rm -f content/en/tracing/setup/ruby.md ;fi
@if [ content/en/tracing/setup_overview/setup/ruby.md ]; then \
rm -f content/en/tracing/setup_overview/setup/ruby.md ;fi
@if [ content/en/integrations/guide/amazon_cloudformation.md ]; then \
rm -f content/en/integrations/guide/amazon_cloudformation.md ;fi
@if [ content/en/logs/log_collection/android.md ]; then \
rm -f content/en/logs/log_collection/android.md ;fi
@if [ content/en/logs/log_collection/ios.md ]; then \
rm -f content/en/logs/log_collection/ios.md ;fi
@if [ content/en/logs/log_collection/javascript.md ]; then \
rm -f content/en/logs/log_collection/javascript.md ;fi
@if [ content/en/logs/guide/forwarder.md ]; then \
rm -f content/en/logs/guide/forwarder.md ;fi
@if [ content/en/tracing/setup_overview/setup/android.md ]; then \
rm -f content/en/tracing/setup_overview/setup/android.md ;fi
@if [ content/en/security_platform/cloud_workload_security/agent_expressions.md ]; then \
rm -f content/en/security_platform/cloud_workload_security/agent_expressions.md ;fi
@if [ content/en/security_platform/cloud_workload_security/backend.md ]; then \
rm -f content/en/security_platform/cloud_workload_security/backend.md ;fi
clean-node: ## Remove node_modules.
@if [ -d node_modules ]; then rm -r node_modules; fi
clean-virt: ## Remove python virtual env.
@if [ -d ${VIRENV} ]; then rm -rf $(VIRENV); fi
hugpython: hugpython/bin/activate ## Build virtualenv used for tests.
hugpython/bin/activate: local/etc/requirements3.txt ## Start python virtual environment.
@if [ ${PY3} != "false" ]; then \
test -x ${VIRENV}/bin/pip || ${PY3} -m venv --clear ${VIRENV}; \
$(VIRENV)/bin/pip install -r local/etc/requirements3.txt; \
else printf "\e[93mPython 3 is required to fetch integrations and run tests.\033[0m Try https://github.com/pyenv/pyenv.\n"; fi
source-helpers: hugpython ## Source the helper functions used in build, test, deploy.
@mkdir -p ${EXEDIR}
@find ${LOCALBIN}/* -type f -exec cp {} ${EXEDIR} \;
@cp -r local/githooks/* .git/hooks
start: clean source-helpers examples ## Build the documentation with all external content.
@echo "\033[35m\033[1m\nBuilding the documentation with ALL external content:\033[0m"
@if [ ${PY3} != "false" ]; then \
source ${VIRENV}/bin/activate; \
GITHUB_TOKEN=${GITHUB_TOKEN} \
DD_API_KEY=${DD_API_KEY} \
DD_APP_KEY=${DD_APP_KEY} \
RUN_SERVER=${RUN_SERVER} \
CREATE_I18N_PLACEHOLDERS=${CREATE_I18N_PLACEHOLDERS} \
PULL_RBAC_PERMISSIONS=${PULL_RBAC_PERMISSIONS} \
CONFIGURATION_FILE=${CONFIGURATION_FILE} \
LOCAL=${LOCAL}\
run-site.sh; \
else @echo "\033[31m\033[1mPython 3 must be available to Build the documentation.\033[0m" ; fi
start-no-pre-build: clean source-helpers ## Build the documentation without automatically pulled content.
@echo "\033[35m\033[1m\nBuilding the documentation with NO external content:\033[0m"
@if [ ${PY3} != "false" ]; then \
source ${VIRENV}/bin/activate; \
RUN_SERVER=${RUN_SERVER} \
run-site-no-pre-build.sh; \
else @echo "\033[31m\033[1mPython 3 must be available to Build the documentation.\033[0m" ; fi
stop: ## Stop wepack watch/hugo server.
@echo "stopping previous..."
@pkill -x hugo server --renderToDisk || true
clean-go-examples:
@git clean -xdf content/en/api/**/*.go
clean-java-examples:
@git clean -xdf content/en/api/**/*.java
clean-python-examples:
@git clean -xdf content/en/api/**/*.py*
clean-ruby-examples:
@git clean -xdf content/en/api/**/*.rb*
clean-typescript-examples:
@git clean -xdf content/en/api/**/*.ts*
clean-examples: clean-go-examples clean-java-examples clean-python-examples clean-ruby-examples clean-typescript-examples
@rm -rf examples
BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
examples/datadog-api-client-go:
@git clone https://github.com/DataDog/datadog-api-client-go.git $@
@cd $@ && git switch $(BRANCH) || echo "branch $(BRANCH) was not found; using default branch"
examples/datadog-api-client-java:
@git clone https://github.com/DataDog/datadog-api-client-java.git $@
@cd $@ && git switch $(BRANCH) || echo "branch $(BRANCH) was not found; using default branch"
examples/datadog-api-client-python:
@git clone https://github.com/DataDog/datadog-api-client-python.git $@
@cd $@ && git switch $(BRANCH) || echo "branch $(BRANCH) was not found; using default branch"
examples/datadog-api-client-ruby:
@git clone https://github.com/DataDog/datadog-api-client-ruby.git $@
@cd $@ && git switch $(BRANCH) || echo "branch $(BRANCH) was not found; using default branch"
examples/datadog-api-client-typescript:
@git clone https://github.com/DataDog/datadog-api-client-typescript.git $@
@cd $@ && git switch $(BRANCH) || echo "branch $(BRANCH) was not found; using default branch"
.PHONY: examples/go examples/java examples/python examples/ruby examples/typescript examples
EXAMPLES_DIR = $(shell pwd)/examples/content/en/api
examples/go: examples/datadog-api-client-go clean-go-examples
-cp -Rn examples/datadog-api-client-go/examples/v* ./content/en/api/
examples/java: examples/datadog-api-client-java clean-java-examples
-cp -Rn examples/datadog-api-client-java/examples/v* ./content/en/api/
examples/python: examples/datadog-api-client-python clean-python-examples
-find examples/datadog-api-client-python/examples -iname \*.py -exec mv {} {}beta \;
-cp -Rn examples/datadog-api-client-python/examples/v* ./content/en/api
examples/ruby: examples/datadog-api-client-ruby clean-ruby-examples
-find examples/datadog-api-client-ruby/examples -iname \*.rb -exec mv {} {}beta \;
-cp -Rn examples/datadog-api-client-ruby/examples/v* ./content/en/api
examples/typescript: examples/datadog-api-client-typescript clean-typescript-examples
-cp -Rn examples/datadog-api-client-typescript/examples/v* ./content/en/api
examples: examples/go examples/java examples/python examples/ruby examples/typescript