fix(ci): ensure fresh SSH server container setup
Some checks failed
Test! / test (push) Failing after 1m45s

Ensured the SSH server Docker container is always rebuilt from a clean state by forcefully removing any pre-existing container before creation. Additionally, updated the SSH connection user to 'replication' to align with new security protocols.

- The force removal of the existing 'ssh-server' container avoids potential conflicts or inconsistencies due to leftover state from previous test runs, ensuring a more reliable integration testing environment.
- Switching the SSH connection to use the 'replication' user account instead of 'root' enhances security and adheres to best practices by minimizing the use of elevated privileges.

These changes contribute to a more stable and secure CI pipeline by reducing flakiness in tests and aligning with security best practices.
This commit is contained in:
Kumi 2024-04-22 17:58:32 +02:00
parent c72c45f47b
commit 78fcec897e
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -25,6 +25,7 @@ jobs:
- name: Build and run SSH Server Docker Container
run: |
docker rm -f ssh-server || true
docker build -t my-ssh-server ./ci-tests/
docker run -d -p 2222:22 --name ssh-server my-ssh-server
@ -41,4 +42,4 @@ jobs:
- name: Connect to SSH server using SSH key
run: |
ssh -i my_ssh_key -p 2222 root@localhost echo "SSH connection successful"
ssh -i my_ssh_key -p 2222 replication@localhost echo "SSH connection successful"