I am currently starting to convert our builds into a Jenkins build pipeline. At a certain point it is necessary for us to wait for the startup of a web application within a docker container.
My idea was to use something like this:
timeout(120) {
waitUntil {
sh 'wget -q http://server:8080/app/welcome.jsf -O /dev/null'
}
}
Unfortunately this makes the pipeline build fail:
ERROR: script returned exit code 4
Is there any simple way to make this work?
Edit:
I managed to make it work using the following code, but the stage is still marked as failed (although the build continues and is marked green in the end).
timeout(120) {
waitUntil {
try {
sh 'wget -q http://server:8080/app/welcome.jsf -O /dev/null'
return true
} catch (exception) {
return false
}
}
}