Skip to content

feat: Ensures compatibility with kong v3.0 #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .azure-pipelines/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ trigger:
- develop

pool:
vmImage: 'ubuntu-18.04'
vmImage: 'ubuntu-latest'

variables:
plugin: 'url-rewrite'
Expand All @@ -18,21 +18,21 @@ stages:
- job: Build
steps:
- bash: |
sudo apt install -y lua5.3
sudo apt install -y liblua5.3-dev
sudo apt install -y lua5.1
sudo apt install -y liblua5.1-dev

wget https://luarocks.org/releases/luarocks-3.3.1.tar.gz
tar zxpf luarocks-3.3.1.tar.gz
cd luarocks-3.3.1 && ./configure --with-lua-include=/usr/include/lua5.3 \
cd luarocks-3.3.1 && ./configure --with-lua-include=/usr/include/lua5.1 \
&& make && sudo make install
cd .. && rm -rf luarocks-3.3.1 && rm luarocks-3.3.1.tar.gz
displayName: Install Lua and Luarocks

- bash: |
sudo apt install -y libssl-dev
wget https://download.konghq.com/gateway-2.x-ubuntu-bionic/pool/all/k/kong/kong_2.6.0_amd64.deb
sudo apt install -y ./kong_2.6.0_amd64.deb
rm kong_2.6.0_amd64.deb
wget https://download.konghq.com/gateway-3.x-ubuntu-bionic/pool/all/k/kong/kong_3.0.0_amd64.deb
sudo apt install -y ./kong_3.0.0_amd64.deb
rm kong_3.0.0_amd64.deb
displayName: Install kong

- task: Bash@3
Expand Down
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @andremacdowell @brennogb @glauberatanaka @guih50 @henrique1996n1 @jonathanlazaro1 @leoferlopes @mauriciokb @Wuerike
14 changes: 14 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: 'Create PR: Merge main into develop branch'
id: create-develop-pull-request
uses: thomaseizinger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
head: main
base: develop
labels: develop
title: Merge main into develop branch
body: |
This PR merges the main branch back into develop.
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.

- name: before install
run: |
sudo apt-get update
Expand Down
12 changes: 12 additions & 0 deletions .standard-version/package-updater.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const capturingRegex = /VERSION = "(?<version>[\d.]*)"/;

module.exports.readVersion = function (contents) {
const { version } = contents.match(capturingRegex).groups;
return version;
};

module.exports.writeVersion = function (contents, version) {
const replacer = () => `VERSION = "${version}"`;

return contents.replace(capturingRegex, replacer);
};
4 changes: 4 additions & 0 deletions .versionrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
{
"filename": "Makefile",
"updater": ".standard-version/makefile-updater.js"
},
{
"filename": "url-rewrite/handler.lua",
"updater": ".standard-version/package-updater.js"
}
]
}
17 changes: 6 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
FROM debian:stretch
FROM ubuntu:22.04

RUN apt-get update -y

RUN apt-get install -y \
lua5.1 \
liblua5.1-0-dev \
luarocks \
git \
libssl1.0-dev \
make

RUN apt update -y && apt install -y lua5.1 liblua5.1-dev build-essential wget git zip unzip
RUN git config --global url.https://github.com/.insteadOf git://github.com/
RUN wget https://download.konghq.com/gateway-3.x-ubuntu-bionic/pool/all/k/kong/kong_3.0.0_amd64.deb &&\
apt install -y ./kong_3.0.0_amd64.deb

WORKDIR /home/plugin

ADD Makefile .
COPY Makefile .
COPY rockspec.template .
RUN make setup

ADD kong-plugin-url-rewrite-*.rockspec .
RUN chmod -R a+rw /home/plugin
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
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"
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"
PROJECT_FOLDER = url-rewrite
LUA_PROJECT = kong-plugin-url-rewrite
VERSION = "1.1.1-0"
Expand Down
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "3.8"

services:

kong:
build:
context: .
dockerfile: Dockerfile
stdin_open: true
volumes:
- ./${PROJECT_FOLDER}:/home/plugin
ports:
- "8001:8001"
- "8000:8000"
entrypoint: /bin/bash
2 changes: 2 additions & 0 deletions rockspec.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package = "kong-plugin-url-rewrite"
version = "1.1.1-0"
source = {
url = "git://github.com/stone-payments/kong-plugin-url-rewrite",
branch = "main",
tag = "v1.1.1",
}
description = {
summary = "KongAPI Gateway middleware plugin for url-rewrite purposes.",
Expand Down
3 changes: 2 additions & 1 deletion url-rewrite/handler.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local URLRewriter = {
PRIORITY = 700
PRIORITY = 700,
VERSION = "1.1.1"
}

function split(s, delimiter)
Expand Down