Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .github/workflows/package-verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,27 @@ jobs:
steps:
- name: Prepare variables
run: |
RUN_CFG__NOW="$(date +'%Y%m%d_%H%M%S')"
echo "RUN_CFG__NOW=$RUN_CFG__NOW" >> $GITHUB_ENV
RUN_CFG__LOGS_DIR="logs-${{ matrix.platform }}-py${{ matrix.python }}-pg${{ matrix.postgres }}"
echo "RUN_CFG__LOGS_DIR=$RUN_CFG__LOGS_DIR" >> $GITHUB_ENV
RUN_CFG__DOCKER_IMAGE_NAME="tests-${{ matrix.platform }}-py${{ matrix.python }}-pg${{ matrix.postgres }}"
echo "RUN_CFG__DOCKER_IMAGE_NAME=$RUN_CFG__DOCKER_IMAGE_NAME" >> $GITHUB_ENV
echo "---------- [$GITHUB_ENV]"
cat $GITHUB_ENV
- name: Prepare logs folder on the host
run: mkdir -p "${{ env.RUN_CFG__LOGS_DIR }}"
- name: Adjust logs folder permission
run: chmod -R 777 "${{ env.RUN_CFG__LOGS_DIR }}"
- name: Checkout
uses: actions/checkout@v4
- name: Build local image ${{ matrix.alpine }}
run: docker build --build-arg PG_VERSION="${{ matrix.postgres }}" --build-arg PYTHON_VERSION="${{ matrix.python }}" -t "${{ env.RUN_CFG__DOCKER_IMAGE_NAME }}" -f Dockerfile--${{ matrix.platform }}.tmpl .
- name: Run
run: docker run $(bash <(curl -s https://codecov.io/env)) -t "${{ env.RUN_CFG__DOCKER_IMAGE_NAME }}"
run: docker run $(bash <(curl -s https://codecov.io/env)) -t -v ${{ github.workspace }}/${{ env.RUN_CFG__LOGS_DIR }}:/home/test/testgres/logs "${{ env.RUN_CFG__DOCKER_IMAGE_NAME }}"
- name: Upload Logs
uses: actions/upload-artifact@v4
if: always() # IT IS IMPORTANT!
with:
name: testgres--test_logs--${{ env.RUN_CFG__NOW }}-${{ matrix.platform }}-py${{ matrix.python }}-pg${{ matrix.postgres }}-id${{ github.run_id }}
path: "${{ env.RUN_CFG__LOGS_DIR }}/"
11 changes: 8 additions & 3 deletions Dockerfile--altlinux_10.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ FROM base2_with_python-${PYTHON_VERSION} as final
RUN adduser test -G wheel

# It enables execution of "sudo service ssh start" without password
RUN sh -c "echo \"WHEEL_USERS ALL=(ALL:ALL) NOPASSWD: ALL\"" >> /etc/sudoers
RUN echo "WHEEL_USERS ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers

ADD --chown=test:test . /pg/testgres
WORKDIR /pg/testgres
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

Expand All @@ -93,7 +95,10 @@ ENTRYPOINT sh -c " \
set -eux; \
echo HELLO FROM ENTRYPOINT; \
echo HOME DIR IS [`realpath ~/`]; \
ls -la .; \
sudo /usr/sbin/sshd; \
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 ''; \
Expand Down
11 changes: 8 additions & 3 deletions Dockerfile--altlinux_11.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@ FROM base2_with_python-${PYTHON_VERSION} as final
RUN adduser test -G wheel

# It enables execution of "sudo service ssh start" without password
RUN sh -c "echo \"WHEEL_USERS ALL=(ALL:ALL) NOPASSWD: ALL\"" >> /etc/sudoers
RUN echo "WHEEL_USERS ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers

ADD --chown=test:test . /pg/testgres
WORKDIR /pg/testgres
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

Expand All @@ -96,7 +98,10 @@ ENTRYPOINT sh -c " \
set -eux; \
echo HELLO FROM ENTRYPOINT; \
echo HOME DIR IS [`realpath ~/`]; \
ls -la .; \
sudo /usr/sbin/sshd; \
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 ''; \
Expand Down
18 changes: 12 additions & 6 deletions Dockerfile--std-all.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,24 @@ RUN apk add --no-cache sudo
ENV LANG=C.UTF-8

RUN addgroup -S sudo
RUN adduser postgres sudo
RUN adduser -D test
RUN addgroup test sudo

EXPOSE 22
RUN ssh-keygen -A

ADD --chown=postgres:postgres . /pg/testgres
WORKDIR /pg/testgres
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

# It allows to use sudo without password
RUN sh -c "echo \"postgres ALL=(ALL:ALL) NOPASSWD:ALL\"">>/etc/sudoers
RUN echo "test ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers

# THIS CMD IS NEEDED TO CONNECT THROUGH SSH WITHOUT PASSWORD
RUN sh -c "echo "postgres:*" | chpasswd -e"
RUN echo "test:*" | chpasswd -e

USER postgres
USER test

# THIS CMD IS NEEDED TO CONNECT THROUGH SSH WITHOUT PASSWORD
RUN chmod 700 ~/
Expand All @@ -52,11 +55,14 @@ ENTRYPOINT sh -c " \
set -eux; \
echo HELLO FROM ENTRYPOINT; \
echo HOME DIR IS [`realpath ~/`]; \
ls -la .; \
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/; \
sudo /usr/sbin/sshd; \
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; \
TEST_FILTER=\"\" bash run_tests.sh;"
26 changes: 22 additions & 4 deletions Dockerfile--std.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,28 @@ FROM base2_with_python-${PYTHON_VERSION} as final

RUN apk add --no-cache git

RUN apk add --no-cache sudo

ENV LANG=C.UTF-8

ADD --chown=postgres:postgres . /pg/testgres
WORKDIR /pg/testgres
RUN addgroup -S sudo
RUN adduser -D test
RUN addgroup test sudo

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

# It allows to use sudo without password
RUN echo "test ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers

USER postgres
ENTRYPOINT bash run_tests.sh
USER test
ENTRYPOINT sh -c " \
set -eux; \
echo HELLO FROM ENTRYPOINT; \
echo HOME DIR IS [`realpath ~/`]; \
ls -la .; \
sudo chmod 777 /home/test/testgres/logs; \
ls -la . | grep logs; \
bash run_tests.sh;"
18 changes: 12 additions & 6 deletions Dockerfile--std2-all.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,27 @@ RUN apk add --no-cache sudo
ENV LANG=C.UTF-8

RUN addgroup -S sudo
RUN adduser postgres sudo
RUN adduser -D test
RUN addgroup test sudo

EXPOSE 22
RUN ssh-keygen -A

# It allows to use sudo without password
RUN sh -c "echo \"postgres ALL=(ALL:ALL) NOPASSWD:ALL\"">>/etc/sudoers
RUN echo "test ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers

# THIS CMD IS NEEDED TO CONNECT THROUGH SSH WITHOUT PASSWORD
RUN sh -c "echo "postgres:*" | chpasswd -e"
RUN echo "test:*" | chpasswd -e

USER postgres
USER test

RUN curl https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
RUN ~/.pyenv/bin/pyenv install ${PYTHON_VERSION}

ADD --chown=postgres:postgres . /pg/testgres
WORKDIR /pg/testgres
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

# THIS CMD IS NEEDED TO CONNECT THROUGH SSH WITHOUT PASSWORD
RUN chmod 700 ~/
Expand All @@ -99,11 +102,14 @@ ENTRYPOINT sh -c " \
set -eux; \
echo HELLO FROM ENTRYPOINT; \
echo HOME DIR IS [`realpath ~/`]; \
ls -la .; \
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/; \
sudo /usr/sbin/sshd; \
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; \
export PATH=\"~/.pyenv/bin:$PATH\"; \
Expand Down
29 changes: 17 additions & 12 deletions Dockerfile--ubuntu_24_04.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,10 @@ RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail http
RUN apt update
RUN apt install -y postgresql-${PG_VERSION}

# RUN apt install -y mc

# [2025-02-26] It adds the user 'postgres' in the group 'sudo'
# [2025-02-27] It is not required.
# RUN adduser postgres sudo

EXPOSE 22

RUN ssh-keygen -A

# It enables execution of "sudo service ssh start" without password
RUN sh -c "echo postgres ALL=NOPASSWD:/usr/sbin/service ssh start" >> /etc/sudoers

# --------------------------------------------- base2_with_python-3
FROM base1 as base2_with_python-3
RUN apt install -y python3 python3-dev python3-venv libpq-dev build-essential
Expand All @@ -49,12 +40,23 @@ FROM base2_with_python-${PYTHON_VERSION} as final

RUN apt install -y git

ADD --chown=postgres:postgres . /pg/testgres
WORKDIR /pg/testgres
RUN adduser test
RUN chown postgres:postgres /var/run/postgresql
RUN chmod 775 /var/run/postgresql
RUN usermod -aG postgres test

# It enables execution of "sudo service ssh start" without password
#RUN echo "test ALL=NOPASSWD:/usr/sbin/service ssh start" >> /etc/sudoers
RUN echo "test ALL=NOPASSWD:ALL" >> /etc/sudoers

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 postgres
USER test

RUN chmod 700 ~/
RUN mkdir -p ~/.ssh
Expand All @@ -63,8 +65,11 @@ ENTRYPOINT sh -c " \
#set -eux; \
echo HELLO FROM ENTRYPOINT; \
echo HOME DIR IS [`realpath ~/`]; \
ls -la .; \
service ssh enable; \
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 ''; \
Expand Down