jenkinsfile - move print statements around

This commit is contained in:
matt committed 2026-10-21 00:38:29 -07:00
1 parent 9eb8fd93c0
commit c0d60ba0ac
1 file changed
+34 -33
+34 -33
View File
@@ -36,10 +36,11 @@ pipeline {
env.TEST_HASH =
"${String.format('%06d', epochSec % 1_000_000)}"
echo "==MC== Test Hash - ${env.TEST_HASH}"
echo "==MC== Disabling MOTD..."
sh """
cd /tmp
echo ==MC== Test Hash - ${env.TEST_HASH}
echo ==MC== Disabling MOTD...
touch .hushlogin
scp -i /root/.ssh/id_rsa .hushlogin root@${params.host_ip}:/root/.hushlogin
rm .hushlogin
@@ -94,20 +95,20 @@ pipeline {
sh """
ssh -q -o StrictHostKeyChecking=no root@${params.host_ip} -o ServerAliveInterval=60 -o ServerAliveCountMax=120 << EOF
echo ==MC== Initiating Tail Watchdog
screen -dmS ble_test_watchdog_${env.TEST_HASH} sh -c '
while ! pgrep -f "tail.*ble_test_${env.TEST_HASH}" > /dev/null; do
sleep 1
screen -dmS ble_test_watchdog_${env.TEST_HASH} sh -c '
while ! pgrep -f "tail.*ble_test_${env.TEST_HASH}" > /dev/null; do
sleep 1
done
while true; do
while pgrep -f "tail.*ble_test_${env.TEST_HASH}" > /dev/null; do
if ! screen -list | grep -q ble_test_${env.TEST_HASH}; then
pkill -9 -f "tail.*ble_test_${env.TEST_HASH}"
fi
sleep 5
done
while true; do
while pgrep -f "tail.*ble_test_${env.TEST_HASH}" > /dev/null; do
if ! screen -list | grep -q ble_test_${env.TEST_HASH}; then
pkill -9 -f "tail.*ble_test_${env.TEST_HASH}"
fi
sleep 5
done
done
exit
'
done
exit
'
echo ==MC== Tail watchdog running in screen session ble_test_watchdog_${env.TEST_HASH}
"""
}
@@ -117,8 +118,8 @@ pipeline {
steps {
sshagent([env.SSH_CREDENTIALS_ID]) {
sh """
echo ==MC== Test is running, monitoring output.
ssh -q -o StrictHostKeyChecking=no root@${params.host_ip} -o ServerAliveInterval=60 -o ServerAliveCountMax=120 << EOF
echo ==MC== Test is running, monitoring output.
while screen -list | grep -q ble_test_${env.TEST_HASH}; do
tail -f /tmp/ble_test_${env.TEST_HASH}.log || true
done
@@ -133,21 +134,21 @@ pipeline {
// screen -list | grep ble_test_watchdog_${env.TEST_HASH} | xargs | cut -d. -f1
// screen -list | grep ble_test_${env.TEST_HASH} | xargs | cut -d. -f1
// ---------------------------------------------------------------------
post {
always {
sshagent([env.SSH_CREDENTIALS_ID]) {
sh """
echo ==MC== Test complete, cleaning up Screen sessions
ssh -q -o StrictHostKeyChecking=no root@${params.host_ip} -o ServerAliveInterval=60 -o ServerAliveCountMax=120 << EOF
screen -wipe
if screen -list | grep -q ${env.TEST_HASH}; then
screen -S ble_test_watchdog_${env.TEST_HASH} -X quit
screen -S ble_test_${env.TEST_HASH} -X quit
fi
rm /tmp/ble_test_${env.TEST_HASH}.log
rm /root/.hushlogin
"""
}
}
}
post {
always {
sshagent([env.SSH_CREDENTIALS_ID]) {
sh """
ssh -q -o StrictHostKeyChecking=no root@${params.host_ip} -o ServerAliveInterval=60 -o ServerAliveCountMax=120 << EOF
echo ==MC== Test complete, cleaning up Screen sessions
screen -wipe
if screen -list | grep -q ${env.TEST_HASH}; then
screen -S ble_test_watchdog_${env.TEST_HASH} -X quit
screen -S ble_test_${env.TEST_HASH} -X quit
fi
rm /tmp/ble_test_${env.TEST_HASH}.log
rm /root/.hushlogin
"""
}
}
}
}