Make docker stop timeout configurable via STOP_TIMEOUT property#743
Make docker stop timeout configurable via STOP_TIMEOUT property#743DaveDasSchnitzel wants to merge 1 commit intojenkinsci:masterfrom
Conversation
The --time argument to `docker stop` was previously hardcoded and could not be adjusted for containers that need more time to shut down gracefully. Modern Docker has also deprecated --time in favour of --timeout, though the --timeout long form was only introduced in Docker 23 and is not recognised by older clients. Add a static STOP_TIMEOUT field consistent with the existing CLIENT_TIMEOUT and SKIP_RM_ON_STOP fields, and switch to the short -t flag which maps to the timeout parameter on all Docker client versions without deprecation warnings. The value can be overridden via the system property: org.jenkinsci.plugins.docker.workflow.client.DockerClient.STOP_TIMEOUT or mutated from a Groovy init script at runtime. Fixes jenkinsci#733 Related to jenkinsci#719
171cb28 to
973d288
Compare
|
Hey @jglick I noticed this plugin is listed for adoption on the Jenkins plugin site. I've opened this PR to fix a issue where the docker stop timeout is hardcoded and can't be adjusted for containers that need more time to shut down gracefully. Would you have a chance to review this, or let me know if you're still actively maintaining the plugin? If not, I'd be happy to go through the adoption process to help keep it moving forward. Thank you for all your work on this plugin. :-) |
I am not. On occasion I merge PRs to adapt tests to behavioral changes elsewhere, consume better upstream APIs, update metadata, etc. In general my opinion is that it is not safe or prudent to make any substantive changes to this plugin ever again (excepting those required by OS or Docker updates), and users should consider it “as is”: to the extent it works and is convenient, fine, but at the first sign of trouble, stop using it and run Docker tools directly. If someone wants to really adopt it and take responsibility for triaging and fixing the inevitable regressions caused by such changes, I guess they should. Other than the obvious Docker expertise, the level of Jenkins plugin development expertise required is I would say intermediate: there are some subtle aspects particularly to |
Thanks for the clarification. That helps a lot, we’ll reconsider how we approach this. |

The
--timeargument todocker stopwas previously hardcoded and couldnot be adjusted for containers that need more time to shut down gracefully.
Modern Docker has also deprecated
--timein favour of--timeout, thoughthe
--timeoutlong form was only introduced in Docker 23 and is notrecognised by older clients.
Add a static
STOP_TIMEOUTfield consistent with the existingCLIENT_TIMEOUTandSKIP_RM_ON_STOPfields, and switch to the short-tflag which maps to the timeout parameter on all Docker client versionswithout deprecation warnings. The value can be overridden via the system
property:
org.jenkinsci.plugins.docker.workflow.client.DockerClient.STOP_TIMEOUTor mutated from a Groovy init script at runtime.
Fixes #733
Related to #719
Testing done
Ran
DockerClientTest#test_runagainst a live Docker daemon with the default timeout (1 s)and with an override of 5 s.
Default (
STOP_TIMEOUT=1):Override (
-Dorg.jenkinsci.plugins.docker.workflow.client.DockerClient.STOP_TIMEOUT=5):Submitter checklist