jenkinsfile - move print statements around
This commit is contained in:
1 parent
9eb8fd93c0
commit
c0d60ba0ac
1 file changed
+35
-34
+35
-34
@@ -36,10 +36,11 @@ pipeline {
|
|||||||
env.TEST_HASH =
|
env.TEST_HASH =
|
||||||
"${String.format('%06d', epochSec % 1_000_000)}"
|
"${String.format('%06d', epochSec % 1_000_000)}"
|
||||||
|
|
||||||
|
echo "==MC== Test Hash - ${env.TEST_HASH}"
|
||||||
|
echo "==MC== Disabling MOTD..."
|
||||||
|
|
||||||
sh """
|
sh """
|
||||||
cd /tmp
|
cd /tmp
|
||||||
echo ==MC== Test Hash - ${env.TEST_HASH}
|
|
||||||
echo ==MC== Disabling MOTD...
|
|
||||||
touch .hushlogin
|
touch .hushlogin
|
||||||
scp -i /root/.ssh/id_rsa .hushlogin root@${params.host_ip}:/root/.hushlogin
|
scp -i /root/.ssh/id_rsa .hushlogin root@${params.host_ip}:/root/.hushlogin
|
||||||
rm .hushlogin
|
rm .hushlogin
|
||||||
@@ -94,20 +95,20 @@ pipeline {
|
|||||||
sh """
|
sh """
|
||||||
ssh -q -o StrictHostKeyChecking=no root@${params.host_ip} -o ServerAliveInterval=60 -o ServerAliveCountMax=120 << EOF
|
ssh -q -o StrictHostKeyChecking=no root@${params.host_ip} -o ServerAliveInterval=60 -o ServerAliveCountMax=120 << EOF
|
||||||
echo ==MC== Initiating Tail Watchdog
|
echo ==MC== Initiating Tail Watchdog
|
||||||
screen -dmS ble_test_watchdog_${env.TEST_HASH} sh -c '
|
screen -dmS ble_test_watchdog_${env.TEST_HASH} sh -c '
|
||||||
while ! pgrep -f "tail.*ble_test_${env.TEST_HASH}" > /dev/null; do
|
while ! pgrep -f "tail.*ble_test_${env.TEST_HASH}" > /dev/null; do
|
||||||
sleep 1
|
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
|
done
|
||||||
while true; do
|
done
|
||||||
while pgrep -f "tail.*ble_test_${env.TEST_HASH}" > /dev/null; do
|
exit
|
||||||
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
|
|
||||||
'
|
|
||||||
echo ==MC== Tail watchdog running in screen session ble_test_watchdog_${env.TEST_HASH}
|
echo ==MC== Tail watchdog running in screen session ble_test_watchdog_${env.TEST_HASH}
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
@@ -117,8 +118,8 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
sshagent([env.SSH_CREDENTIALS_ID]) {
|
sshagent([env.SSH_CREDENTIALS_ID]) {
|
||||||
sh """
|
sh """
|
||||||
echo ==MC== Test is running, monitoring output.
|
|
||||||
ssh -q -o StrictHostKeyChecking=no root@${params.host_ip} -o ServerAliveInterval=60 -o ServerAliveCountMax=120 << EOF
|
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
|
while screen -list | grep -q ble_test_${env.TEST_HASH}; do
|
||||||
tail -f /tmp/ble_test_${env.TEST_HASH}.log || true
|
tail -f /tmp/ble_test_${env.TEST_HASH}.log || true
|
||||||
done
|
done
|
||||||
@@ -133,21 +134,21 @@ pipeline {
|
|||||||
// screen -list | grep ble_test_watchdog_${env.TEST_HASH} | xargs | cut -d. -f1
|
// 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
|
// screen -list | grep ble_test_${env.TEST_HASH} | xargs | cut -d. -f1
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
sshagent([env.SSH_CREDENTIALS_ID]) {
|
sshagent([env.SSH_CREDENTIALS_ID]) {
|
||||||
sh """
|
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
|
||||||
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
|
screen -wipe
|
||||||
if screen -list | grep -q ${env.TEST_HASH}; then
|
if screen -list | grep -q ${env.TEST_HASH}; then
|
||||||
screen -S ble_test_watchdog_${env.TEST_HASH} -X quit
|
screen -S ble_test_watchdog_${env.TEST_HASH} -X quit
|
||||||
screen -S ble_test_${env.TEST_HASH} -X quit
|
screen -S ble_test_${env.TEST_HASH} -X quit
|
||||||
fi
|
fi
|
||||||
rm /tmp/ble_test_${env.TEST_HASH}.log
|
rm /tmp/ble_test_${env.TEST_HASH}.log
|
||||||
rm /root/.hushlogin
|
rm /root/.hushlogin
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user