Makefile 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  1. #
  2. # Licensed to the Apache Software Foundation (ASF) under one or more
  3. # contributor license agreements. See the NOTICE file distributed with
  4. # this work for additional information regarding copyright ownership.
  5. # The ASF licenses this file to You under the Apache License, Version 2.0
  6. # (the "License"); you may not use this file except in compliance with
  7. # the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. # Makefile basic env setting
  18. .DEFAULT_GOAL := help
  19. # add pipefail support for default shell
  20. SHELL := /bin/bash -o pipefail
  21. # Project basic setting
  22. VERSION ?= master
  23. project_name ?= apache-apisix
  24. project_release_name ?= $(project_name)-$(VERSION)-src
  25. OTEL_CONFIG ?= ./ci/pod/otelcol-contrib/data-otlp.json
  26. # Hyperconverged Infrastructure
  27. ENV_OS_NAME ?= $(shell uname -s | tr '[:upper:]' '[:lower:]')
  28. ENV_OS_ARCH ?= $(shell uname -m | tr '[:upper:]' '[:lower:]')
  29. ENV_APISIX ?= $(CURDIR)/bin/apisix
  30. ENV_GIT ?= git
  31. ENV_TAR ?= tar
  32. ENV_INSTALL ?= install
  33. ENV_RM ?= rm -vf
  34. ENV_DOCKER ?= docker
  35. ENV_DOCKER_COMPOSE ?= docker compose --project-directory $(CURDIR) -p $(project_name) -f $(project_compose_ci)
  36. ENV_NGINX ?= $(ENV_NGINX_EXEC) -p $(CURDIR) -c $(CURDIR)/conf/nginx.conf
  37. ENV_NGINX_EXEC := $(shell command -v openresty 2>/dev/null || command -v nginx 2>/dev/null)
  38. ENV_OPENSSL_PREFIX ?= /usr/local/openresty/openssl3
  39. ENV_LIBYAML_INSTALL_PREFIX ?= /usr
  40. ENV_LUAROCKS ?= luarocks
  41. ## These variables can be injected by luarocks
  42. ENV_INST_PREFIX ?= /usr
  43. ENV_INST_LUADIR ?= $(ENV_INST_PREFIX)/share/lua/5.1
  44. ENV_INST_BINDIR ?= $(ENV_INST_PREFIX)/bin
  45. ENV_RUNTIME_VER ?= $(shell $(ENV_NGINX_EXEC) -V 2>&1 | tr ' ' '\n' | grep 'APISIX_RUNTIME_VER' | cut -d '=' -f2)
  46. -include .requirements
  47. export
  48. ifneq ($(shell whoami), root)
  49. ENV_LUAROCKS_FLAG_LOCAL := --local
  50. endif
  51. ifdef ENV_LUAROCKS_SERVER
  52. ENV_LUAROCKS_SERVER_OPT := --server $(ENV_LUAROCKS_SERVER)
  53. endif
  54. ifneq ($(shell test -d $(ENV_OPENSSL_PREFIX) && echo -n yes), yes)
  55. ENV_NGINX_PREFIX := $(shell $(ENV_NGINX_EXEC) -V 2>&1 | grep -Eo 'prefix=(.*)/nginx\s+' | grep -Eo '/.*/')
  56. ifeq ($(shell test -d $(addprefix $(ENV_NGINX_PREFIX), openssl3) && echo -n yes), yes)
  57. ENV_OPENSSL_PREFIX := $(addprefix $(ENV_NGINX_PREFIX), openssl3)
  58. endif
  59. endif
  60. # Makefile basic extension function
  61. _color_red =\E[1;31m
  62. _color_green =\E[1;32m
  63. _color_yellow =\E[1;33m
  64. _color_blue =\E[1;34m
  65. _color_wipe =\E[0m
  66. define func_echo_status
  67. printf "[%b info %b] %s\n" "$(_color_blue)" "$(_color_wipe)" $(1)
  68. endef
  69. define func_echo_warn_status
  70. printf "[%b info %b] %s\n" "$(_color_yellow)" "$(_color_wipe)" $(1)
  71. endef
  72. define func_echo_success_status
  73. printf "[%b info %b] %s\n" "$(_color_green)" "$(_color_wipe)" $(1)
  74. endef
  75. define func_check_folder
  76. if [[ ! -d $(1) ]]; then \
  77. mkdir -p $(1); \
  78. $(call func_echo_status, 'folder check -> create `$(1)`'); \
  79. else \
  80. $(call func_echo_success_status, 'folder check -> found `$(1)`'); \
  81. fi
  82. endef
  83. # Makefile target
  84. .PHONY: runtime
  85. runtime:
  86. ifeq ($(ENV_NGINX_EXEC), )
  87. ifeq ("$(wildcard /usr/local/openresty/bin/openresty)", "")
  88. @$(call func_echo_warn_status, "WARNING: OpenResty not found. You have to install OpenResty and add the binary file to PATH before install Apache APISIX.")
  89. exit 1
  90. else
  91. $(eval ENV_NGINX_EXEC := /usr/local/openresty/bin/openresty)
  92. @$(call func_echo_status, "Use openresty as default runtime")
  93. endif
  94. endif
  95. ### help : Show Makefile rules
  96. ### If there're awk failures, please make sure
  97. ### you are using awk or gawk
  98. .PHONY: help
  99. help:
  100. @$(call func_echo_success_status, "Makefile rules:")
  101. @awk '{ if(match($$0, /^\s*#{3}\s*([^:]+)\s*:\s*(.*)$$/, res)){ printf(" make %-15s : %-10s\n", res[1], res[2]) } }' Makefile
  102. ### deps : Installing dependencies
  103. .PHONY: deps
  104. deps: install-runtime
  105. $(eval ENV_LUAROCKS_VER := $(shell $(ENV_LUAROCKS) --version | grep -E -o "luarocks [0-9]+."))
  106. @if [ '$(ENV_LUAROCKS_VER)' = 'luarocks 3.' ]; then \
  107. mkdir -p ~/.luarocks; \
  108. $(ENV_LUAROCKS) config $(ENV_LUAROCKS_FLAG_LOCAL) variables.OPENSSL_LIBDIR $(addprefix $(ENV_OPENSSL_PREFIX), /lib); \
  109. $(ENV_LUAROCKS) config $(ENV_LUAROCKS_FLAG_LOCAL) variables.OPENSSL_INCDIR $(addprefix $(ENV_OPENSSL_PREFIX), /include); \
  110. $(ENV_LUAROCKS) config $(ENV_LUAROCKS_FLAG_LOCAL) variables.YAML_DIR $(ENV_LIBYAML_INSTALL_PREFIX); \
  111. $(ENV_LUAROCKS) install apisix-master-0.rockspec --tree deps --only-deps $(ENV_LUAROCKS_SERVER_OPT); \
  112. else \
  113. $(call func_echo_warn_status, "WARNING: You're not using LuaRocks 3.x; please remove the luarocks and reinstall it via https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh"); \
  114. exit 1; \
  115. fi
  116. ### undeps : Uninstalling dependencies
  117. .PHONY: undeps
  118. undeps: uninstall-rocks uninstall-runtime
  119. .PHONY: uninstall-rocks
  120. uninstall-rocks:
  121. @$(call func_echo_status, "$@ -> [ Start ]")
  122. $(ENV_LUAROCKS) purge --tree=deps
  123. @$(call func_echo_success_status, "$@ -> [ Done ]")
  124. ### utils : Installation tools
  125. .PHONY: utils
  126. utils:
  127. ifeq ("$(wildcard utils/lj-releng)", "")
  128. wget -qP utils https://raw.githubusercontent.com/iresty/openresty-devel-utils/master/lj-releng
  129. chmod a+x utils/lj-releng
  130. endif
  131. ifeq ("$(wildcard utils/reindex)", "")
  132. wget -qP utils https://raw.githubusercontent.com/iresty/openresty-devel-utils/master/reindex
  133. chmod a+x utils/reindex
  134. endif
  135. ### lint : Lint source code
  136. .PHONY: lint
  137. lint: utils
  138. @$(call func_echo_status, "$@ -> [ Start ]")
  139. ./utils/check-lua-code-style.sh
  140. ./utils/check-test-code-style.sh
  141. @$(call func_echo_success_status, "$@ -> [ Done ]")
  142. ### init : Initialize the runtime environment
  143. .PHONY: init
  144. init: runtime
  145. @$(call func_echo_status, "$@ -> [ Start ]")
  146. $(ENV_APISIX) init
  147. $(ENV_APISIX) init_etcd
  148. @$(call func_echo_success_status, "$@ -> [ Done ]")
  149. ### run : Start the apisix server
  150. .PHONY: run
  151. run: runtime
  152. @$(call func_echo_status, "$@ -> [ Start ]")
  153. $(ENV_APISIX) start
  154. @$(call func_echo_success_status, "$@ -> [ Done ]")
  155. ### quit : Stop the apisix server, exit gracefully
  156. .PHONY: quit
  157. quit: runtime
  158. @$(call func_echo_status, "$@ -> [ Start ]")
  159. $(ENV_APISIX) quit
  160. @$(call func_echo_success_status, "$@ -> [ Done ]")
  161. ### stop : Stop the apisix server, exit immediately
  162. .PHONY: stop
  163. stop: runtime
  164. @$(call func_echo_status, "$@ -> [ Start ]")
  165. $(ENV_APISIX) stop
  166. @$(call func_echo_success_status, "$@ -> [ Done ]")
  167. ### verify : Verify the configuration of apisix server
  168. .PHONY: verify
  169. verify: runtime
  170. @$(call func_echo_status, "$@ -> [ Start ]")
  171. $(ENV_NGINX) -t
  172. @$(call func_echo_success_status, "$@ -> [ Done ]")
  173. ### clean : Remove generated files
  174. .PHONY: clean
  175. clean:
  176. @$(call func_echo_status, "$@ -> [ Start ]")
  177. rm -rf logs/
  178. @$(call func_echo_success_status, "$@ -> [ Done ]")
  179. ### reload : Reload the apisix server
  180. .PHONY: reload
  181. reload: runtime
  182. @$(call func_echo_status, "$@ -> [ Start ]")
  183. $(ENV_APISIX) reload
  184. @$(call func_echo_success_status, "$@ -> [ Done ]")
  185. .PHONY: install-runtime
  186. install-runtime:
  187. ifneq ($(ENV_RUNTIME_VER), $(APISIX_RUNTIME))
  188. ./utils/install-dependencies.sh
  189. @sudo $(ENV_INSTALL) /usr/local/openresty/bin/openresty $(ENV_INST_BINDIR)/openresty
  190. endif
  191. .PHONY: uninstall-runtime
  192. uninstall-runtime:
  193. ./utils/install-dependencies.sh uninstall
  194. rm -rf /usr/local/openresty
  195. rm -f $(ENV_INST_BINDIR)/openresty
  196. ### install : Install the apisix (only for luarocks)
  197. .PHONY: install
  198. install: runtime
  199. $(ENV_INSTALL) -d /usr/local/apisix/
  200. $(ENV_INSTALL) -d /usr/local/apisix/logs/
  201. $(ENV_INSTALL) -d /usr/local/apisix/conf/cert
  202. $(ENV_INSTALL) conf/mime.types /usr/local/apisix/conf/mime.types
  203. $(ENV_INSTALL) conf/config.yaml /usr/local/apisix/conf/config.yaml
  204. $(ENV_INSTALL) conf/debug.yaml /usr/local/apisix/conf/debug.yaml
  205. $(ENV_INSTALL) conf/cert/* /usr/local/apisix/conf/cert/
  206. # directories listed in alphabetical order
  207. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix
  208. $(ENV_INSTALL) apisix/*.lua $(ENV_INST_LUADIR)/apisix/
  209. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/admin
  210. $(ENV_INSTALL) apisix/admin/*.lua $(ENV_INST_LUADIR)/apisix/admin/
  211. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/balancer
  212. $(ENV_INSTALL) apisix/balancer/*.lua $(ENV_INST_LUADIR)/apisix/balancer/
  213. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/cli
  214. $(ENV_INSTALL) apisix/cli/*.lua $(ENV_INST_LUADIR)/apisix/cli/
  215. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/control
  216. $(ENV_INSTALL) apisix/control/*.lua $(ENV_INST_LUADIR)/apisix/control/
  217. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/core
  218. $(ENV_INSTALL) apisix/core/*.lua $(ENV_INST_LUADIR)/apisix/core/
  219. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/core/dns
  220. $(ENV_INSTALL) apisix/core/dns/*.lua $(ENV_INST_LUADIR)/apisix/core/dns
  221. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/discovery
  222. $(ENV_INSTALL) apisix/discovery/*.lua $(ENV_INST_LUADIR)/apisix/discovery/
  223. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/discovery/{consul,consul_kv,dns,eureka,nacos,kubernetes,tars}
  224. $(ENV_INSTALL) apisix/discovery/consul/*.lua $(ENV_INST_LUADIR)/apisix/discovery/consul
  225. $(ENV_INSTALL) apisix/discovery/consul_kv/*.lua $(ENV_INST_LUADIR)/apisix/discovery/consul_kv
  226. $(ENV_INSTALL) apisix/discovery/dns/*.lua $(ENV_INST_LUADIR)/apisix/discovery/dns
  227. $(ENV_INSTALL) apisix/discovery/eureka/*.lua $(ENV_INST_LUADIR)/apisix/discovery/eureka
  228. $(ENV_INSTALL) apisix/discovery/kubernetes/*.lua $(ENV_INST_LUADIR)/apisix/discovery/kubernetes
  229. $(ENV_INSTALL) apisix/discovery/nacos/*.lua $(ENV_INST_LUADIR)/apisix/discovery/nacos
  230. $(ENV_INSTALL) apisix/discovery/tars/*.lua $(ENV_INST_LUADIR)/apisix/discovery/tars
  231. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/http
  232. $(ENV_INSTALL) apisix/http/*.lua $(ENV_INST_LUADIR)/apisix/http/
  233. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/http/router
  234. $(ENV_INSTALL) apisix/http/router/*.lua $(ENV_INST_LUADIR)/apisix/http/router/
  235. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/include/apisix/model
  236. $(ENV_INSTALL) apisix/include/apisix/model/*.proto $(ENV_INST_LUADIR)/apisix/include/apisix/model/
  237. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/inspect
  238. $(ENV_INSTALL) apisix/inspect/*.lua $(ENV_INST_LUADIR)/apisix/inspect/
  239. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins
  240. $(ENV_INSTALL) apisix/plugins/*.lua $(ENV_INST_LUADIR)/apisix/plugins/
  241. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/ext-plugin
  242. $(ENV_INSTALL) apisix/plugins/ext-plugin/*.lua $(ENV_INST_LUADIR)/apisix/plugins/ext-plugin/
  243. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/grpc-transcode
  244. $(ENV_INSTALL) apisix/plugins/grpc-transcode/*.lua $(ENV_INST_LUADIR)/apisix/plugins/grpc-transcode/
  245. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/ip-restriction
  246. $(ENV_INSTALL) apisix/plugins/ip-restriction/*.lua $(ENV_INST_LUADIR)/apisix/plugins/ip-restriction/
  247. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/limit-conn
  248. $(ENV_INSTALL) apisix/plugins/limit-conn/*.lua $(ENV_INST_LUADIR)/apisix/plugins/limit-conn/
  249. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/limit-req
  250. $(ENV_INSTALL) apisix/plugins/limit-req/*.lua $(ENV_INST_LUADIR)/apisix/plugins/limit-req/
  251. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/limit-count
  252. $(ENV_INSTALL) apisix/plugins/limit-count/*.lua $(ENV_INST_LUADIR)/apisix/plugins/limit-count/
  253. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/opa
  254. $(ENV_INSTALL) apisix/plugins/opa/*.lua $(ENV_INST_LUADIR)/apisix/plugins/opa/
  255. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/prometheus
  256. $(ENV_INSTALL) apisix/plugins/prometheus/*.lua $(ENV_INST_LUADIR)/apisix/plugins/prometheus/
  257. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/proxy-cache
  258. $(ENV_INSTALL) apisix/plugins/proxy-cache/*.lua $(ENV_INST_LUADIR)/apisix/plugins/proxy-cache/
  259. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/serverless
  260. $(ENV_INSTALL) apisix/plugins/serverless/*.lua $(ENV_INST_LUADIR)/apisix/plugins/serverless/
  261. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/syslog
  262. $(ENV_INSTALL) apisix/plugins/syslog/*.lua $(ENV_INST_LUADIR)/apisix/plugins/syslog/
  263. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/tencent-cloud-cls
  264. $(ENV_INSTALL) apisix/plugins/tencent-cloud-cls/*.lua $(ENV_INST_LUADIR)/apisix/plugins/tencent-cloud-cls/
  265. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/pubsub
  266. $(ENV_INSTALL) apisix/pubsub/*.lua $(ENV_INST_LUADIR)/apisix/pubsub/
  267. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/secret
  268. $(ENV_INSTALL) apisix/secret/*.lua $(ENV_INST_LUADIR)/apisix/secret/
  269. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/zipkin
  270. $(ENV_INSTALL) apisix/plugins/zipkin/*.lua $(ENV_INST_LUADIR)/apisix/plugins/zipkin/
  271. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/ssl/router
  272. $(ENV_INSTALL) apisix/ssl/router/*.lua $(ENV_INST_LUADIR)/apisix/ssl/router/
  273. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/stream
  274. $(ENV_INSTALL) apisix/stream/*.lua $(ENV_INST_LUADIR)/apisix/stream/
  275. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/stream/plugins
  276. $(ENV_INSTALL) apisix/stream/plugins/*.lua $(ENV_INST_LUADIR)/apisix/stream/plugins/
  277. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/stream/router
  278. $(ENV_INSTALL) apisix/stream/router/*.lua $(ENV_INST_LUADIR)/apisix/stream/router/
  279. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/stream/xrpc
  280. $(ENV_INSTALL) apisix/stream/xrpc/*.lua $(ENV_INST_LUADIR)/apisix/stream/xrpc/
  281. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/stream/xrpc/protocols/redis
  282. $(ENV_INSTALL) apisix/stream/xrpc/protocols/redis/*.lua $(ENV_INST_LUADIR)/apisix/stream/xrpc/protocols/redis/
  283. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/stream/xrpc/protocols/dubbo
  284. $(ENV_INSTALL) apisix/stream/xrpc/protocols/dubbo/*.lua $(ENV_INST_LUADIR)/apisix/stream/xrpc/protocols/dubbo/
  285. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/utils
  286. $(ENV_INSTALL) apisix/utils/*.lua $(ENV_INST_LUADIR)/apisix/utils/
  287. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/ai-proxy
  288. $(ENV_INSTALL) apisix/plugins/ai-proxy/*.lua $(ENV_INST_LUADIR)/apisix/plugins/ai-proxy
  289. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/ai-proxy/drivers
  290. $(ENV_INSTALL) apisix/plugins/ai-proxy/drivers/*.lua $(ENV_INST_LUADIR)/apisix/plugins/ai-proxy/drivers
  291. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/ai-rag/embeddings
  292. $(ENV_INSTALL) apisix/plugins/ai-rag/embeddings/*.lua $(ENV_INST_LUADIR)/apisix/plugins/ai-rag/embeddings
  293. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/ai-rag/vector-search
  294. $(ENV_INSTALL) apisix/plugins/ai-rag/vector-search/*.lua $(ENV_INST_LUADIR)/apisix/plugins/ai-rag/vector-search
  295. # ai-content-moderation plugin
  296. $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/ai
  297. $(ENV_INSTALL) apisix/plugins/ai/*.lua $(ENV_INST_LUADIR)/apisix/plugins/ai
  298. $(ENV_INSTALL) bin/apisix $(ENV_INST_BINDIR)/apisix
  299. ### uninstall : Uninstall the apisix
  300. .PHONY: uninstall
  301. uninstall:
  302. @$(call func_echo_status, "$@ -> [ Start ]")
  303. $(ENV_RM) -r /usr/local/apisix
  304. $(ENV_RM) -r $(ENV_INST_LUADIR)/apisix
  305. $(ENV_RM) $(ENV_INST_BINDIR)/apisix
  306. @$(call func_echo_success_status, "$@ -> [ Done ]")
  307. ### test : Run the test case
  308. .PHONY: test
  309. test: runtime
  310. @$(call func_echo_status, "$@ -> [ Start ]")
  311. $(ENV_GIT) submodule update --init --recursive
  312. prove -I../test-nginx/lib -I./ -r -s t/
  313. @$(call func_echo_success_status, "$@ -> [ Done ]")
  314. ### license-check : Check project source code for Apache License
  315. .PHONY: license-check
  316. license-check:
  317. @$(call func_echo_status, "$@ -> [ Start ]")
  318. $(ENV_DOCKER) run -it --rm -v $(CURDIR):/github/workspace apache/skywalking-eyes header check
  319. @$(call func_echo_success_status, "$@ -> [ Done ]")
  320. .PHONY: release-src
  321. release-src: compress-tar
  322. @$(call func_echo_status, "$@ -> [ Start ]")
  323. gpg --batch --yes --armor --detach-sig $(project_release_name).tgz
  324. shasum -a 512 $(project_release_name).tgz > $(project_release_name).tgz.sha512
  325. $(call func_check_folder,release)
  326. mv $(project_release_name).tgz release/$(project_release_name).tgz
  327. mv $(project_release_name).tgz.asc release/$(project_release_name).tgz.asc
  328. mv $(project_release_name).tgz.sha512 release/$(project_release_name).tgz.sha512
  329. ./utils/gen-vote-contents.sh $(VERSION)
  330. @$(call func_echo_success_status, "$@ -> [ Done ]")
  331. .PHONY: compress-tar
  332. compress-tar:
  333. # The $VERSION can be major.minor.patch (from developer)
  334. # or major.minor (from the branch name in the CI)
  335. $(ENV_TAR) -zcvf $(project_release_name).tgz \
  336. ./apisix \
  337. ./bin \
  338. ./conf \
  339. ./apisix-master-0.rockspec \
  340. LICENSE \
  341. Makefile \
  342. NOTICE \
  343. *.md
  344. ### container
  345. ### ci-env-up : CI env launch
  346. .PHONY: ci-env-up
  347. ci-env-up:
  348. @$(call func_echo_status, "$@ -> [ Start ]")
  349. touch $(OTEL_CONFIG)
  350. chmod 777 $(OTEL_CONFIG)
  351. $(ENV_DOCKER_COMPOSE) up -d
  352. @$(call func_echo_success_status, "$@ -> [ Done ]")
  353. ### ci-env-ps : CI env ps
  354. .PHONY: ci-env-ps
  355. ci-env-ps:
  356. @$(call func_echo_status, "$@ -> [ Start ]")
  357. $(ENV_DOCKER_COMPOSE) ps
  358. @$(call func_echo_success_status, "$@ -> [ Done ]")
  359. ### ci-env-rebuild : CI env image rebuild
  360. .PHONY: ci-env-rebuild
  361. ci-env-rebuild:
  362. @$(call func_echo_status, "$@ -> [ Start ]")
  363. $(ENV_DOCKER_COMPOSE) build
  364. @$(call func_echo_success_status, "$@ -> [ Done ]")
  365. ### ci-env-down : CI env destroy
  366. .PHONY: ci-env-down
  367. ci-env-down:
  368. @$(call func_echo_status, "$@ -> [ Start ]")
  369. rm $(OTEL_CONFIG)
  370. $(ENV_DOCKER_COMPOSE) down
  371. @$(call func_echo_success_status, "$@ -> [ Done ]")
  372. ### ci-env-stop : CI env temporary stop
  373. .PHONY: ci-env-stop
  374. ci-env-stop:
  375. @$(call func_echo_status, "$@ -> [ Start ]")
  376. $(ENV_DOCKER_COMPOSE) stop
  377. @$(call func_echo_success_status, "$@ -> [ Done ]")