Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

ci: Remove uses of VERSION_CODENAME.

Anders Kaseorgbf361e99517d
diff --git a/scripts/lib/zulip_tools.py b/scripts/lib/zulip_tools.py
index 294c5ee3492..4244b8bdeb5 100755
--- a/scripts/lib/zulip_tools.py
+++ b/scripts/lib/zulip_tools.py
@@ -412,8 +412,9 @@ def parse_os_release() -> Dict[str, str]:
'PRETTY_NAME': 'Ubuntu 18.04.3 LTS',
}
- VERSION_CODENAME (e.g. 'bionic') is nice and human-readable, but
- we avoid using it, as it is not available on RHEL-based platforms.
+ VERSION_CODENAME (e.g. 'bionic') is nice and readable to Ubuntu
+ developers, but we avoid using it, as it is not available on
+ RHEL-based platforms.
"""
distro_info = {} # type: Dict[str, str]
with open("/etc/os-release") as fp:
diff --git a/tools/ci/Dockerfile.prod.template b/tools/ci/Dockerfile.prod.template
index d4542652b88..10ad8f279b9 100644
--- a/tools/ci/Dockerfile.prod.template
+++ b/tools/ci/Dockerfile.prod.template
@@ -10,14 +10,9 @@ FROM {base_image}
RUN sudo rm -rf /var/lib/rabbitmq/mnesia/*
# The bionic hack used in production suite
-RUN if [ -f /etc/os-release ]; then \
- . /etc/os-release \
- && os_codename=$VERSION_CODENAME \
- && if [ "$os_codename" = "bionic" ]; then \
+RUN if (. /etc/os-release && [ "$ID $VERSION_ID" = 'ubuntu 18.04' ]); then \
sudo sed -i '/^bind/s/bind.*/bind 0.0.0.0/' /etc/redis/redis.conf; \
- fi; \
- fi
-
+ fi
# Download the release tarball, start rabbitmq server and install the server
RUN cd $(mktemp -d) \
diff --git a/tools/ci/production-install b/tools/ci/production-install
index 232494b22fc..e6fa8ddaf8f 100755
--- a/tools/ci/production-install
+++ b/tools/ci/production-install
@@ -65,9 +65,12 @@ if [ -f /etc/os-release ]; then
os_info="$(
. /etc/os-release
- printf '%s\n' "$VERSION_CODENAME"
+ printf '%s\n' "$ID" "$VERSION_ID"
)"
- { read -r os_version_codename || true; } <<<"$os_info"
+ {
+ read -r os_id
+ read -r os_version_id
+ } <<<"$os_info"
fi
if ! apt-get dist-upgrade -y "${APT_OPTIONS[@]}"; then
@@ -76,7 +79,7 @@ if ! apt-get dist-upgrade -y "${APT_OPTIONS[@]}"; then
fi
# Pin to PostgreSQL 10 on Bionic, so we can test upgrading it
-if [ "$os_version_codename" = "bionic" ]; then
+if [ "$os_id $os_version_id" = 'ubuntu 18.04' ]; then
export POSTGRESQL_VERSION=10
fi
@@ -89,7 +92,7 @@ else
"$ZULIP_PATH"/scripts/setup/install --self-signed-cert --hostname 127.0.0.1 --email [email protected] --postgresql-database-user zulipcustomuser --postgresql-database-name zulipcustomdb
fi
-if [ "$os_version_codename" = "bionic" ]; then
+if [ "$os_id $os_version_id" = 'ubuntu 18.04' ]; then
if [ "$(crudini --get /etc/zulip/zulip.conf postgresql version)" != "10" ]; then
echo "Installer did not install the PostgreSQL 10 that we asked for!"
exit 1
diff --git a/tools/ci/production-verify b/tools/ci/production-verify
index 406ea9c61e6..c14a5d1aa0c 100755
--- a/tools/ci/production-verify
+++ b/tools/ci/production-verify
@@ -12,13 +12,13 @@ NOREPLY_EMAIL_ADDRESS = '[email protected]'
ALLOWED_HOSTS = []
EOF
-if [ -f /etc/os-release ]; then
- os_info="$(
- . /etc/os-release
- printf '%s\n' "$VERSION_CODENAME"
- )"
- { read -r os_version_codename || true; } <<<"$os_info"
-fi
+os_info="$(
+ . /etc/os-release
+ printf '%s\n' "$ID"
+)"
+{
+ read -r os_id
+} <<<"$os_info"
check_header() {
sed -i -e 's|Length: [0-9]\+\( ([0-9.]\+K)\)\?|Length: <Length>|' -e "s|{nginx_version_string}|$nginx_version|g" "$success_header_file"
@@ -74,7 +74,7 @@ nginx_version="$(nginx -v 2>&1 | awk '{print $3, $4}' | xargs)"
# Simplify the diff by getting replacing 4-5 digit length numbers with <Length>.
sed -i 's|Length: [0-9]\+\( ([0-9.]\+K)\)\?|Length: <Length>|' /tmp/http-headers-processed
-if [ "$os_version_codename" = "buster" ] || [ "$os_version_codename" = "bullseye" ]; then
+if [ "$os_id" = debian ]; then
success_header_file="/tmp/success-http-headers.template.debian.txt"
check_header
else
diff --git a/tools/lib/provision.py b/tools/lib/provision.py
index e3cb0a043e7..b1bd48fd9b4 100755
--- a/tools/lib/provision.py
+++ b/tools/lib/provision.py
@@ -199,7 +199,7 @@ elif "debian" in os_families():
# additional dependency for postgresql-13-pgdg-pgroonga.
#
# See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895037
- if distro_info["VERSION_CODENAME"] == "bullseye":
+ if vendor == "debian" and os_version == "11":
DEBIAN_DEPENDECIES.remove("libappindicator1")
DEBIAN_DEPENDECIES.append("libgroonga0")