Skip to content

Commit 025a6cf

Browse files
committed
fix: improve fetch_postgres_image_version() regexp
Signed-off-by: Niccolò Fei <[email protected]>
1 parent 40e39a8 commit 025a6cf

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/repo_funcs.sh

+8-2
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,17 @@ POSTGRESQL_LATEST_MAJOR_RELEASE=16
2020

2121
# Get the last postgres base image tag and update time
2222
fetch_postgres_image_version() {
23-
local suite="$1"; shift
23+
local version="$1"; shift
2424
local distro="$1"; shift
2525
local item="$1"; shift
26+
27+
regexp="^${version}\\.[0-9]+-${distro}$"
28+
if [[ ${version} -gt "${POSTGRESQL_LATEST_MAJOR_RELEASE}" ]]; then
29+
regexp="^${version}beta[0-9]+-${distro}$"
30+
fi
31+
2632
curl -SsL "https://registry.hub.docker.com/v2/repositories/library/postgres/tags/?name=${distro}&ordering=last_updated&page_size=50" | \
27-
jq -c ".results[] | select( .name | match(\"^${suite}.[a-z0-9]+-${distro}$\"))" | \
33+
jq --arg regexp "$regexp" -c '.results[] | select( .name | match($regexp))' | \
2834
jq -r ".${item}" | \
2935
head -n1
3036
}

0 commit comments

Comments
 (0)