The tools necessary to build Kong
- Kong source
- Docker
- Make
This repository assumes it's the sibling repository of /kong
where the Kong source code you wish to
develop exists
cd ~
git clone [email protected]:Kong/kong.git
git clone [email protected]:Kong/kong-build-tools.git
cd kong-build-tools
make development
From the command line prompt available the Kong source is mounted at /src
all logs go to /src/servroot/*
The kong-plugin submodule is Kong plugin that is loaded and available as a template to base a Kong plugin off of
or clone your own plugin source into it and update KONG_PLUGINS
in the docker-compose.yml
file
The default build task builds an Ubuntu xenial package of Kong where the Kong source is assumed to be in a sibling directory to where this repository is cloned
cd ~
git clone [email protected]:Kong/kong.git
git clone [email protected]:Kong/kong-build-tools.git
cd kong-build-tools
make package-kong
ls output/
kong-0.0.0.xenial.all.deb
Environment variables:
You can find all available environment variables at the top of the Makefile. The most common ones are the following:
KONG_SOURCE_LOCATION=/src/projects/custom-kong-location
KONG_PACKAGE_NAME=custom-kong-name
KONG_VERSION=v1.0.0
RESTY_IMAGE_BASE=ubuntu|centos|rhel|debian|alpine|amazonlinux
RESTY_IMAGE_TAG=trusty|xenial|bionic|6|7|jessie|stretch|latest|latest
PACKAGE_TYPE=deb|rpm|apk
For RedHat additionally export:
export REDHAT_USERNAME=rhuser
export REDHAT_PASSWORD=password
Sometimes it's useful to have a docker image with the Kong asset installed that you just built.
export KONG_TEST_CONTAINER_NAME=kong:testing
make build_test_container
Prerequisites:
- Docker
- Minikube
- Helm
The above requirements can be installed via make setup_tests
if running Linux
make test
The Kong functional tests use (Tavern)[https://taverntesting.github.io/].
Prerequisites
- Docker
- A Packaged Kong Release (
make package-kong
) - K8s and helm (
make setup-tests
)
make test
Will run the functional tests against the defaults specified in the Makefile prefixed with TEST_
The available ENV's and their defaults are as follows
TEST_ADMIN_PROTOCOL?=http://
TEST_ADMIN_PORT?=8001
TEST_HOST?=localhost
TEST_ADMIN_URI?=$(TEST_ADMIN_PROTOCOL)$(TEST_HOST):$(TEST_ADMIN_PORT)
TEST_PROXY_PROTOCOL?=http://
TEST_PROXY_PORT?=8000
TEST_PROXY_URI?=$(TEST_PROXY_PROTOCOL)$(TEST_HOST):$(TEST_PROXY_PORT)
With the same prerequisites as running functional tests
make test
make develop_tests
py.test test_your_test.tavern.yaml # Expect warnings about https and structure different
The same defaults that applied when creating a packaged version of Kong apply to releasing said package to bintray and can be changed by environment variables. Presumes that the package you want to release already exists in the output directory.
export BINTRAY_USR=user
export BINTRAY_KEY=key
export RESTY_IMAGE_BASE=seeabove
export RESTY_IMAGE_TAG=seeabove
export KONG_PACKAGE_NAME=somename
export KONG_VERSION=1.2.3
make release-kong
Required release ENV variables:
BINTRAY_USR
BINTRAY_KEY
Required release ENV variables that have defaults if they are not set:
RESTY_IMAGE_BASE
RESTY_IMAGE_TAG
KONG_PACKAGE_NAME
KONG_VERSION
Optional release ENV variables:
REPOSITORY_TYPE
REPOSITORY_NAME
REPOSITORY_OS_NAME
The defaults when the optional arguments aren't passed are (in the following order ubuntu|rhel|centos|alpine):
REPOSITORY_TYPE=deb|deb|rpm|generic
REPOSITORY_NAME=$KONG_PACKAGE_NAME-$REPOSITORY_TYPE
REPOSITORY_OS_NAME=ubuntu|rhel|centos|alpine-tar
bintray.com/kong/$REPOSITORY_NAME/$REPOSITORY_OS_NAME/$KONG_VERSION/$KONG_PACKAGE_NAME-$KONG_VERSION.$OUTPUT_FILE_SUFFIX
Using all defaults one would end up with
bintray.com/kong/kong-deb/ubuntu/0.0.0/kong-0.0.0.xenial.all.deb