Wait for your service to start with Jenkins pipeline
If you need to wait for a server to start up before continuing then waitUntil is what you need.
timeout(1) {
waitUntil {
script {
def rc = sh script: "curl ${env.HEALTH_URL}", returnStatus: true
return rc == 0
}
}
}
Replace the command that you are comfortable with. Another option is:
waitUntil {
sh 'wget --retry-connrefused --tries=120 --waitretry=1 -q ${env.HEALTH_URL} -O /dev/null'
}