Skip to content

Commit 2f7fac1

Browse files
CI: RockyLinux 8 is added to test
1 parent cf92cc5 commit 2f7fac1

2 files changed

Lines changed: 154 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ jobs:
158158
python: "3"
159159
postgres: "17"
160160
case_suffix: "py3_xx_xx-pg17_xx"
161+
- platform: "rockylinux_8"
162+
python: "3"
163+
postgres: "17"
164+
case_suffix: "py3_xx_xx-pg17_xx"
161165

162166
name: "test: ${{ matrix.platform }} | ${{ matrix.case_suffix }}"
163167

Dockerfile--rockylinux_8.tmpl

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
ARG PG_VERSION=17
2+
ARG PYTHON_VERSION=3
3+
4+
# --------------------------------------------- base1
5+
FROM rockylinux:8 AS base1
6+
7+
# Enable the PowerTools repository (called crb or powertools in Rocky/Alma),
8+
# since without it, dnf won't find the python3-devel packages for building extensions.
9+
RUN dnf install -y 'dnf-command(config-manager)' && \
10+
dnf config-manager --set-enabled powertools
11+
12+
# Combine the installation of system utilities, SSH into one layer
13+
RUN dnf install -y \
14+
sudo \
15+
curl \
16+
ca-certificates \
17+
openssh-server \
18+
openssh-clients \
19+
sshpass \
20+
time \
21+
util-linux \
22+
procps-ng \
23+
git \
24+
iproute \
25+
bzip2 \
26+
&& dnf clean all
27+
28+
RUN sed -i 's/#MaxStartups 10:30:100/MaxStartups 2000:30:2000/' /etc/ssh/sshd_config && \
29+
sed -i 's/#MaxSessions 10/MaxSessions 500/' /etc/ssh/sshd_config && \
30+
sed -i 's/#MaxAuthTries 6/MaxAuthTries 20/' /etc/ssh/sshd_config
31+
32+
# --------------------------------------------- postgres dev tools
33+
FROM base1 AS base1_with_dev_tools
34+
35+
RUN dnf install -y \
36+
gcc \
37+
make \
38+
meson \
39+
flex \
40+
bison \
41+
pkg-config \
42+
openssl-devel \
43+
libicu-devel \
44+
libzstd-devel \
45+
zlib-devel \
46+
lz4-devel \
47+
libxml2-devel \
48+
&& dnf clean all
49+
50+
# --------------------------------------------- postgres build
51+
FROM base1_with_dev_tools AS base1_with_pg-17
52+
53+
RUN curl -fsSL https://ftp.postgresql.org/pub/source/v17.7/postgresql-17.7.tar.bz2 -o postgresql.tar.bz2 \
54+
&& mkdir -p /pg/postgres/source \
55+
&& tar -xjf postgresql.tar.bz2 -C /pg/postgres/source --strip-components=1 \
56+
&& rm postgresql.tar.bz2
57+
58+
WORKDIR /pg/postgres/source
59+
60+
RUN ./configure --prefix=/pg/postgres/install --with-zlib --with-openssl --without-readline --with-lz4 --with-zstd --with-libxml
61+
RUN make -j 4 install
62+
RUN make -j 4 -C contrib install
63+
64+
# SETUP PG_CONFIG
65+
# When pg_config symlink in /usr/local/bin it returns a real (right) result of --bindir
66+
RUN ln -s /pg/postgres/install/bin/pg_config -t /usr/local/bin
67+
68+
# SETUP PG CLIENT LIBRARY
69+
# libpq.so.5 is enough
70+
RUN ln -s /pg/postgres/install/lib/libpq.so.5 /usr/lib/libpq.so.5
71+
72+
# --------------------------------------------- base2_with_python-3
73+
FROM base1_with_pg-${PG_VERSION} AS base2_with_python-3
74+
75+
RUN dnf install -y \
76+
python39 \
77+
python39-devel \
78+
&& dnf clean all
79+
80+
ENV PYTHON_BINARY=/usr/bin/python3.9
81+
82+
# --------------------------------------------- final
83+
FROM base2_with_python-${PYTHON_VERSION} AS final
84+
85+
EXPOSE 22
86+
# In RHEL/CentOS, SSH host keys are generated via sshd-keygen
87+
RUN ssh-keygen -A
88+
89+
# In the RedHat family, the equivalent of the wheel/sudo group is the wheel group
90+
RUN useradd -m test && usermod -aG wheel test
91+
92+
# Enable sudo without a password
93+
RUN echo "test ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers
94+
95+
# Setting a blank password and disabling UsePAM (like in Astra),
96+
# since SELinux/PAM in RHEL blocks blank passwords over SSH.
97+
#
98+
# On local tests it produces:
99+
# WARNING: 'UsePAM no' is not supported in RHEL and may cause several problems.
100+
#
101+
# But without "sed -i 's/UsePAM yes/UsePAM no/' /etc/ssh/sshd_config" remote tests
102+
# does not work!
103+
#
104+
RUN echo "test:*" | chpasswd -e && \
105+
sed -i 's/UsePAM yes/UsePAM no/' /etc/ssh/sshd_config
106+
107+
COPY --chown=test:test . /home/test/testgres
108+
WORKDIR /home/test/testgres
109+
110+
ENV LANG=C.UTF-8
111+
112+
RUN chmod 700 /home/test/ && \
113+
mkdir -p /home/test/.ssh && \
114+
chown -R test:test /home/test/.ssh
115+
116+
# Our proven ENTRYPOINT with a DUMMY plug
117+
ENTRYPOINT ["sh", "-c", " \
118+
set -eux; \
119+
echo 'SYSTEM START: PREPARING SSH'; \
120+
/usr/sbin/sshd; \
121+
ls -la /home/test/.ssh/; \
122+
\"$@\" \
123+
", "DUMMY-DUMMY-DUMMY"]
124+
125+
# Standard CMD for tests
126+
CMD ["bash", "-c", " \
127+
set -eux; \
128+
echo \"HOME DIR IS [`realpath ~/`]\"; \
129+
echo \"WORK DIR IS [$(pwd)]\"; \
130+
if [ ! -f /home/test/.ssh/id_rsa ]; then \
131+
su test -c \"ssh-keygen -t rsa -f /home/test/.ssh/id_rsa -q -N ''\"; \
132+
su test -c \"cat /home/test/.ssh/id_rsa.pub >> /home/test/.ssh/authorized_keys\"; \
133+
chmod 600 /home/test/.ssh/authorized_keys; \
134+
fi; \
135+
ls -la /home/test/.ssh/; \
136+
su test -c \"ssh-keyscan -H localhost >> /home/test/.ssh/known_hosts\"; \
137+
su test -c \"ssh-keyscan -H 127.0.0.1 >> /home/test/.ssh/known_hosts\"; \
138+
if [ -n \"${TEST_CFG__REMOTE_HOST:-}\" ]; then \
139+
su test -c \"ssh-keyscan -H ${TEST_CFG__REMOTE_HOST} >> /home/test/.ssh/known_hosts\"; \
140+
fi; \
141+
if [ -n \"${TEST_CFG__REMOTE_SSH_KEY:-}\" ]; then \
142+
cp \"${TEST_CFG__REMOTE_SSH_KEY}\" \"${TEST_CFG__REMOTE_SSH_KEY}_ci\"; \
143+
export TEST_CFG__REMOTE_SSH_KEY=\"${TEST_CFG__REMOTE_SSH_KEY}_ci\"; \
144+
chown test:test \"${TEST_CFG__REMOTE_SSH_KEY}\"; \
145+
chmod 600 \"${TEST_CFG__REMOTE_SSH_KEY}\"; \
146+
ls -la /home/test/.ssh/; \
147+
fi; \
148+
ls -la ./; \
149+
su test -c \"TEST_FILTER='' bash ./run_tests.sh\"; \
150+
"]

0 commit comments

Comments
 (0)