From 930dd014fe1eda31e0bf7f71b0c61119b5d0fe14 Mon Sep 17 00:00:00 2001 From: Kumi Date: Mon, 22 Apr 2024 18:05:50 +0200 Subject: [PATCH] feat: add delay for SSH server readiness in CI Introduced a step in the CI test workflow to wait for the SSH server to start before proceeding with subsequent actions. This ensures that the server is fully operational and can accept connections before any attempts are made to copy the public key into the Docker container, avoiding potential race conditions where the server might not be ready in time, leading to failed CI runs. The addition of a simple loop with a timeout mechanism improves the reliability of the CI pipeline by making sure tests only run when all services are up and running. --- .forgejo/workflows/test.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml index 6afa364..b161ed1 100644 --- a/.forgejo/workflows/test.yml +++ b/.forgejo/workflows/test.yml @@ -28,6 +28,13 @@ jobs: 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 + + - name: Wait for SSH server to start + run: | + for i in {1..10}; do + nc -z localhost 2222 && break + sleep 1 + done - name: Copy public key to Docker container run: |