forked from PSheshenya/kong-plugin-jwt-keycloak
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
73 lines (52 loc) · 2.26 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
include makefiles/*.mk
REPOSITORY?=gbbirkisson
IMAGE?=kong-plugin-jwt-keycloak
KONG_VERSION?=1.4.0
FULL_IMAGE_NAME:=${REPOSITORY}/${IMAGE}:${KONG_VERSION}
PLUGIN_VERSION?=1.1.0-1
TEST_VERSIONS?=1.0.3 1.1.3 1.2.1 1.3.0 1.4.0
### Docker ###
build:
@echo "Building image ..."
docker build --pull -q -t ${FULL_IMAGE_NAME} --build-arg KONG_VERSION=${KONG_VERSION} --build-arg PLUGIN_VERSION=${PLUGIN_VERSION} .
run: build
docker run -it --rm ${FULL_IMAGE_NAME} kong start --vv
exec: build
docker run -it --rm ${FULL_IMAGE_NAME} ash
push: build test
docker push ${FULL_IMAGE_NAME}
### LuaRocks ###
upload:
luarocks upload kong-plugin-jwt-keycloak-${PLUGIN_VERSION}.rockspec --api-key=${API_KEY}
### Testing ###
start: kong-db-start kong-start
restart: kong-stop kong-start
restart-all: stop start
stop: kong-stop kong-db-stop
test-unit: keycloak-start
@echo ======================================================================
@echo "Running unit tests with kong version ${KONG_VERSION}"
@echo
@cd tests && $(MAKE) --no-print-directory _tests-unit PLUGIN_VERSION=${PLUGIN_VERSION} KONG_VERSION=${KONG_VERSION}
@echo
@echo "Unit tests passed with kong version ${KONG_VERSION}"
@echo ======================================================================
test-integration: restart-all sleep keycloak-start
@echo ======================================================================
@echo "Testing kong version ${KONG_VERSION} with ${KONG_DATABASE}"
@echo
@cd tests && $(MAKE) --no-print-directory _tests-integration PLUGIN_VERSION=${PLUGIN_VERSION}
@echo
@echo "Testing kong version ${KONG_VERSION} with ${KONG_DATABASE} was successful"
@echo ======================================================================
test: test-unit test-integration
test-all: keycloak-start
@echo "Starting integration tests for multiple versions"
@set -e; for t in $(TEST_VERSIONS); do \
$(MAKE) --no-print-directory test-unit PLUGIN_VERSION=${PLUGIN_VERSION} KONG_VERSION=$$t ; \
$(MAKE) --no-print-directory test-integration PLUGIN_VERSION=${PLUGIN_VERSION} KONG_VERSION=$$t KONG_DATABASE=postgres ; \
$(MAKE) --no-print-directory test-integration PLUGIN_VERSION=${PLUGIN_VERSION} KONG_VERSION=$$t KONG_DATABASE=cassandra ; \
done
@echo "All test successful"
sleep:
@sleep 5