From 5e08dbe89023268d0174382002b602e727d6660d Mon Sep 17 00:00:00 2001 From: Steven Achilles Date: Thu, 13 Nov 2025 20:41:30 +0100 Subject: [PATCH 1/4] Add PostgreSQL client for v18 --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c1dcad3fc..945981934 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,7 +49,8 @@ RUN set -ex && \ && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ sudo supervisor logrotate locales curl \ nginx openssh-server redis-tools \ - postgresql-client-13 postgresql-client-14 postgresql-client-15 postgresql-client-16 postgresql-client-17 \ + postgresql-client-13 postgresql-client-14 postgresql-client-15 \ + postgresql-client-16 postgresql-client-17 postgresql-client-18 \ python3 python3-docutils nodejs yarn gettext-base graphicsmagick \ libpq5 zlib1g libyaml-dev libssl-dev libgdbm-dev libre2-dev \ libreadline-dev libncurses5-dev libffi-dev curl openssh-server libxml2-dev libxslt-dev \ From 7fb3576b600be793019d753ec7fa2ef12694d4a0 Mon Sep 17 00:00:00 2001 From: Steven Achilles Date: Thu, 13 Nov 2025 21:29:54 +0100 Subject: [PATCH 2/4] Remove postgresql-clients in versions before 16 --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 945981934..47a123b3e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,7 +49,6 @@ RUN set -ex && \ && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ sudo supervisor logrotate locales curl \ nginx openssh-server redis-tools \ - postgresql-client-13 postgresql-client-14 postgresql-client-15 \ postgresql-client-16 postgresql-client-17 postgresql-client-18 \ python3 python3-docutils nodejs yarn gettext-base graphicsmagick \ libpq5 zlib1g libyaml-dev libssl-dev libgdbm-dev libre2-dev \ From 8f86dbe71c71d0c0030268ddb6c77187cbbab2de Mon Sep 17 00:00:00 2001 From: KIMURA Kazunori Date: Fri, 14 Nov 2025 15:38:51 +0900 Subject: [PATCH 3/4] fix typo in comment in gitlab_generate_postgresqlrc() --- assets/runtime/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/runtime/functions b/assets/runtime/functions index d714f8c80..1c39b1ae2 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -196,7 +196,7 @@ gitlab_generate_postgresqlrc() { DB_CLIENT_VERSION_PACKAGE_NAME= if [[ "${DB_SERVER_VERSION_MAJOR}" -ge 10 ]]; then - # v10 or later: use "rought major version" as version number in package name + # v10 or later: use "rough major version" as version number in package name DB_CLIENT_VERSION_PACKAGE_NAME=${DB_SERVER_VERSION_MAJOR} else # prior to v10: convert From 14e2faa5bd98ec8d7f687d99ac82d29ebcf821b9 Mon Sep 17 00:00:00 2001 From: KIMURA Kazunori Date: Fri, 14 Nov 2025 16:18:22 +0900 Subject: [PATCH 4/4] Check if server side DB version met requirement --- Dockerfile | 5 ++++- assets/runtime/functions | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 47a123b3e..57ba1df73 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,10 @@ ENV GITLAB_VERSION=${VERSION} \ GITLAB_CACHE_DIR="/etc/docker-gitlab" \ RAILS_ENV=production \ NODE_ENV=production \ - NO_SOURCEMAPS=true + NO_SOURCEMAPS=true \ + # v18.5.2 : minimum = 16.5, maximum = 17.x (currently 17.6, is 170006) + POSTGRESQL_SERVER_REQUIRED_VERSION_MINIMUM=160005 \ + POSTGRESQL_SERVER_REQUIRED_VERSION_MAXIMUM=170100 ENV GITLAB_INSTALL_DIR="${GITLAB_HOME}/gitlab" \ GITLAB_SHELL_INSTALL_DIR="${GITLAB_HOME}/gitlab-shell" \ diff --git a/assets/runtime/functions b/assets/runtime/functions index 1c39b1ae2..6de9c4c3f 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -190,11 +190,23 @@ gitlab_generate_postgresqlrc() { echo "- Detected server version: ${DB_SERVER_VERSION}" + # remove leading zero (prior to 10.x it was like "090605" so that cannot treated as number) + DB_SERVER_VERSION="${DB_SERVER_VERSION##+(0)}" + # Anyway, we can get major version (8, 9, 10 and so on) by dividing by 10000. # DB_SERVER_VERSION_MAJOR=${DB_SERVER_VERSION%%.*} DB_SERVER_VERSION_MAJOR=$((DB_SERVER_VERSION/10000)) DB_CLIENT_VERSION_PACKAGE_NAME= + # Check version requirement + if [[ "${DB_SERVER_VERSION}" -lt "${POSTGRESQL_SERVER_REQUIRED_VERSION_MINIMUM}" + || "${DB_SERVER_VERSION}" -gt "${POSTGRESQL_SERVER_REQUIRED_VERSION_MAXIMUM}" + ]]; then + echo " Version requirement mismatch! (${POSTGRESQL_SERVER_REQUIRED_VERSION_MINIMUM} < ${DB_SERVER_VERSION} < ${POSTGRESQL_SERVER_REQUIRED_VERSION_MAXIMUM})" + echo " Aborting.." + return 1 + fi + if [[ "${DB_SERVER_VERSION_MAJOR}" -ge 10 ]]; then # v10 or later: use "rough major version" as version number in package name DB_CLIENT_VERSION_PACKAGE_NAME=${DB_SERVER_VERSION_MAJOR}