I am trying to place timeout in below code and skip rest of the stages in jenkins if still "status = progress" after 3 minutes.
script {
def date = new Date()
currtime = date.getTime()
future_time = date.getTime() + 3 * 60000
while (currtime < future_time) {
date = new Date()
currtime = date.getTime()
Status= "IN_PROGRESS"
if (Status == 'IN_PROGRESS') {
echo 'Status is IN_PROGRESS'
} else if (Status == 'SUCCEEDED') {
break
} else if (Status == 'FAILED') {
echo "Status is FAILED"
exit(1)
} else {
exit(1)
}
}
}