Skip to content
This repository was archived by the owner on Jan 11, 2025. It is now read-only.

Commit 1b50d74

Browse files
linting
1 parent 207f93f commit 1b50d74

20 files changed

+84
-101
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+13-11
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
22
name: Bug report
33
about: Create a report to help us improve
4-
title: ''
5-
labels: ''
6-
assignees: ''
7-
4+
title: ""
5+
labels: ""
6+
assignees: ""
87
---
98

109
**Describe the bug**
1110
A clear and concise description of what the bug is.
1211

1312
**To Reproduce**
1413
Steps to reproduce the behavior:
14+
1515
1. Go to '...'
1616
2. Click on '....'
1717
3. Scroll down to '....'
@@ -24,15 +24,17 @@ A clear and concise description of what you expected to happen.
2424
If applicable, add screenshots to help explain your problem.
2525

2626
**Desktop (please complete the following information):**
27-
- OS: [e.g. iOS]
28-
- Browser [e.g. chrome, safari]
29-
- Version [e.g. 22]
27+
28+
- OS: [e.g. iOS]
29+
- Browser [e.g. chrome, safari]
30+
- Version [e.g. 22]
3031

3132
**Smartphone (please complete the following information):**
32-
- Device: [e.g. iPhone6]
33-
- OS: [e.g. iOS8.1]
34-
- Browser [e.g. stock browser, safari]
35-
- Version [e.g. 22]
33+
34+
- Device: [e.g. iPhone6]
35+
- OS: [e.g. iOS8.1]
36+
- Browser [e.g. stock browser, safari]
37+
- Version [e.g. 22]
3638

3739
**Additional context**
3840
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/feature_request.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
name: Feature request
33
about: Suggest an idea for this project
4-
title: ''
5-
labels: ''
6-
assignees: ''
7-
4+
title: ""
5+
labels: ""
6+
assignees: ""
87
---
98

109
**Is your feature request related to a problem? Please describe.**
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
ignored:
22
- DL3008 # Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
3-
- DL3018 # Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
3+
- DL3018 # Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`

README.md

+12-11
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,20 @@ Lua is a lightweight, high-level, multi-paradigm programming language designed p
8686

8787
> Just to name a few:
8888
>
89-
> * Mashup'ing and processing outputs of various Nginx upstream outputs (proxy, drizzle, postgres, redis, memcached, and etc) in Lua,
90-
> * doing arbitrarily complex access control and security checks in Lua before requests actually reach the upstream backends,
91-
> * manipulating response headers in an arbitrary way (by Lua)
92-
> * fetching backend information from external storage backends (like redis, memcached, mysql, postgresql) and use that information to choose which upstream backend to access on-the-fly,
93-
> * coding up arbitrarily complex web applications in a content handler using synchronous but still non-blocking access to the database backends and other > storage,
94-
> * doing very complex URL dispatch in Lua at rewrite phase,
95-
> * using Lua to implement advanced caching mechanism for Nginx's subrequests and arbitrary locations.
96-
>
89+
> - Mashup'ing and processing outputs of various Nginx upstream outputs (proxy, drizzle, postgres, redis, memcached, and etc) in Lua,
90+
> - doing arbitrarily complex access control and security checks in Lua before requests actually reach the upstream backends,
91+
> - manipulating response headers in an arbitrary way (by Lua)
92+
> - fetching backend information from external storage backends (like redis, memcached, mysql, postgresql) and use that information to choose which upstream backend to access on-the-fly,
93+
> - coding up arbitrarily complex web applications in a content handler using synchronous but still non-blocking access to the database backends and other > storage,
94+
> - doing very complex URL dispatch in Lua at rewrite phase,
95+
> - using Lua to implement advanced caching mechanism for Nginx's subrequests and arbitrary locations.
96+
>
9797
> The possibilities are unlimited as the module allows bringing together various
9898
> elements within Nginx as well as exposing the power of the Lua language to the
9999
> user. The module provides the full flexibility of scripting while offering
100100
> performance levels comparable with native C language programs both in terms of
101101
> CPU time as well as memory footprint thanks to LuaJIT 2.x.
102-
>
102+
>
103103
> Other scripting language implementations typically struggle to match this
104104
> performance level.
105105
>
@@ -183,17 +183,18 @@ web:
183183
By default, this function reads template files in `/etc/nginx/templates/*.template` and outputs the result of executing `envsubst` to `/etc/nginx/conf.d`.
184184
So if you place `templates/default.conf.template` file, which contains variable references like this:
185185

186-
```
186+
```nginx
187187
listen ${NGINX_PORT};
188188
```
189189

190190
outputs to `/etc/nginx/conf.d/default.conf` like this:
191191

192-
```
192+
```nginx
193193
listen 80;
194194
```
195195

196196
This behavior can be changed via the following environment variables:
197+
197198
- `NGINX_ENVSUBST_TEMPLATE_DIR`
198199
- A directory which contains template files (default: `/etc/nginx/templates`)
199200
- When this directory doesn't exist, this function will do nothing about template processing.

bin/_common.sh

+15-15
Original file line numberDiff line numberDiff line change
@@ -49,48 +49,48 @@ function loop_over_nginx() {
4949

5050
LEN_VER_NGINX=${#NGINX[@]}
5151
for (( I=0; I<LEN_VER_NGINX; I++ )); do
52-
NGINX_VER="${NGINX[$I]}"
52+
export NGINX_VER="${NGINX[$I]}"
5353

54-
LAST_VER_NGINX=0
54+
export LAST_VER_NGINX=0
5555
if [ "$((I+1))" == "$LEN_VER_NGINX" ]; then
56-
LAST_VER_NGINX=1
56+
export LAST_VER_NGINX=1
5757
fi
5858

5959
# Default image is Alpine
60-
DEFAULT_IMAGE=1
61-
OS=alpine
60+
export DEFAULT_IMAGE=1
61+
export OS=alpine
6262
loop_over_os "$OS" "$FUNC"
63-
DEFAULT_IMAGE=0
63+
export DEFAULT_IMAGE=0
6464

65-
OS=amazonlinux
65+
export OS=amazonlinux
6666
loop_over_os "$OS" "$FUNC"
6767

68-
OS=centos
68+
export OS=centos
6969
loop_over_os "$OS" "$FUNC"
7070

71-
OS=debian
71+
export OS=debian
7272
loop_over_os "$OS" "$FUNC"
7373

74-
OS=fedora
74+
export OS=fedora
7575
loop_over_os "$OS" "$FUNC"
7676

77-
OS=ubuntu
77+
export OS=ubuntu
7878
loop_over_os "$OS" "$FUNC"
7979

8080
done
8181
}
8282

8383
function loop_over_os() {
84-
VERSIONS=($(get_versions "$OS"))
84+
mapfile -t VERSIONS < <(get_versions "$OS")
8585
FUNC=$2
8686

8787
LEN_VER_OS=${#VERSIONS[@]}
8888
for (( J=0; J<LEN_VER_OS; J++ )); do
89-
OS_VER="${VERSIONS[$J]}";
89+
export OS_VER="${VERSIONS[$J]}";
9090

91-
LAST_VER_OS=0
91+
export LAST_VER_OS=0
9292
if [ "$((J+1))" == "$LEN_VER_OS" ]; then
93-
LAST_VER_OS=1
93+
export LAST_VER_OS=1
9494
fi
9595

9696
${FUNC};

bin/docker-build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ EXTENDED_IMAGE=1
6767
if [ "$2" == "0" ]; then
6868
EXTENDED_IMAGE=0
6969
fi
70-
VERSIONS=($(get_versions "$OS"))
70+
mapfile -t VERSIONS < <(get_versions "$OS")
7171

7272
loop_over_nginx_with_os "$OS" "build"
7373

bin/docker-metadata.sh

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ source ./bin/_common.sh
55
source supported_versions
66

77
function metadata() {
8-
MAJOR=$(echo "$NGINX_VER" | cut -d '.' -f 1)
9-
MINOR="$MAJOR".$(echo "$NGINX_VER" | cut -d '.' -f 2)
108
PATCH="$NGINX_VER"
119

1210
if [ "$FORCE" == "0" ]; then
@@ -15,7 +13,8 @@ function metadata() {
1513
fi
1614
fi
1715

18-
if [ $(docker image ls -q fabiocicerchia/nginx-lua:"$PATCH-$OS$OS_VER" | wc -l) -ne 0 ]; then
16+
IMG_EXISTS=$(docker image ls -q fabiocicerchia/nginx-lua:"$PATCH-$OS$OS_VER" | wc -l)
17+
if [ $IMG_EXISTS -ne 0 ]; then
1918
echo -e "# fabiocicerchia/nginx-lua:$PATCH-$OS$OS_VER\n" > "docs/metadata/$PATCH-$OS$OS_VER.md"
2019
echo '```json' >> "docs/metadata/$PATCH-$OS$OS_VER.md"
2120
docker image inspect "fabiocicerchia/nginx-lua:$PATCH-$OS$OS_VER" >> "docs/metadata/$PATCH-$OS$OS_VER.md"
@@ -30,6 +29,6 @@ FORCE=0
3029
if [ "$2" == "1" ]; then
3130
FORCE=1
3231
fi
33-
VERSIONS=($(get_versions "$OS"))
32+
mapfile -t VERSIONS < <(get_versions "$OS")
3433

3534
loop_over_nginx_with_os "$OS" "metadata"

bin/docker-push.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ source supported_versions
66

77
function docker_push() {
88
TAG=$1
9-
docker push fabiocicerchia/nginx-lua:$TAG
10-
if [ $? -ne 0 ]; then
11-
docker push fabiocicerchia/nginx-lua:$TAG
9+
EXITCODE=$(docker push fabiocicerchia/nginx-lua:"$TAG"; echo $?)
10+
if [ $EXITCODE -ne 0 ]; then
11+
docker push fabiocicerchia/nginx-lua:"$TAG"
1212
fi
1313
}
1414

@@ -53,6 +53,6 @@ FORCE=0
5353
if [ "$2" == "1" ]; then
5454
FORCE=1
5555
fi
56-
VERSIONS=($(get_versions "$OS"))
56+
mapfile -t VERSIONS < <(get_versions "$OS")
5757

5858
loop_over_nginx_with_os "$OS" "push"

bin/generate-dockerfiles.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ loop_over_nginx "init_dockerfile"
3030

3131
rm ./Dockerfile
3232
DOCKEFILE=$(find nginx/*/alpine/*/Dockerfile -type f | sort -r | head -n1)
33-
ln -s $DOCKEFILE ./Dockerfile
33+
ln -s "$DOCKEFILE" ./Dockerfile

bin/generate-supported-versions.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ fetch_latest() {
88
FILTER=".+"
99
fi
1010
DIGEST=$(wget -q "https://hub.docker.com/v2/repositories/library/$DISTRO/tags/latest" -O - | jq -rc '.images[] | select( .architecture == "amd64") | .digest')
11-
wget -q "https://hub.docker.com/v2/repositories/library/$DISTRO/tags" -O - > /tmp/latest.$DISTRO.p1
12-
VER=$(cat /tmp/latest.$DISTRO.p1 | jq -rc '.results[] | select( .images[].digest == "'$DIGEST'" and .name != "latest" ) | .name' | grep -E "$FILTER" | sort -Vr | head -n 1)
11+
wget -q "https://hub.docker.com/v2/repositories/library/$DISTRO/tags" -O - > "/tmp/latest.$DISTRO.p1"
12+
VER=$(cat "/tmp/latest.$DISTRO.p1" | jq -rc '.results[] | select( .images[].digest == "'$DIGEST'" and .name != "latest" ) | .name' | grep -E "$FILTER" | sort -Vr | head -n 1)
1313

1414
PAGE=2
15-
while [ "$VER" = "" -a $PAGE -lt 100 ]; do
16-
wget -q "https://hub.docker.com/v2/repositories/library/$DISTRO/tags?page=$PAGE" -O - > /tmp/latest.$DISTRO.p$PAGE
17-
VER=$(cat /tmp/latest.$DISTRO.p$PAGE | jq -rc '.results[] | select( .images[].digest == "'$DIGEST'" and .name != "latest" ) | .name' | grep -E "$FILTER" | sort -Vr | head -n 1)
15+
while [ "$VER" = "" ] && [ $PAGE -lt 100 ]; do
16+
wget -q "https://hub.docker.com/v2/repositories/library/$DISTRO/tags?page=$PAGE" -O - > "/tmp/latest.$DISTRO.p$PAGE"
17+
VER=$(cat "/tmp/latest.$DISTRO.p$PAGE" | jq -rc '.results[] | select( .images[].digest == "'$DIGEST'" and .name != "latest" ) | .name' | grep -E "$FILTER" | sort -Vr | head -n 1)
1818
((PAGE+=1))
1919
done
2020

21-
echo $VER
21+
echo "$VER"
2222
}
2323

2424
set -eux
@@ -110,4 +110,4 @@ echo "UBUNTU=(\"${UBUNTU[*]}\")" | sed 's/ /" "/g' >> supported_versions
110110

111111
DIFF=$(diff supported_versions supported_versions.bak; echo $?)
112112
rm supported_versions.bak
113-
exit $DIFF
113+
exit "$DIFF"

bin/generate_tags.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
pieces = re.search("nginx/(.+)/(.+)/(.+)/Dockerfile", file)
1414

1515
nginxVer, os, osVer = pieces.group(1, 2, 3)
16-
nginxVerPieces = re.split("\.", nginxVer)
16+
nginxVerPieces = re.split(r"\.", nginxVer)
1717
nginxVerMajor, nginxVerMinor, nginxVerPatch = nginxVerPieces
1818

1919
# tags[os] = file # currently missing

bin/test-lint.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function lint() {
1212

1313
docker run --rm -i \
1414
-v "$PWD"/"$DOCKERFILE":/tmp/Dockerfile \
15-
-v "$PWD"/.hadolint.yml:/tmp/.hadolint.yml \
15+
-v "$PWD"/.github/linters/.hadolint.yml:/tmp/.hadolint.yml \
1616
hadolint/hadolint \
1717
hadolint -c /tmp/.hadolint.yml /tmp/Dockerfile || true
1818
}

bin/test-security.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function runtest() {
2727
set -eux
2828

2929
OS=$1
30-
VERSIONS=($(get_versions "$OS"))
30+
mapfile -t VERSIONS < <(get_versions "$OS")
3131

3232
docker run -it --net host --pid host --userns host --cap-add audit_control \
3333
-v /etc:/etc \

docs/CONTRIBUTING.md

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# CONTRIBUTING
2+
13
Please take a moment to review this document in order to make the contribution
24
process easy and effective for everyone involved.
35

@@ -8,15 +10,13 @@ changes, and helping you finalize your pull requests.
810

911
## Using the issue tracker
1012

11-
The issue tracker is the preferred channel for [bug reports](#bugs),
12-
[features requests](#features) and [submitting pull
13+
The issue tracker is the preferred channel for [bug reports](#bug-reports),
14+
[features requests](#features-requests) and [submitting pull
1315
requests](#pull-requests), but please respect the following restrictions:
1416

1517
- Please **do not** derail or troll issues. Keep the discussion on topic and
1618
respect the opinions of others.
1719

18-
<a name="bugs"></a>
19-
2020
## Bug reports
2121

2222
A bug is a _demonstrable problem_ that is caused by the code in the repository.
@@ -57,17 +57,13 @@ Example:
5757
> causing the bug, and potential solutions (and your opinions on their
5858
> merits).
5959
60-
<a name="features"></a>
61-
6260
## Feature requests
6361

6462
Feature requests are welcome. But take a moment to find out whether your idea
6563
fits with the scope and aims of the project. It's up to _you_ to make a strong
6664
case to convince the project's developers of the merits of this feature. Please
6765
provide as much detail and context as possible.
6866

69-
<a name="pull-requests"></a>
70-
7167
## Pull requests
7268

7369
Good pull requests - patches, improvements, new features - are a fantastic
@@ -144,8 +140,6 @@ included in the project:
144140
**IMPORTANT**: By submitting a patch, you agree to license your work under the
145141
same license as that used by the project.
146142

147-
<a name="maintainers"></a>
148-
149143
## Maintainers
150144

151145
If you have commit access, please follow this process for merging patches and cutting new releases.

tpl/Dockerfile.alpine

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#############################
22
# Settings Common Variables #
33
#############################
4-
FROM {{DOCKER_IMAGE_OS}}:{{DOCKER_IMAGE_TAG}} AS base
5-
64
ARG DOCKER_IMAGE={{DOCKER_IMAGE}}
75
ENV DOCKER_IMAGE=$DOCKER_IMAGE
86
ARG DOCKER_IMAGE_OS={{DOCKER_IMAGE_OS}}
@@ -205,7 +203,7 @@ ENV NGINX_BUILD_DEPS=$NGINX_BUILD_DEPS
205203
####################################
206204
# Build Nginx with support for LUA #
207205
####################################
208-
FROM base AS builder
206+
FROM {{DOCKER_IMAGE_OS}}:{{DOCKER_IMAGE_TAG}} AS builder
209207

210208
COPY tpl/Makefile Makefile
211209

@@ -227,7 +225,7 @@ RUN set -eux \
227225
##########################################
228226
# Combine everything with minimal layers #
229227
##########################################
230-
FROM base
228+
FROM {{DOCKER_IMAGE_OS}}:{{DOCKER_IMAGE_TAG}}
231229

232230
# http://label-schema.org/rc1/
233231
LABEL maintainer="Fabio Cicerchia <[email protected]>" \

0 commit comments

Comments
 (0)