From 9b82ba25fd7621279872aab2701818e187d14f80 Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Wed, 28 Jan 2026 00:13:16 +0300 Subject: [PATCH 1/2] [CI] AstraLinux 1.7 is tested It has python 3.7.3. run_tests.sh upgrades pip, setuptools and wheel before his work. --- .github/workflows/package-verification.yml | 3 + Dockerfile--astralinux_1_7.tmpl | 112 +++++++++++++++++++++ README.md | 2 +- run_tests.sh | 1 + 4 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 Dockerfile--astralinux_1_7.tmpl diff --git a/.github/workflows/package-verification.yml b/.github/workflows/package-verification.yml index 9eed6f2f..0c51a228 100644 --- a/.github/workflows/package-verification.yml +++ b/.github/workflows/package-verification.yml @@ -102,6 +102,9 @@ jobs: - platform: "altlinux_11" python: "3" postgres: "17" + - platform: "astralinux_1_7" + python: "3" + postgres: "17" steps: - name: Prepare variables diff --git a/Dockerfile--astralinux_1_7.tmpl b/Dockerfile--astralinux_1_7.tmpl new file mode 100644 index 00000000..a89bced6 --- /dev/null +++ b/Dockerfile--astralinux_1_7.tmpl @@ -0,0 +1,112 @@ +ARG PG_VERSION +ARG PYTHON_VERSION + +# --------------------------------------------- base1 +FROM packpack/packpack:astra-1.7 as base1 + +RUN apt update +RUN apt install -y sudo curl ca-certificates +RUN apt update +RUN apt install -y openssh-server +RUN apt install -y time +# RUN apt install -y netcat-traditional + +RUN apt install -y git + +# --------------------------------------------- postgres +FROM base1 as base1_with_dev_tools + +RUN apt-get update + +RUN apt-get install -y git +RUN apt-get install -y gcc +RUN apt-get install -y make + +RUN apt-get install -y meson +RUN apt-get install -y flex +RUN apt-get install -y bison + +RUN apt-get install -y pkg-config +RUN apt-get install -y libssl-dev +RUN apt-get install -y libicu-dev +RUN apt-get install -y libzstd-dev +RUN apt-get install -y zlib1g-dev +RUN apt-get install -y liblz4-dev +RUN apt-get install -y libzstd-dev +RUN apt-get install -y libxml2-dev + +# --------------------------------------------- postgres +FROM base1_with_dev_tools as base1_with_pg-17 + +RUN curl -fsSL https://ftp.postgresql.org/pub/source/v17.7/postgresql-17.7.tar.bz2 -o postgresql.tar.bz2 \ + && mkdir -p /pg/postgres/source \ + && tar -xjf postgresql.tar.bz2 -C /pg/postgres/source --strip-components=1 \ + && rm postgresql.tar.bz2 + +WORKDIR /pg/postgres/source + +RUN ./configure --prefix=/pg/postgres/install --with-zlib --with-openssl --without-readline --with-lz4 --with-zstd --with-libxml +RUN make -j 4 install +RUN make -j 4 -C contrib install + +# SETUP PG_CONFIG +# When pg_config symlink in /usr/local/bin it returns a real (right) result of --bindir +RUN ln -s /pg/postgres/install/bin/pg_config -t /usr/local/bin + +# SETUP PG CLIENT LIBRARY +# libpq.so.5 is enough +RUN ln -s /pg/postgres/install/lib/libpq.so.5.17 /usr/lib/libpq.so.5 + +# --------------------------------------------- base2_with_python-3 +FROM base1_with_pg-${PG_VERSION} as base2_with_python-3 +RUN apt install -y python3 python3-dev python3-venv + +ENV PYTHON_BINARY=python3 + +# --------------------------------------------- final +FROM base2_with_python-${PYTHON_VERSION} as final + +EXPOSE 22 + +RUN ssh-keygen -A + +RUN useradd -m test + +# It enables execution of "sudo service ssh start" without password +# MY OLD: +# RUN sh -c "echo test ALL=NOPASSWD:ALL" >> /etc/sudoers +# AI: +RUN echo "test ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers + +# THIS CMD IS NEEDED TO CONNECT THROUGH SSH WITHOUT PASSWORD +RUN sh -c "echo "test:*" | chpasswd -e" +RUN sed -i 's/UsePAM yes/UsePAM no/' /etc/ssh/sshd_config + +ADD --chown=test:test . /home/test/testgres +WORKDIR /home/test/testgres +RUN mkdir /home/test/testgres/logs +RUN chown -R test:test /home/test/testgres/logs + +ENV LANG=C.UTF-8 + +USER test + +RUN chmod 700 ~/ +RUN mkdir -p ~/.ssh +RUN chmod 700 ~/.ssh + +ENTRYPOINT sh -c " \ +set -eux; \ +echo HELLO FROM ENTRYPOINT; \ +echo HOME DIR IS [`realpath ~/`]; \ +ls -la .; \ +sudo service ssh start; \ +sudo chmod 777 /home/test/testgres/logs; \ +ls -la . | grep logs; \ +ssh-keyscan -H localhost >> ~/.ssh/known_hosts; \ +ssh-keyscan -H 127.0.0.1 >> ~/.ssh/known_hosts; \ +ssh-keygen -t rsa -f ~/.ssh/id_rsa -q -N ''; \ +cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys; \ +chmod 600 ~/.ssh/authorized_keys; \ +ls -la ~/.ssh/; \ +TEST_FILTER=\"\" bash ./run_tests.sh;" diff --git a/README.md b/README.md index 4754e9ff..99ea468a 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ # testgres -Utility for orchestrating temporary PostgreSQL clusters in Python tests. Supports Python 3.7.17 and newer. +Utility for orchestrating temporary PostgreSQL clusters in Python tests. Supports Python 3.7.3 and newer. ## Installation diff --git a/run_tests.sh b/run_tests.sh index 75516d8c..d0192275 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -16,6 +16,7 @@ rm -rf $VENV_PATH ${PYTHON_BINARY} -m venv "${VENV_PATH}" export VIRTUAL_ENV_DISABLE_PROMPT=1 source "${VENV_PATH}/bin/activate" +pip install --upgrade pip setuptools wheel pip install -r tests/requirements.txt # remove existing coverage file From d1b11796acb9e6c65392f3865979ab5f771d3a79 Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Wed, 28 Jan 2026 01:25:36 +0300 Subject: [PATCH 2/2] Dockerfile is corrected (FROM...AS...) --- Dockerfile--astralinux_1_7.tmpl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile--astralinux_1_7.tmpl b/Dockerfile--astralinux_1_7.tmpl index a89bced6..b8d6bc8f 100644 --- a/Dockerfile--astralinux_1_7.tmpl +++ b/Dockerfile--astralinux_1_7.tmpl @@ -2,7 +2,7 @@ ARG PG_VERSION ARG PYTHON_VERSION # --------------------------------------------- base1 -FROM packpack/packpack:astra-1.7 as base1 +FROM packpack/packpack:astra-1.7 AS base1 RUN apt update RUN apt install -y sudo curl ca-certificates @@ -14,7 +14,7 @@ RUN apt install -y time RUN apt install -y git # --------------------------------------------- postgres -FROM base1 as base1_with_dev_tools +FROM base1 AS base1_with_dev_tools RUN apt-get update @@ -36,7 +36,7 @@ RUN apt-get install -y libzstd-dev RUN apt-get install -y libxml2-dev # --------------------------------------------- postgres -FROM base1_with_dev_tools as base1_with_pg-17 +FROM base1_with_dev_tools AS base1_with_pg-17 RUN curl -fsSL https://ftp.postgresql.org/pub/source/v17.7/postgresql-17.7.tar.bz2 -o postgresql.tar.bz2 \ && mkdir -p /pg/postgres/source \ @@ -58,13 +58,13 @@ RUN ln -s /pg/postgres/install/bin/pg_config -t /usr/local/bin RUN ln -s /pg/postgres/install/lib/libpq.so.5.17 /usr/lib/libpq.so.5 # --------------------------------------------- base2_with_python-3 -FROM base1_with_pg-${PG_VERSION} as base2_with_python-3 +FROM base1_with_pg-${PG_VERSION} AS base2_with_python-3 RUN apt install -y python3 python3-dev python3-venv ENV PYTHON_BINARY=python3 # --------------------------------------------- final -FROM base2_with_python-${PYTHON_VERSION} as final +FROM base2_with_python-${PYTHON_VERSION} AS final EXPOSE 22