Similar to the feature in Jenkins, offer a “Prepare for Shutdown” button. Running tasks will finish, but no new background tasks will be started.
Hey @pst, SonarQube already has a “graceful shutdown” command. Does this work for your use case? If not, then could you let us know a bit more about your use case?
Btw I’ve taken the liberty to move this thread to the “Suggest new features” category.
Hi, thanks for your answer. The link you posted is for the zip file. We use the docker container, I think it is not working for the container.
The use-case would be to have a clean shutdown (not breaking a running scan) when we e.g. update the SonarQube image.
Hey @pst, I’ve done a bit of digging and found that in principle, SonarQube gracefully handles docker stop. Docker sends SIGTERM, which is handled by the container’s process by initiating SonarQube’s graceful shutdown. The only caveat is that by default, docker will send SIGKILL after 10 seconds, which will force a non-graceful shutdown. This, however, but it can be overriden with the --time flag.
So something like docker stop --time <seconds> <container> or docker compose stop -t should work, provided <seconds> is long enough.
It’s true that this isn’t in our documentation, so perhaps it would be nice to add it there. And on top of that, I will also flag this post for our PMs in case they want to consider adding an explicit mechanism, like a button.
I think a “Prepare for shutdown” feature is the only way to do it right, if shutting down SonarQube while a scanner is still uploading its analysis (no scan started yet) might happen even with the SIGTERM approach.