Skip to content
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

Use jq's IN() instead of index() #235

Merged
merged 1 commit into from
Oct 16, 2024
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
18 changes: 9 additions & 9 deletions Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ ENV HAPROXY_SHA256 {{ .sha256 }}
# Since 5.4 is supported on haproxy, better use it now, but only for
# newer versions since there could be some minor incompatibilities
# for existing scripts: https://www.lua.org/manual/5.4/manual.html#8
if ([ "2.2", "2.4", "2.6", "2.8" ] | index(env.version)) then
if env.version | IN("2.2", "2.4", "2.6", "2.8") then
"5.3"
else
"5.4"
Expand All @@ -81,7 +81,7 @@ RUN set -eux; \
pcre2-dev \
readline-dev \
tar \
{{ if ([ "2.2" ] | index(env.version)) then ( -}}
{{ if env.version == "2.2" then ( -}}
zlib-dev \
{{ ) else "" end -}}
; \
Expand All @@ -95,7 +95,7 @@ RUN set -eux; \
libssl-dev \
make \
wget \
{{ if ([ "2.2" ] | index(env.version)) then ( -}}
{{ if env.version == "2.2" then ( -}}
zlib1g-dev \
{{ ) else "" end -}}
; \
Expand All @@ -122,15 +122,15 @@ RUN set -eux; \
USE_LUA=1 LUA_INC=/usr/include/lua{{ lua }}{{ if env.variant == "alpine" then (" LUA_LIB=/usr/lib/lua" + lua) else "" end }} \
USE_OPENSSL=1 \
USE_PCRE2=1 USE_PCRE2_JIT=1 \
{{ if ([ "2.2" ] | index(env.version)) then ( -}}
{{ if env.version == "2.2" then ( -}}
USE_ZLIB=1 \
{{ ) else "" end -}}
{{ if ([ "2.2" ] | index(env.version) | not) then ( -}}
{{ if env.version == "2.2" then "" else ( -}}
USE_PROMEX=1 \
{{ ) else "" end -}}
{{ ) end -}}
\
EXTRA_OBJS=" \
{{ if [ "2.2" ] | index(env.version) then ( -}}
{{ if env.version == "2.2" then ( -}}
# see https://github.com/docker-library/haproxy/issues/94#issuecomment-505673353 for more details about prometheus support
contrib/prometheus-exporter/service-prometheus.o \
{{ ) else "" end -}}
Expand Down Expand Up @@ -188,12 +188,12 @@ RUN set -eux; \
STOPSIGNAL SIGUSR1

COPY docker-entrypoint.sh /usr/local/bin/
{{ if [ "2.2" ] | index(env.version) then ( -}}
{{ if env.version == "2.2" then ( -}}
RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat
{{ ) else "" end -}}
ENTRYPOINT ["docker-entrypoint.sh"]

{{ if [ "2.2" ] | index(env.version) then ( -}}
{{ if env.version == "2.2" then ( -}}
# no USER for backwards compatibility (to try to avoid breaking existing users)
{{ ) else ( -}}
USER haproxy
Expand Down
2 changes: 1 addition & 1 deletion versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ for version in "${versions[@]}"; do
alpine: env.alpine,
}
# remove Alpine from versions where it cannot be built on any active Alpine release
| if [ "2.2" ] | index(env.version) then del(.alpine) else . end
| if env.version == "2.2" then del(.alpine) else . end
'
)"

Expand Down
Loading