From 78fcec897eaeaff760c3dfc1c9a1425e70b8e653 Mon Sep 17 00:00:00 2001 From: Kumi Date: Mon, 22 Apr 2024 17:58:32 +0200 Subject: [PATCH] fix(ci): ensure fresh SSH server container setup 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. --- .forgejo/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml index c5457e9..6afa364 100644 --- a/.forgejo/workflows/test.yml +++ b/.forgejo/workflows/test.yml @@ -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"