From be37ad49cb1beb137c7503e4dfcd693e375555eb Mon Sep 17 00:00:00 2001 From: matt Date: Sun, 18 Oct 2026 01:55:01 -0700 Subject: [PATCH] jenkinsfile - watch screen test 7 intern again --- api/Jenkinsfile.ble_test | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/api/Jenkinsfile.ble_test b/api/Jenkinsfile.ble_test index 6425f02..3e99051 100644 --- a/api/Jenkinsfile.ble_test +++ b/api/Jenkinsfile.ble_test @@ -78,15 +78,23 @@ pipeline { } } + //while screen -list | grep -q ble_test_${env.TEST_HASH}; do + // tail -f /tmp/ble_test_${env.TEST_HASH}.log + //done stage('View Test Logs'){ steps { sshagent([env.SSH_CREDENTIALS_ID]) { sh """ ssh -o StrictHostKeyChecking=no root@${params.host_ip} -o ServerAliveInterval=60 -o ServerAliveCountMax=120 << EOF - while screen -list | grep -q ble_test_${env.TEST_HASH}; do - tail -f /tmp/ble_test_${env.TEST_HASH}.log - done + set -euo pipefail + # Outer loop - runs as long as the screen session is alive + while screen -list | grep -q "ble_test_${TEST_HASH}"; do + # `tail -f` streams the file; the read-loop ensures line-by-line flush + tail -n +1 -f /tmp/ble_test_${env.TEST_HASH}.log | while IFS= read -r line; do + echo "\$line" + done + done """ } } @@ -94,7 +102,7 @@ pipeline { } // --------------------------------------------------------------------- - // Post‑build cleanup - kill the remote screen session + // Post-build cleanup - kill the remote screen session // --------------------------------------------------------------------- post { always {