1. Add timeout – To stop pipeline run in infinitely
2. Add build Discard – To stop build to consume disk space
pipeline
{
agent { label 'master' }
options {
buildDiscarder(logRotator(numToKeepStr: '5'))
timeout(time: 10, unit: 'SECONDS')
timestamps()
}
stages {
stage('sleep'){
steps {
sh '''
echo sleeping
sleep 60
'''
}
}
}
}