jenkinsfile - watch screen test 7c new ssh method
This commit is contained in:
1 parent
170c2a71cb
commit
55cd88d9dc
1 file changed
+20
-8
@@ -84,18 +84,30 @@ pipeline {
|
||||
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
|
||||
|
||||
sh '''#!/usr/bin/env bash
|
||||
ssh -o StrictHostKeyChecking=no root@${params.host_ip} << 'EOF'
|
||||
set -euo pipefail
|
||||
# Outer loop - runs as long as the screen session is alive
|
||||
# Loop while the screen session exists
|
||||
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"
|
||||
# Tail the file and flush each line immediately
|
||||
tail -n +1 -f "/tmp/ble_test_${env.TEST_HASH}.log" | while IFS= read -r line; do
|
||||
echo "$line"
|
||||
done
|
||||
done
|
||||
"""
|
||||
EOF
|
||||
'''
|
||||
|
||||
//sh """
|
||||
//ssh -o StrictHostKeyChecking=no root@${params.host_ip} -o ServerAliveInterval=60 -o ServerAliveCountMax=120 << EOF
|
||||
// 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
|
||||
//"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user