From 4b6dea838ed745bcd26d98f340fc876f0225a651 Mon Sep 17 00:00:00 2001 From: Danila Vershinin Date: Fri, 12 Jul 2024 01:07:06 +0500 Subject: [PATCH] TestAdd GitHub Actions workflow for testing Firewalld. It adds a check to ensure that the Docker container needed for testing is running correctly. If the container has failed to start, the commit now instructs the workflow to output corresponding logs and docker inspect outputs for debugging, and then exits the workflow with an error status. --- .github/workflows/test-firewalld.yml | 1 + Dockerfile.firewalld | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/.github/workflows/test-firewalld.yml b/.github/workflows/test-firewalld.yml index 45228d5..57af031 100644 --- a/.github/workflows/test-firewalld.yml +++ b/.github/workflows/test-firewalld.yml @@ -28,6 +28,7 @@ jobs: # Wait for the container to be fully initialized sleep 10 # Check if the container is running + # Capture and print logs if the container is not running if [ "$(sudo docker inspect -f '{{.State.Running}}' firewalld-container)" != "true" ]; then echo "Container failed to start. Logs:" sudo docker logs firewalld-container diff --git a/Dockerfile.firewalld b/Dockerfile.firewalld index e5557ae..21b4ca1 100644 --- a/Dockerfile.firewalld +++ b/Dockerfile.firewalld @@ -31,6 +31,12 @@ RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == system rm -f /lib/systemd/system/anaconda.target.wants/*; \ systemctl set-default multi-user.target +# Override systemd defaults +RUN mkdir -p /etc/systemd/system/service.d +RUN echo '[Service]' > /etc/systemd/system/service.d/override.conf +RUN echo 'ExecStart=' >> /etc/systemd/system/service.d/override.conf +RUN echo 'ExecStart=/usr/lib/systemd/systemd' >> /etc/systemd/system/service.d/override.conf + VOLUME [ "/sys/fs/cgroup" ] CMD ["/sbin/init"]