Skip to content

Commit 75c6725

Browse files
Merge pull request #57 from stone-payments/feat/kong3
feat: Ensures compatibility with kong v3.0
2 parents 94c002f + 84b3c5d commit 75c6725

File tree

10 files changed

+64
-20
lines changed

10 files changed

+64
-20
lines changed

.azure-pipelines/pipeline.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ trigger:
77
- develop
88

99
pool:
10-
vmImage: 'ubuntu-18.04'
10+
vmImage: 'ubuntu-latest'
1111

1212
variables:
1313
plugin: 'url-rewrite'
@@ -18,21 +18,21 @@ stages:
1818
- job: Build
1919
steps:
2020
- bash: |
21-
sudo apt install -y lua5.3
22-
sudo apt install -y liblua5.3-dev
21+
sudo apt install -y lua5.1
22+
sudo apt install -y liblua5.1-dev
2323
2424
wget https://luarocks.org/releases/luarocks-3.3.1.tar.gz
2525
tar zxpf luarocks-3.3.1.tar.gz
26-
cd luarocks-3.3.1 && ./configure --with-lua-include=/usr/include/lua5.3 \
26+
cd luarocks-3.3.1 && ./configure --with-lua-include=/usr/include/lua5.1 \
2727
&& make && sudo make install
2828
cd .. && rm -rf luarocks-3.3.1 && rm luarocks-3.3.1.tar.gz
2929
displayName: Install Lua and Luarocks
3030
3131
- bash: |
3232
sudo apt install -y libssl-dev
33-
wget https://download.konghq.com/gateway-2.x-ubuntu-bionic/pool/all/k/kong/kong_2.6.0_amd64.deb
34-
sudo apt install -y ./kong_2.6.0_amd64.deb
35-
rm kong_2.6.0_amd64.deb
33+
wget https://download.konghq.com/gateway-3.x-ubuntu-bionic/pool/all/k/kong/kong_3.0.0_amd64.deb
34+
sudo apt install -y ./kong_3.0.0_amd64.deb
35+
rm kong_3.0.0_amd64.deb
3636
displayName: Install kong
3737
3838
- task: Bash@3

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @andremacdowell @brennogb @glauberatanaka @guih50 @henrique1996n1 @jonathanlazaro1 @leoferlopes @mauriciokb @Wuerike

.github/workflows/publish.yml

+14
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@ jobs:
1818
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
1919
- uses: actions/checkout@v2
2020

21+
- name: 'Create PR: Merge main into develop branch'
22+
id: create-develop-pull-request
23+
uses: thomaseizinger/[email protected]
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
with:
27+
head: main
28+
base: develop
29+
labels: develop
30+
title: Merge main into develop branch
31+
body: |
32+
This PR merges the main branch back into develop.
33+
This happens to ensure that the updates that happend on the release branch, i.e. CHANGELOG and manifest updates are also present on the develop branch.
34+
2135
- name: before install
2236
run: |
2337
sudo apt-get update

.standard-version/package-updater.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const capturingRegex = /VERSION = "(?<version>[\d.]*)"/;
2+
3+
module.exports.readVersion = function (contents) {
4+
const { version } = contents.match(capturingRegex).groups;
5+
return version;
6+
};
7+
8+
module.exports.writeVersion = function (contents, version) {
9+
const replacer = () => `VERSION = "${version}"`;
10+
11+
return contents.replace(capturingRegex, replacer);
12+
};

.versionrc.json

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
{
99
"filename": "Makefile",
1010
"updater": ".standard-version/makefile-updater.js"
11+
},
12+
{
13+
"filename": "url-rewrite/handler.lua",
14+
"updater": ".standard-version/package-updater.js"
1115
}
1216
]
1317
}

Dockerfile

+6-11
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
1-
FROM debian:stretch
1+
FROM ubuntu:22.04
22

33
RUN apt-get update -y
44

5-
RUN apt-get install -y \
6-
lua5.1 \
7-
liblua5.1-0-dev \
8-
luarocks \
9-
git \
10-
libssl1.0-dev \
11-
make
12-
5+
RUN apt update -y && apt install -y lua5.1 liblua5.1-dev build-essential wget git zip unzip
136
RUN git config --global url.https://github.com/.insteadOf git://github.com/
7+
RUN wget https://download.konghq.com/gateway-3.x-ubuntu-bionic/pool/all/k/kong/kong_3.0.0_amd64.deb &&\
8+
apt install -y ./kong_3.0.0_amd64.deb
149

1510
WORKDIR /home/plugin
1611

17-
ADD Makefile .
12+
COPY Makefile .
13+
COPY rockspec.template .
1814
RUN make setup
1915

20-
ADD kong-plugin-url-rewrite-*.rockspec .
2116
RUN chmod -R a+rw /home/plugin

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
DEV_ROCKS = "lua-cjson 2.1.0" "kong 2.6.0" "luacov 0.12.0" "busted 2.0.rc12" "luacov-cobertura 0.2-1" "luacheck 0.20.0"
1+
DEV_ROCKS = "https://raw.githubusercontent.com/openresty/lua-cjson/2.1.0.8/lua-cjson-2.1.0.6-1.rockspec" "kong 3.0.0" "luacov 0.12.0" "busted 2.0.rc12" "luacov-cobertura 0.2-1" "luacheck 0.20.0"
22
PROJECT_FOLDER = url-rewrite
33
LUA_PROJECT = kong-plugin-url-rewrite
44
VERSION = "1.1.1-0"

docker-compose.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: "3.8"
2+
3+
services:
4+
5+
kong:
6+
build:
7+
context: .
8+
dockerfile: Dockerfile
9+
stdin_open: true
10+
volumes:
11+
- ./${PROJECT_FOLDER}:/home/plugin
12+
ports:
13+
- "8001:8001"
14+
- "8000:8000"
15+
entrypoint: /bin/bash

rockspec.template

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package = "kong-plugin-url-rewrite"
22
version = "1.1.1-0"
33
source = {
44
url = "git://github.com/stone-payments/kong-plugin-url-rewrite",
5+
branch = "main",
6+
tag = "v1.1.1",
57
}
68
description = {
79
summary = "KongAPI Gateway middleware plugin for url-rewrite purposes.",

url-rewrite/handler.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
local URLRewriter = {
2-
PRIORITY = 700
2+
PRIORITY = 700,
3+
VERSION = "1.1.1"
34
}
45

56
function split(s, delimiter)

0 commit comments

Comments
 (0)