From 97e9e6626ec258dccb1509ee4ea208aa75e5a9c1 Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Fri, 20 Mar 2026 20:33:14 -0300 Subject: [PATCH] ci: Fix deploy log capture and error handling --- .forgejo/workflows/botserver.yaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.forgejo/workflows/botserver.yaml b/.forgejo/workflows/botserver.yaml index e68caf6e..ba78bfcf 100644 --- a/.forgejo/workflows/botserver.yaml +++ b/.forgejo/workflows/botserver.yaml @@ -67,9 +67,15 @@ jobs: - name: Deploy via SSH working-directory: workspace run: | - ssh -o StrictHostKeyChecking=no pragmatismo-system "pkill -f /opt/gbo/bin/botserver || true; sleep 2" - scp -v -o StrictHostKeyChecking=no target/debug/botserver pragmatismo-system:/opt/gbo/bin/botserver 2>&1 | tee /tmp/deploy.log - ssh -o StrictHostKeyChecking=no pragmatismo-system "chmod +x /opt/gbo/bin/botserver && cd /opt/gbo/bin && nohup sudo -u gbuser ./botserver --noconsole >> /opt/gbo/logs/error.log 2>&1 &" + set +e + ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 pragmatismo-system "pkill -f /opt/gbo/bin/botserver; sleep 2" 2>&1 | tee /tmp/deploy.log + echo "--- scp start ---" >> /tmp/deploy.log + scp -o StrictHostKeyChecking=no target/debug/botserver pragmatismo-system:/opt/gbo/bin/botserver 2>&1 | tee -a /tmp/deploy.log + SCP_EXIT=${PIPESTATUS[0]} + echo "scp exit: $SCP_EXIT" >> /tmp/deploy.log + if [ "$SCP_EXIT" = "0" ]; then + ssh -o StrictHostKeyChecking=no pragmatismo-system "chmod +x /opt/gbo/bin/botserver && cd /opt/gbo/bin && nohup sudo -u gbuser ./botserver --noconsole >> /opt/gbo/logs/error.log 2>&1 &" 2>&1 | tee -a /tmp/deploy.log + fi - name: Save deploy log if: always()