jenkinsfile - watch screen test 7 intern again
This commit is contained in:
1 parent
56fb87ab5e
commit
be37ad49cb
1 file changed
+12
-4
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user