-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use ExitLifecycle
when running in a container
#1268
Conversation
When I add that setting to my Docker image run script, Jenkins does not restart after I've installed a new plugin and clicked the "Restart Jenkins when installation is complete and no jobs are running" checkbox. That behavior happens when I run the script in the foreground or use the docker It restarted previously when I used the default value for the If I use the If I add the |
Right it would do that, might be better to move this up to the orchestrator level instead |
You just need to add |
I think we should reconsider this change so that we are not introducing a breaking change to Docker behavior in the same release that delivers security fixes. Jenkins 2.330 and Jenkins 2.319.2 releases tomorrow are security releases. They will use this Docker image packaging. We can bring the change back right after the security release is delivered. I think it is the right change, but introducing it at the same time as a security release is too disruptive for users. |
I used |
yeah my bad, will back it out. |
I don't feel strongly that this change be delivered as part of the next security release, but I do feel that this is the right layer for the change (rather than the Helm chart). Even when Docker is used without Kubernetes, I believe that using its restart policy to manage the container lifecycle is preferable to managing this ourselves with |
…)" This reverts commit 0ab3a31.
I suspect user error. I tested this scenario and it works fine for me. |
When I use unmodified |
The scenario I tested was:
In this scenario I verified that:
Furthermore looking at the code I see no difference between the |
But three months later? |
I think we've had enough time that we should bring this back. The minor change in the use case that I have found (restart causes my docker process that appears to be running in the foreground to switch to running in the background) is easy enough to document and not important enough to offset the benefits of moving lifecycle management to Docker. |
We already have a PR open at #1270 so my understanding is that it just needs to be approved and merged. |
When running in a container, the default
UnixLifecycle
(with all its fragile low-level systems logic) is unnecessary. The container orchestrator effectively functions as the service manager, so allow the process to exit and be restarted by the container orchestrator rather than trying to do this ourselves inUnixLifecycle
. Similar changes should be made to the non-container-based packaging, but this is a start.I tested this by running Jenkins in Docker with this change and applying a Docker restart policy of
always
to the container. (I assume Kubernetes has its own equivalent for this, but I don't use Kubernetes.) I verified that by default-Dhudson.lifecycle=hudson.lifecycle.ExitLifecycle
was set and that after going to/safeRestart
the process exited and Docker restarted the container automatically, resulting in the same behavior as withUnixLifecycle
. I also verified that when manually adjustingJAVA_OPTS
to override-Dhudson.lifecycle
that my overridden choice was respected.Fixes jenkinsci/helm-charts#529