Reuse workflow CI (#10826)
* Reuse workflow CI * Simplify images Makefiles
This commit is contained in:
parent
00db204d86
commit
c9a3571556
39 changed files with 385 additions and 782 deletions
1
images/e2e-test-echo/EXTRAARGS
Normal file
1
images/e2e-test-echo/EXTRAARGS
Normal file
|
|
@ -0,0 +1 @@
|
|||
--build-arg LUAROCKS_VERSION=3.8.0 --build-arg LUAROCKS_SHA=ab6612ca9ab87c6984871d2712d05525775e8b50172701a0a1cabddf76de2be7
|
||||
1
images/e2e-test-echo/TAG
Normal file
1
images/e2e-test-echo/TAG
Normal file
|
|
@ -0,0 +1 @@
|
|||
v0.0.1
|
||||
20
images/e2e-test-echo/rootfs/Dockerfile
Normal file
20
images/e2e-test-echo/rootfs/Dockerfile
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
ARG BASE_IMAGE
|
||||
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
RUN apk update && apk upgrade && apk add -U --no-cache perl curl make unzip
|
||||
|
||||
ARG LUAROCKS_VERSION
|
||||
ARG LUAROCKS_SHA
|
||||
|
||||
RUN wget -O /tmp/luarocks.tgz \
|
||||
https://github.com/luarocks/luarocks/archive/v${LUAROCKS_VERSION}.tar.gz \
|
||||
&& echo "${LUAROCKS_SHA} */tmp/luarocks.tgz" | sha256sum -c - \
|
||||
&& tar -C /tmp -xzf /tmp/luarocks.tgz \
|
||||
&& cd /tmp/luarocks* \
|
||||
&& ./configure \
|
||||
&& make install
|
||||
|
||||
RUN luarocks install lua-resty-template
|
||||
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
91
images/e2e-test-echo/rootfs/nginx.conf
Normal file
91
images/e2e-test-echo/rootfs/nginx.conf
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
env HOSTNAME;
|
||||
env NODE_NAME;
|
||||
env POD_NAME;
|
||||
env POD_NAMESPACE;
|
||||
env POD_IP;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
default_type 'text/plain';
|
||||
client_max_body_size 0;
|
||||
|
||||
init_by_lua_block {
|
||||
local template = require "resty.template"
|
||||
|
||||
tmpl = template.compile([[
|
||||
|
||||
Hostname: {*os.getenv("HOSTNAME") or "N/A"*}
|
||||
|
||||
Pod Information:
|
||||
{% if os.getenv("POD_NAME") then %}
|
||||
node name: {*os.getenv("NODE_NAME") or "N/A"*}
|
||||
pod name: {*os.getenv("POD_NAME") or "N/A"*}
|
||||
pod namespace: {*os.getenv("POD_NAMESPACE") or "N/A"*}
|
||||
pod IP: {*os.getenv("POD_IP") or "N/A"*}
|
||||
{% else %}
|
||||
-no pod information available-
|
||||
{% end %}
|
||||
|
||||
Server values:
|
||||
server_version=nginx: {*ngx.var.nginx_version*} - lua: {*ngx.config.ngx_lua_version*}
|
||||
|
||||
Request Information:
|
||||
client_address={*ngx.var.remote_addr*}
|
||||
method={*ngx.req.get_method()*}
|
||||
real path={*ngx.var.request_uri*}
|
||||
query={*ngx.var.query_string or ""*}
|
||||
request_version={*ngx.req.http_version()*}
|
||||
request_scheme={*ngx.var.scheme*}
|
||||
request_uri={*ngx.var.scheme.."://"..ngx.var.host..":"..ngx.var.server_port..ngx.var.request_uri*}
|
||||
|
||||
Request Headers:
|
||||
{% for i, key in ipairs(keys) do %}
|
||||
{% local val = headers[key] %}
|
||||
{% if type(val) == "table" then %}
|
||||
{% for i = 1,#val do %}
|
||||
{*key*}={*val[i]*}
|
||||
{% end %}
|
||||
{% else %}
|
||||
{*key*}={*val*}
|
||||
{% end %}
|
||||
{% end %}
|
||||
|
||||
Request Body:
|
||||
{*ngx.var.request_body or " -no body in request-"*}
|
||||
]])
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80 default_server reuseport;
|
||||
|
||||
server_name _;
|
||||
|
||||
keepalive_timeout 620s;
|
||||
|
||||
location / {
|
||||
lua_need_request_body on;
|
||||
|
||||
header_filter_by_lua_block {
|
||||
if ngx.var.arg_hsts == "true" then
|
||||
ngx.header["Strict-Transport-Security"] = "max-age=3600; preload"
|
||||
end
|
||||
}
|
||||
|
||||
content_by_lua_block {
|
||||
ngx.header["Server"] = "echoserver"
|
||||
|
||||
local headers = ngx.req.get_headers()
|
||||
local keys = {}
|
||||
for key, val in pairs(headers) do
|
||||
table.insert(keys, key)
|
||||
end
|
||||
table.sort(keys)
|
||||
|
||||
ngx.say(tmpl({os=os, ngx=ngx, keys=keys, headers=headers}))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue