Skip to content

Commit 61028a5

Browse files
CI Botms2008
authored andcommitted
chore(version) added Kong Enterprise version 3.4.3.22 artifacts
1 parent 4623b8d commit 61028a5

File tree

509 files changed

+99960
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

509 files changed

+99960
-0
lines changed
Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
OS := $(shell uname | awk '{print tolower($$0)}')
2+
MACHINE := $(shell uname -m)
3+
4+
DEV_ROCKS = "busted 2.1.2" "busted-hjtest 0.0.4" "luacheck 1.1.1" "lua-llthreads2 0.1.6" "ldoc 1.5.0" "luacov 0.15.0"
5+
LUAROCKS_OPTS ?= --server https://kong.github.io/kongrocks-dev/rocks/ OPENSSL_DIR=$$LIBRARY_PREFIX CRYPTO_DIR=$$LIBRARY_PREFIX YAML_DIR=$(YAML_DIR)
6+
WIN_SCRIPTS = "bin/busted" "bin/kong" "bin/kong-health"
7+
BUSTED_ARGS ?= -v
8+
TEST_CMD ?= bin/busted $(BUSTED_ARGS)
9+
10+
BUILD_NAME ?= kong-dev
11+
BAZEL_ARGS ?= --verbose_failures --action_env=BUILD_NAME=$(BUILD_NAME) --//:skip_webui=true --//:skip_tools=true
12+
13+
ifeq ($(OS), darwin)
14+
HOMEBREW_DIR ?= /opt/homebrew
15+
OPENSSL_DIR ?= $(shell brew --prefix)/opt/openssl
16+
EXPAT_DIR ?= $(HOMEBREW_DIR)/opt/expat
17+
LIBXML2_DIR ?= $(HOMEBREW_DIR)/opt/libxml2
18+
GRPCURL_OS ?= osx
19+
YAML_DIR ?= $(shell brew --prefix)/opt/libyaml
20+
else
21+
LIBRARY_PREFIX ?= /usr
22+
OPENSSL_DIR ?= $(LIBRARY_PREFIX)
23+
EXPAT_DIR ?= $(LIBRARY_PREFIX)
24+
LIBXML2_DIR ?= $(LIBRARY_PREFIX)
25+
GRPCURL_OS ?= $(OS)
26+
YAML_DIR ?= /usr
27+
endif
28+
29+
ifeq ($(MACHINE), aarch64)
30+
GRPCURL_MACHINE ?= arm64
31+
H2CLIENT_MACHINE ?= arm64
32+
else
33+
GRPCURL_MACHINE ?= $(MACHINE)
34+
H2CLIENT_MACHINE ?= $(MACHINE)
35+
endif
36+
37+
ifeq ($(MACHINE), aarch64)
38+
BAZELISK_MACHINE ?= arm64
39+
else ifeq ($(MACHINE), x86_64)
40+
BAZELISK_MACHINE ?= amd64
41+
else
42+
BAZELISK_MACHINE ?= $(MACHINE)
43+
endif
44+
45+
.PHONY: install dev \
46+
sca test test-integration test-plugins test-all \
47+
pdk-phase-check functional-tests \
48+
fix-windows release wasm-test-filters
49+
50+
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
51+
KONG_SOURCE_LOCATION ?= $(ROOT_DIR)
52+
GRPCURL_VERSION ?= 1.8.5
53+
BAZLISK_VERSION ?= 1.17.0
54+
H2CLIENT_VERSION ?= 0.4.0
55+
BAZEL := $(shell command -v bazel 2> /dev/null)
56+
VENV = /dev/null # backward compatibility when no venv is built
57+
58+
# Use x86_64 grpcurl v1.8.5 for Apple silicon chips
59+
ifeq ($(GRPCURL_OS)_$(MACHINE)_$(GRPCURL_VERSION), osx_arm64_1.8.5)
60+
GRPCURL_MACHINE = x86_64
61+
endif
62+
63+
PACKAGE_TYPE ?= deb
64+
65+
bin/bazel:
66+
@curl -s -S -L \
67+
https://github.com/bazelbuild/bazelisk/releases/download/v$(BAZLISK_VERSION)/bazelisk-$(OS)-$(BAZELISK_MACHINE) -o bin/bazel
68+
@chmod +x bin/bazel
69+
70+
bin/grpcurl:
71+
@curl -s -S -L \
72+
https://github.com/fullstorydev/grpcurl/releases/download/v$(GRPCURL_VERSION)/grpcurl_$(GRPCURL_VERSION)_$(GRPCURL_OS)_$(GRPCURL_MACHINE).tar.gz | tar xz -C bin;
73+
@$(RM) bin/LICENSE
74+
75+
bin/h2client:
76+
@curl -s -S -L \
77+
https://github.com/Kong/h2client/releases/download/v$(H2CLIENT_VERSION)/h2client_$(H2CLIENT_VERSION)_$(OS)_$(H2CLIENT_MACHINE).tar.gz | tar xz -C bin;
78+
@$(RM) bin/README.md
79+
80+
81+
check-bazel: bin/bazel
82+
ifndef BAZEL
83+
$(eval BAZEL := bin/bazel)
84+
endif
85+
86+
wasm-test-filters:
87+
./scripts/build-wasm-test-filters.sh
88+
89+
build-kong: check-bazel
90+
$(BAZEL) build //build:kong $(BAZEL_ARGS)
91+
92+
build-venv: check-bazel
93+
$(eval VENV := bazel-bin/build/$(BUILD_NAME)-venv.sh)
94+
95+
@if [ ! -e bazel-bin/build/$(BUILD_NAME)-venv.sh ]; then \
96+
$(BAZEL) build //build:venv $(BAZEL_ARGS); \
97+
fi
98+
99+
build-openresty: check-bazel
100+
101+
@if [ ! -e bazel-bin/build/$(BUILD_NAME)/openresty ]; then \
102+
$(BAZEL) build //build:install-openresty --verbose_failures --action_env=BUILD_NAME=$(BUILD_NAME); \
103+
else \
104+
$(BAZEL) build //build:dev-make-openresty --verbose_failures --action_env=BUILD_NAME=$(BUILD_NAME); \
105+
fi
106+
107+
install-dev-rocks: build-venv
108+
@. $(VENV) ;\
109+
for rock in $(DEV_ROCKS) ; do \
110+
if luarocks list --porcelain $$rock | grep -q "installed" ; then \
111+
echo $$rock already installed, skipping ; \
112+
else \
113+
echo $$rock not found, installing via luarocks... ; \
114+
LIBRARY_PREFIX=$$(pwd)/bazel-bin/build/$(BUILD_NAME)/kong ; \
115+
luarocks install $$rock $(LUAROCKS_OPTS) || exit 1; \
116+
fi \
117+
done;
118+
119+
dev: build-venv install-dev-rocks bin/grpcurl bin/h2client wasm-test-filters
120+
121+
build-release: check-bazel
122+
$(BAZEL) clean --expunge
123+
$(BAZEL) build //build:kong --verbose_failures --config release
124+
125+
package/deb: check-bazel build-release
126+
$(BAZEL) build --config release :kong_deb
127+
128+
package/rpm: check-bazel build-release
129+
$(BAZEL) build --config release :kong_el8 --action_env=RPM_SIGNING_KEY_FILE --action_env=NFPM_RPM_PASSPHRASE
130+
$(BAZEL) build --config release :kong_aws2 --action_env=RPM_SIGNING_KEY_FILE --action_env=NFPM_RPM_PASSPHRASE
131+
$(BAZEL) build --config release :kong_aws2022 --action_env=RPM_SIGNING_KEY_FILE --action_env=NFPM_RPM_PASSPHRASE
132+
133+
functional-tests: dev test
134+
135+
install: dev
136+
@$(VENV) luarocks make
137+
138+
clean: check-bazel
139+
$(BAZEL) clean
140+
$(RM) bin/bazel bin/grpcurl bin/h2client
141+
142+
expunge: check-bazel
143+
$(BAZEL) clean --expunge
144+
$(RM) bin/bazel bin/grpcurl bin/h2client
145+
146+
sca:
147+
$(info Beginning static code analysis)
148+
@luacheck --exclude-files ./distribution/ -q .
149+
@!(grep -R -E -I -n -w '#only|#o' spec && echo "#only or #o tag detected") >&2
150+
@!(grep -R -E -I -n -w '#only|#o' spec-ee && echo "#only or #o tag detected") >&2
151+
@!(grep -R -E -I -n -- '---\s+ONLY' t && echo "--- ONLY block detected") >&2
152+
@$(KONG_SOURCE_LOCATION)/scripts/copyright-header-checker
153+
154+
trigger-api-tests:
155+
-docker manifest inspect kong/kong-gateway-internal:${DOCKER_IMAGE_TAG} 2>&1 >/dev/null && \
156+
curl \
157+
-X POST \
158+
-H "Accept: application/vnd.github+json" \
159+
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
160+
https://api.github.com/repos/kong/kong-api-tests/dispatches \
161+
-d '{"event_type":"per-commit-test","client_payload":{"docker_image":"kong/kong-gateway-internal:${DOCKER_IMAGE_TAG}"}' \
162+
163+
test: dev
164+
@$(VENV) $(TEST_CMD) spec/01-unit
165+
166+
test-integration: dev
167+
@$(VENV) $(TEST_CMD) spec/02-integration
168+
169+
test-plugins-spec: dev
170+
@$(VENV) $(TEST_CMD) spec/03-plugins
171+
172+
test-all: dev
173+
@$(VENV) $(TEST_CMD) spec/
174+
175+
test-ee: dev
176+
@$(VENV) $(TEST_CMD) spec-ee/01-unit
177+
178+
test-integration-ee: dev
179+
@$(VENV) $(TEST_CMD) spec-ee/02-integration
180+
181+
test-plugins-spec-ee: dev
182+
@$(VENV) $(TEST_CMD) spec-ee/03-plugins
183+
184+
test-all-ee: dev
185+
@$(VENV) $(TEST_CMD) spec-ee/
186+
187+
test-custom: dev
188+
ifndef test_spec
189+
$(error test_spec variable needs to be set, i.e. make test-custom test_spec=foo/bar/baz_spec.lua)
190+
endif
191+
@$(VENV) $(TEST_CMD) $(test_spec)
192+
193+
pdk-phase-checks: dev
194+
rm -f t/phase_checks.stats
195+
rm -f t/phase_checks.report
196+
PDK_PHASE_CHECKS_LUACOV=1 prove -I. t/01*/*/00-phase*.t
197+
luacov -c t/phase_checks.luacov
198+
grep "ngx\\." t/phase_checks.report
199+
grep "check_" t/phase_checks.report
200+
201+
test-plugins-ee:
202+
ifndef EE_PLUGIN
203+
$(error "Please use make plugins-ee EE_PLUGIN=plugin-name")
204+
endif
205+
scripts/enterprise_plugin.sh build-deps
206+
scripts/enterprise_plugin.sh test $(EE_PLUGIN)
207+
208+
fix-windows:
209+
@for script in $(WIN_SCRIPTS) ; do \
210+
echo Converting Windows file $$script ; \
211+
mv $$script $$script.win ; \
212+
tr -d '\015' <$$script.win >$$script ; \
213+
rm $$script.win ; \
214+
chmod 0755 $$script ; \
215+
done;
216+
217+
# the following targets are kept for backwards compatibility
218+
# dev is renamed to dev-legacy
219+
remove:
220+
$(warning 'remove' target is deprecated, please use `make dev` instead)
221+
-@luarocks remove kong
222+
223+
dependencies: bin/grpcurl bin/h2client
224+
$(warning 'dependencies' target is deprecated, this is now not needed when using `make dev`, but are kept for installation that are not built by Bazel)
225+
226+
for rock in $(DEV_ROCKS) ; do \
227+
if luarocks list --porcelain $$rock | grep -q "installed" ; then \
228+
echo $$rock already installed, skipping ; \
229+
else \
230+
echo $$rock not found, installing via luarocks... ; \
231+
luarocks install $$rock $(LUAROCKS_OPTS) || exit 1; \
232+
fi \
233+
done;
234+
235+
install-legacy:
236+
@luarocks make OPENSSL_DIR=$(OPENSSL_DIR) CRYPTO_DIR=$(OPENSSL_DIR) YAML_DIR=$(YAML_DIR)
237+
238+
dev-legacy: remove install-legacy dependencies
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/usr/bin/env resty
2+
3+
setmetatable(_G, nil)
4+
5+
local pl_path = require("pl.path")
6+
7+
local cert_path = pl_path.abspath("spec/fixtures/kong_spec.crt")
8+
9+
local DEFAULT_RESTY_FLAGS=string.format(" -c 4096 --http-conf 'lua_ssl_trusted_certificate %s;' ", cert_path)
10+
11+
if not os.getenv("KONG_BUSTED_RESPAWNED") then
12+
-- initial run, so go update the environment
13+
local script = {}
14+
for line in io.popen("set"):lines() do
15+
local ktvar, val = line:match("^KONG_TEST_([^=]*)=(.*)")
16+
if ktvar then
17+
-- reinserted KONG_TEST_xxx as KONG_xxx; append
18+
table.insert(script, "export KONG_" .. ktvar .. "=" ..val)
19+
end
20+
21+
local var = line:match("^(KONG_[^=]*)")
22+
local var_for_spec = line:match("^(KONG_SPEC_[^=]*)")
23+
if var and not var_for_spec then
24+
-- remove existing KONG_xxx and KONG_TEST_xxx variables; prepend
25+
table.insert(script, 1, "unset " .. var)
26+
end
27+
end
28+
-- add cli recursion detection
29+
table.insert(script, "export KONG_BUSTED_RESPAWNED=1")
30+
31+
-- XXX EE
32+
table.insert(script, "export KONG_IS_TESTING=1")
33+
34+
-- rebuild the invoked commandline, while inserting extra resty-flags
35+
local resty_flags = DEFAULT_RESTY_FLAGS
36+
local cmd = { "exec", "/usr/bin/env", "resty" }
37+
local cmd_prefix_count = #cmd
38+
for i = 0, #arg do
39+
if arg[i]:sub(1, 12) == "RESTY_FLAGS=" then
40+
resty_flags = arg[i]:sub(13, -1)
41+
42+
else
43+
table.insert(cmd, "'" .. arg[i] .. "'")
44+
end
45+
end
46+
47+
if resty_flags then
48+
table.insert(cmd, cmd_prefix_count+1, resty_flags)
49+
end
50+
51+
table.insert(script, table.concat(cmd, " "))
52+
53+
-- recurse cli command, with proper variables (un)set for clean testing
54+
local _, _, rc = os.execute(table.concat(script, "; "))
55+
os.exit(rc)
56+
end
57+
58+
pcall(require, "luarocks.loader")
59+
60+
require("kong.globalpatches")({
61+
cli = true,
62+
rbusted = true
63+
})
64+
65+
-- Busted command-line runner
66+
require 'busted.runner'({ standalone = false })
67+
68+
-- vim: set ft=lua ts=2 sw=2 sts=2 et :

0 commit comments

Comments
 (0)