From 24be93af163b0be37c5092088fb4a2ec214495c9 Mon Sep 17 00:00:00 2001
From: "Meiswinkel, Jan SF/HZA-ZC2S"
Date: Thu, 10 Nov 2022 15:51:16 +0100
Subject: [PATCH 01/36] Allow custom message and more user information for safe
restarts
---
core/src/main/java/jenkins/model/Jenkins.java | 89 +++++++++++++++----
.../jenkins/util/JenkinsIsSafeRestarting.java | 49 ++++++++++
.../jenkins/model/Jenkins/_safeRestart.jelly | 15 +++-
.../util/JenkinsIsSafeRestarting/index.jelly | 68 ++++++++++++++
.../index_bg.properties | 26 ++++++
.../index_da.properties | 24 +++++
.../index_de.properties | 4 +
.../index_es.properties | 24 +++++
.../index_fr.properties | 24 +++++
.../index_it.properties | 29 ++++++
.../index_ja.properties | 26 ++++++
.../index_nb_NO.properties | 4 +
.../index_nl.properties | 24 +++++
.../index_pt_BR.properties | 25 ++++++
.../index_ru.properties | 4 +
.../index_sr.properties | 4 +
.../index_uk.properties | 4 +
.../index_zh_TW.properties | 24 +++++
.../resources/lib/layout/main-panel.jelly | 31 +++++--
war/src/main/less/base/style.less | 11 +++
war/src/main/less/simple-page.less | 12 +++
21 files changed, 495 insertions(+), 26 deletions(-)
create mode 100644 core/src/main/java/jenkins/util/JenkinsIsSafeRestarting.java
create mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index.jelly
create mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_bg.properties
create mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_da.properties
create mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_de.properties
create mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_es.properties
create mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_fr.properties
create mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_it.properties
create mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_ja.properties
create mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_nb_NO.properties
create mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_nl.properties
create mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_pt_BR.properties
create mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_ru.properties
create mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_sr.properties
create mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_uk.properties
create mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_zh_TW.properties
diff --git a/core/src/main/java/jenkins/model/Jenkins.java b/core/src/main/java/jenkins/model/Jenkins.java
index d5c3d4265536..7406f831f1ba 100644
--- a/core/src/main/java/jenkins/model/Jenkins.java
+++ b/core/src/main/java/jenkins/model/Jenkins.java
@@ -280,6 +280,7 @@
import jenkins.security.stapler.StaplerFilteredActionListener;
import jenkins.security.stapler.TypedFilter;
import jenkins.slaves.WorkspaceLocator;
+import jenkins.util.JenkinsIsSafeRestarting;
import jenkins.util.JenkinsJVM;
import jenkins.util.Listeners;
import jenkins.util.SystemProperties;
@@ -482,6 +483,7 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
@CheckForNull
private transient volatile QuietDownInfo quietDownInfo;
+
private transient volatile boolean terminating;
@GuardedBy("Jenkins.class")
private transient boolean cleanUpStarted;
@@ -2923,6 +2925,9 @@ public boolean isQuietingDown() {
return quietDownInfo != null;
}
+ public boolean isPreparingSafeRestart() {
+ return quietDownInfo.isSafeRestart();
+ }
/**
* Returns quiet down reason if it was indicated.
* @return
@@ -2933,7 +2938,7 @@ public boolean isQuietingDown() {
@CheckForNull
public String getQuietDownReason() {
final QuietDownInfo info = quietDownInfo;
- return info != null ? info.reason : null;
+ return info != null ? info.message : null;
}
/**
@@ -4070,7 +4075,7 @@ public synchronized HttpRedirect doQuietDown() {
*
* @param block Block until the system really quiets down and no builds are running
* @param timeout If non-zero, only block up to the specified number of milliseconds
- * @deprecated since 2.267; use {@link #doQuietDown(boolean, int, String)} instead.
+ * @deprecated since 2.267; use {@link #doQuietDown2(boolean, int, String, boolean)} instead.
*/
@Deprecated
public synchronized HttpRedirect doQuietDown(boolean block, int timeout) {
@@ -4086,16 +4091,32 @@ public synchronized HttpRedirect doQuietDown(boolean block, int timeout) {
*
* @param block Block until the system really quiets down and no builds are running
* @param timeout If non-zero, only block up to the specified number of milliseconds
- * @param reason Quiet reason that will be visible to user
+ * @param message Quiet reason that will be visible to user
+ * @deprecated use {@link #doQuietDown2(boolean, int, String, boolean)} instead.
+ */
+ @Deprecated
+ public HttpRedirect doQuietDown(@QueryParameter boolean block,
+ @QueryParameter int timeout,
+ @QueryParameter @CheckForNull String message) throws InterruptedException, IOException {
+
+ return doQuietDown2(block, timeout, message, false);
+ }
+ /**
+ * Quiet down Jenkins - preparation for a restart
+ *
+ * @param block Block until the system really quiets down and no builds are running
+ * @param timeout If non-zero, only block up to the specified number of milliseconds
+ * @param message Quiet reason that will be visible to user
+ * @param safeRestart If the quietDown is for a safeRestart
* @since 2.267
*/
@RequirePOST
- public HttpRedirect doQuietDown(@QueryParameter boolean block,
+ public HttpRedirect doQuietDown2(@QueryParameter boolean block,
@QueryParameter int timeout,
- @QueryParameter @CheckForNull String reason) throws InterruptedException, IOException {
+ @QueryParameter @CheckForNull String message, @QueryParameter boolean safeRestart) throws InterruptedException, IOException {
synchronized (this) {
checkPermission(MANAGE);
- quietDownInfo = new QuietDownInfo(reason);
+ quietDownInfo = new QuietDownInfo(message, safeRestart);
}
if (block) {
long waitUntil = timeout;
@@ -4108,7 +4129,6 @@ public HttpRedirect doQuietDown(@QueryParameter boolean block,
}
return new HttpRedirect(".");
}
-
/**
* Cancel previous quiet down Jenkins - preparation for a restart
*/
@@ -4498,17 +4518,27 @@ public void doRestart(StaplerRequest req, StaplerResponse rsp) throws IOExceptio
*/
@CLIMethod(name = "safe-restart")
public HttpResponse doSafeRestart(StaplerRequest req) throws IOException, ServletException, RestartNotSupportedException {
+ return doSafeRestart2(req, null);
+ }
+
+ /**
+ * Queues up a restart of Jenkins for when there are no builds running, if we can.
+ *
+ * This first replaces "app" to {@link HudsonIsRestarting}
+ *
+ * @since 1.332
+ */
+ public HttpResponse doSafeRestart2(StaplerRequest req, @QueryParameter("message") String message) throws IOException, ServletException, RestartNotSupportedException {
checkPermission(MANAGE);
if (req != null && req.getMethod().equals("GET"))
return HttpResponses.forwardToView(this, "_safeRestart.jelly");
if (req == null || req.getMethod().equals("POST")) {
- safeRestart();
+ safeRestart(message);
}
return HttpResponses.redirectToDot();
}
-
private static Lifecycle restartableLifecycle() throws RestartNotSupportedException {
if (Main.isUnitTest) {
throw new RestartNotSupportedException("Restarting the controller JVM is not supported in JenkinsRule-based tests");
@@ -4548,12 +4578,20 @@ public void run() {
/**
* Queues up a restart to be performed once there are no builds currently running.
- * @since 1.332
+ * @deprecated since 2.377
*/
public void safeRestart() throws RestartNotSupportedException {
+ safeRestart(null);
+ }
+ /**
+ * Queues up a restart to be performed once there are no builds currently running.
+ * @param message the message to show to users in the shutdown banner.
+ * @since 2.377
+ */
+ public void safeRestart(String message) throws RestartNotSupportedException {
final Lifecycle lifecycle = restartableLifecycle();
// Quiet down so that we won't launch new builds.
- quietDownInfo = new QuietDownInfo();
+ quietDownInfo = new QuietDownInfo(message, true);
new Thread("safe-restart thread") {
final String exitUser = getAuthentication2().getName();
@@ -4562,11 +4600,10 @@ public void run() {
try (ACLContext ctx = ACL.as2(ACL.SYSTEM2)) {
// Wait 'til we have no active executors.
- doQuietDown(true, 0, null);
-
+ doQuietDown2(true, 0, message, true);
// Make sure isQuietingDown is still true.
if (isQuietingDown()) {
- servletContext.setAttribute("app", new HudsonIsRestarting());
+ servletContext.setAttribute("app", new JenkinsIsSafeRestarting());
// give some time for the browser to load the "reloading" page
lifecycle.onStatusUpdate("Restart in 10 seconds");
Thread.sleep(TimeUnit.SECONDS.toMillis(10));
@@ -5742,16 +5779,30 @@ private static void _setJenkinsJVM(boolean jenkinsJVM) {
}
private static final class QuietDownInfo {
-
@CheckForNull
- final String reason;
+ final String message;
+
+ private boolean safeRestart;
QuietDownInfo() {
- this(null);
+ this(null, false);
+ }
+
+ QuietDownInfo(final String message) {
+ this(message, false);
+ }
+
+ QuietDownInfo(final String message, final boolean safeRestart) {
+ this.message = message;
+ this.safeRestart = safeRestart;
+ }
+
+ boolean isSafeRestart() {
+ return safeRestart;
}
- QuietDownInfo(final String reason) {
- this.reason = reason;
+ void setSafeRestart(boolean safeRestart) {
+ this.safeRestart = safeRestart;
}
}
}
diff --git a/core/src/main/java/jenkins/util/JenkinsIsSafeRestarting.java b/core/src/main/java/jenkins/util/JenkinsIsSafeRestarting.java
new file mode 100644
index 000000000000..1c925417b6b7
--- /dev/null
+++ b/core/src/main/java/jenkins/util/JenkinsIsSafeRestarting.java
@@ -0,0 +1,49 @@
+/*
+ * The MIT License
+ *
+ * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package jenkins.util;
+
+import org.kohsuke.stapler.StaplerRequest;
+import org.kohsuke.stapler.StaplerResponse;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import java.io.IOException;
+
+import static javax.servlet.http.HttpServletResponse.SC_SERVICE_UNAVAILABLE;
+
+/**
+ * Model object used to display "Hudson is restarting".
+ *
+ * Set this object to {@link ServletContext#setAttribute(String, Object)} "app" while
+ * the loading activity is taking place.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public class JenkinsIsSafeRestarting {
+ public void doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, InterruptedException {
+ rsp.setStatus(SC_SERVICE_UNAVAILABLE);
+ req.getView(this, "index.jelly").forward(req, rsp);
+ }
+}
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly
index 5fd79c32a839..17ea90c8f60d 100644
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly
+++ b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly
@@ -30,15 +30,26 @@ THE SOFTWARE.
-
${%Jenkins cannot restart itself as currently configured.}
+
+
+
+
+
+
+
diff --git a/core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index.jelly b/core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index.jelly
new file mode 100644
index 000000000000..be01a71642f7
--- /dev/null
+++ b/core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index.jelly
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+ ${h.initPageVariables(context)}
+
+
+
+ ${%Restarting Jenkins}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${%Please wait while the Jenkins Controller is restarting. Jobs on agents can continue.}
+ ...
+
+
+ ${%Your browser will reload automatically when Jenkins is ready.}
+
+
+ ${%Safe Restart} ${%Jobs on agents can usually continue.}
+
${%Jenkins is going to shut down}
-
- ${%Shut down reason}: ${app.getQuietDownReason()}
-
-
+
+
+
+
+
+ ${app.getQuietDownReason()}
+
+
+ ${%The Jenkins Controller is restarting gently. No further jobs are accepted. Running jobs automatically continue afterwards.}
+
+
+
+
+
+
+
+
+ ${app.getQuietDownReason()}
+
+
+ ${%The Jenkins Controller is going to shut down. No further jobs will be accepted.}
+
+
+
+
+
diff --git a/war/src/main/less/base/style.less b/war/src/main/less/base/style.less
index b2fa03e7c1ff..3db5cda7a3e1 100644
--- a/war/src/main/less/base/style.less
+++ b/war/src/main/less/base/style.less
@@ -86,6 +86,17 @@ td.no-wrap {
left: -20000px;
}
+#safe-restart-msg {
+ font-weight: bold;
+ color: white;
+ background-color: #ff7f00;
+ text-align: center;
+ margin-bottom: var(--section-padding);
+ padding: 0.5em;
+ -moz-border-radius: 0.5em;
+ border-radius: var(--form-input-border-radius);
+}
+
#shutdown-msg {
font-weight: bold;
color: white;
diff --git a/war/src/main/less/simple-page.less b/war/src/main/less/simple-page.less
index fdee702f1cb8..c0e7a3ebd9ea 100644
--- a/war/src/main/less/simple-page.less
+++ b/war/src/main/less/simple-page.less
@@ -49,6 +49,17 @@ a {
text-align: center;
}
+.simple-page .safe-restarting {
+ border-color: #009600;
+ border-width: 2px;
+ border-radius: 2px;
+ border-style: solid;
+ width: 50%;
+ margin: 5% auto auto;
+ padding: 5px;
+ background-color: #44ff001f;
+}
+
.simple-page--description {
margin-top: 0;
margin-bottom: var(--section-padding);
@@ -103,3 +114,4 @@ html {
.simple-page .alert {
color: var(--danger-color, #c4000a);
}
+
From 3c4b9894bcc786e71f3e0226fbdb5d404c36a7c0 Mon Sep 17 00:00:00 2001
From: "Meiswinkel, Jan SF/HZA-ZC2S"
Date: Fri, 11 Nov 2022 08:52:51 +0100
Subject: [PATCH 02/36] Fix linting
---
.../main/java/jenkins/util/JenkinsIsSafeRestarting.java | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/core/src/main/java/jenkins/util/JenkinsIsSafeRestarting.java b/core/src/main/java/jenkins/util/JenkinsIsSafeRestarting.java
index 1c925417b6b7..a079a83e97f6 100644
--- a/core/src/main/java/jenkins/util/JenkinsIsSafeRestarting.java
+++ b/core/src/main/java/jenkins/util/JenkinsIsSafeRestarting.java
@@ -24,14 +24,13 @@
package jenkins.util;
-import org.kohsuke.stapler.StaplerRequest;
-import org.kohsuke.stapler.StaplerResponse;
+import static javax.servlet.http.HttpServletResponse.SC_SERVICE_UNAVAILABLE;
+import java.io.IOException;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
-import java.io.IOException;
-
-import static javax.servlet.http.HttpServletResponse.SC_SERVICE_UNAVAILABLE;
+import org.kohsuke.stapler.StaplerRequest;
+import org.kohsuke.stapler.StaplerResponse;
/**
* Model object used to display "Hudson is restarting".
From 7121f6d2943889e8737644a895c0e6e2cf9ed305 Mon Sep 17 00:00:00 2001
From: "Meiswinkel, Jan SF/HZA-ZC2S"
Date: Fri, 11 Nov 2022 14:34:31 +0100
Subject: [PATCH 03/36] Fix linter issues and deprecations
---
core/src/main/java/jenkins/model/Jenkins.java | 21 +++++++++++++------
.../util/JenkinsIsSafeRestarting/index.jelly | 2 +-
war/src/main/less/simple-page.less | 1 -
3 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/core/src/main/java/jenkins/model/Jenkins.java b/core/src/main/java/jenkins/model/Jenkins.java
index 7406f831f1ba..b9a8f468c9b0 100644
--- a/core/src/main/java/jenkins/model/Jenkins.java
+++ b/core/src/main/java/jenkins/model/Jenkins.java
@@ -2925,8 +2925,16 @@ public boolean isQuietingDown() {
return quietDownInfo != null;
}
+ /**
+ * Returns if the quietingDown is a safe restart.
+ * @since 2.378
+ */
public boolean isPreparingSafeRestart() {
+ if (quietDownInfo == null) {
+ return false;
+ }
return quietDownInfo.isSafeRestart();
+
}
/**
* Returns quiet down reason if it was indicated.
@@ -4092,7 +4100,7 @@ public synchronized HttpRedirect doQuietDown(boolean block, int timeout) {
* @param block Block until the system really quiets down and no builds are running
* @param timeout If non-zero, only block up to the specified number of milliseconds
* @param message Quiet reason that will be visible to user
- * @deprecated use {@link #doQuietDown2(boolean, int, String, boolean)} instead.
+ * @deprecated since 2.378; use {@link #doQuietDown2(boolean, int, String, boolean)} instead.
*/
@Deprecated
public HttpRedirect doQuietDown(@QueryParameter boolean block,
@@ -4108,7 +4116,7 @@ public HttpRedirect doQuietDown(@QueryParameter boolean block,
* @param timeout If non-zero, only block up to the specified number of milliseconds
* @param message Quiet reason that will be visible to user
* @param safeRestart If the quietDown is for a safeRestart
- * @since 2.267
+ * @since 2.378
*/
@RequirePOST
public HttpRedirect doQuietDown2(@QueryParameter boolean block,
@@ -4514,7 +4522,8 @@ public void doRestart(StaplerRequest req, StaplerResponse rsp) throws IOExceptio
*
* This first replaces "app" to {@link HudsonIsRestarting}
*
- * @since 1.332
+ * @deprecated since 2.378; use {@link #doSafeRestart2(StaplerRequest, String)} instead.
+ *
*/
@CLIMethod(name = "safe-restart")
public HttpResponse doSafeRestart(StaplerRequest req) throws IOException, ServletException, RestartNotSupportedException {
@@ -4526,7 +4535,7 @@ public HttpResponse doSafeRestart(StaplerRequest req) throws IOException, Servle
*
* This first replaces "app" to {@link HudsonIsRestarting}
*
- * @since 1.332
+ * @since 2.378
*/
public HttpResponse doSafeRestart2(StaplerRequest req, @QueryParameter("message") String message) throws IOException, ServletException, RestartNotSupportedException {
checkPermission(MANAGE);
@@ -4578,7 +4587,7 @@ public void run() {
/**
* Queues up a restart to be performed once there are no builds currently running.
- * @deprecated since 2.377
+ * @deprecated since 2.378; use {@link #safeRestart(String)} instead.
*/
public void safeRestart() throws RestartNotSupportedException {
safeRestart(null);
@@ -4586,7 +4595,7 @@ public void safeRestart() throws RestartNotSupportedException {
/**
* Queues up a restart to be performed once there are no builds currently running.
* @param message the message to show to users in the shutdown banner.
- * @since 2.377
+ * @since 2.378
*/
public void safeRestart(String message) throws RestartNotSupportedException {
final Lifecycle lifecycle = restartableLifecycle();
diff --git a/core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index.jelly b/core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index.jelly
index be01a71642f7..fcb01fccaf9b 100644
--- a/core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index.jelly
+++ b/core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index.jelly
@@ -57,7 +57,7 @@ THE SOFTWARE.
${%Your browser will reload automatically when Jenkins is ready.}
- ${%Safe Restart} ${%Jobs on agents can usually continue.}
+ ${%Safe Restart}: ${%Jobs on agents can usually continue.}
diff --git a/war/src/main/less/simple-page.less b/war/src/main/less/simple-page.less
index c0e7a3ebd9ea..fbea65953bd3 100644
--- a/war/src/main/less/simple-page.less
+++ b/war/src/main/less/simple-page.less
@@ -114,4 +114,3 @@ html {
.simple-page .alert {
color: var(--danger-color, #c4000a);
}
-
From 9980d18437d8331b9cc4e1208537555f3bff24fd Mon Sep 17 00:00:00 2001
From: "Meiswinkel, Jan SF/HZA-ZC2S"
Date: Fri, 11 Nov 2022 15:16:31 +0100
Subject: [PATCH 04/36] Minor changes to formulations and style
---
.../resources/jenkins/model/Jenkins/_safeRestart.jelly | 7 ++++---
.../jenkins/model/Jenkins/_safeRestart.properties | 2 +-
.../jenkins/util/JenkinsIsSafeRestarting/index.jelly | 2 +-
.../util/JenkinsIsSafeRestarting/index_de.properties | 4 +++-
war/src/main/less/simple-page.less | 1 +
5 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly
index 17ea90c8f60d..c9c4c22ea583 100644
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly
+++ b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly
@@ -32,11 +32,12 @@ THE SOFTWARE.
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.properties b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.properties
index 631b3b5a2486..b35184fea6f2 100644
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.properties
+++ b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.properties
@@ -22,5 +22,5 @@
confirmRestart=\
Are you sure you want to restart Jenkins? \
- Jenkins will restart once all running jobs are finished. \
+ Jenkins will restart once all running jobs are either finished. \
(Pipeline builds may prevent Jenkins from restarting for a short period of time in some cases, but if so, they will be paused at the next available opportunity and then resumed after Jenkins restarts.)
diff --git a/core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index.jelly b/core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index.jelly
index fcb01fccaf9b..58e5052a73e7 100644
--- a/core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index.jelly
+++ b/core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index.jelly
@@ -57,7 +57,7 @@ THE SOFTWARE.
${%Your browser will reload automatically when Jenkins is ready.}
- ${%Safe Restart}: ${%Jobs on agents can usually continue.}
+ ${%Safe Restart} ${%Jobs on agents can usually continue.}
diff --git a/core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_de.properties b/core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_de.properties
index d57211c1ec36..f2f8e183d9a4 100644
--- a/core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_de.properties
+++ b/core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_de.properties
@@ -1,4 +1,6 @@
Please\ wait\ while\ Jenkins\ is\ restarting=Jenkins wird neu gestartet. Bitte warten.
Your\ browser\ will\ reload\ automatically\ when\ Jenkins\ is\ ready.=Der Webbrowser wird diese Seite automatisch neu laden, sobald Jenkins hochgefahren ist.
Safe\ Restart =Sicherer Neustart
-Jobs\ on\ agents\ can\ usually\ continue.=Jobs auf Agenten laufen in der Regel weiter.
\ No newline at end of file
+Jobs\ on\ agents\ can\ usually\ continue.=Jobs auf Agenten laufen in der Regel weiter.
+Restart\ =Neustarten
+Cancel\ =Abbrechen
\ No newline at end of file
diff --git a/war/src/main/less/simple-page.less b/war/src/main/less/simple-page.less
index fbea65953bd3..95891cf31446 100644
--- a/war/src/main/less/simple-page.less
+++ b/war/src/main/less/simple-page.less
@@ -50,6 +50,7 @@ a {
}
.simple-page .safe-restarting {
+ text-align: center;
border-color: #009600;
border-width: 2px;
border-radius: 2px;
From feaf3a11dbd12a3f029816abdabdfc21bfc36635 Mon Sep 17 00:00:00 2001
From: "Meiswinkel, Jan SF/HZA-ZC2S"
Date: Fri, 11 Nov 2022 16:00:54 +0100
Subject: [PATCH 05/36] Minor changes to formulations and style
---
.../jenkins/util/JenkinsIsSafeRestarting/index.jelly | 2 +-
.../jenkins/util/JenkinsIsSafeRestarting/index_de.properties | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index.jelly b/core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index.jelly
index 58e5052a73e7..151ae013b780 100644
--- a/core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index.jelly
+++ b/core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index.jelly
@@ -50,7 +50,7 @@ THE SOFTWARE.
- ${%Please wait while the Jenkins Controller is restarting. Jobs on agents can continue.}
+ ${%Please wait while the Jenkins Controller is restarting}
...
diff --git a/core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_de.properties b/core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_de.properties
index f2f8e183d9a4..49a2071a142f 100644
--- a/core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_de.properties
+++ b/core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_de.properties
@@ -2,5 +2,5 @@ Please\ wait\ while\ Jenkins\ is\ restarting=Jenkins wird neu gestartet. Bitte w
Your\ browser\ will\ reload\ automatically\ when\ Jenkins\ is\ ready.=Der Webbrowser wird diese Seite automatisch neu laden, sobald Jenkins hochgefahren ist.
Safe\ Restart =Sicherer Neustart
Jobs\ on\ agents\ can\ usually\ continue.=Jobs auf Agenten laufen in der Regel weiter.
-Restart\ =Neustarten
-Cancel\ =Abbrechen
\ No newline at end of file
+Restart =Neustarten
+Cancel =Abbrechen
\ No newline at end of file
From 4fc22a2f405124abcbd222209ce6a87dc66836ec Mon Sep 17 00:00:00 2001
From: "Meiswinkel, Jan SF/HZA-ZC2S"
Date: Wed, 16 Nov 2022 09:40:26 +0100
Subject: [PATCH 06/36] Fix CI issues
---
core/src/main/java/jenkins/model/Jenkins.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/core/src/main/java/jenkins/model/Jenkins.java b/core/src/main/java/jenkins/model/Jenkins.java
index b9a8f468c9b0..f7b8de61c6e7 100644
--- a/core/src/main/java/jenkins/model/Jenkins.java
+++ b/core/src/main/java/jenkins/model/Jenkins.java
@@ -2936,6 +2936,7 @@ public boolean isPreparingSafeRestart() {
return quietDownInfo.isSafeRestart();
}
+
/**
* Returns quiet down reason if it was indicated.
* @return
@@ -4109,6 +4110,7 @@ public HttpRedirect doQuietDown(@QueryParameter boolean block,
return doQuietDown2(block, timeout, message, false);
}
+
/**
* Quiet down Jenkins - preparation for a restart
*
@@ -4137,6 +4139,7 @@ public HttpRedirect doQuietDown2(@QueryParameter boolean block,
}
return new HttpRedirect(".");
}
+
/**
* Cancel previous quiet down Jenkins - preparation for a restart
*/
@@ -4525,7 +4528,7 @@ public void doRestart(StaplerRequest req, StaplerResponse rsp) throws IOExceptio
* @deprecated since 2.378; use {@link #doSafeRestart2(StaplerRequest, String)} instead.
*
*/
- @CLIMethod(name = "safe-restart")
+ @Deprecated
public HttpResponse doSafeRestart(StaplerRequest req) throws IOException, ServletException, RestartNotSupportedException {
return doSafeRestart2(req, null);
}
@@ -4537,6 +4540,7 @@ public HttpResponse doSafeRestart(StaplerRequest req) throws IOException, Servle
*
* @since 2.378
*/
+ @CLIMethod(name = "safe-restart")
public HttpResponse doSafeRestart2(StaplerRequest req, @QueryParameter("message") String message) throws IOException, ServletException, RestartNotSupportedException {
checkPermission(MANAGE);
if (req != null && req.getMethod().equals("GET"))
@@ -4548,6 +4552,7 @@ public HttpResponse doSafeRestart2(StaplerRequest req, @QueryParameter("message"
return HttpResponses.redirectToDot();
}
+
private static Lifecycle restartableLifecycle() throws RestartNotSupportedException {
if (Main.isUnitTest) {
throw new RestartNotSupportedException("Restarting the controller JVM is not supported in JenkinsRule-based tests");
@@ -4589,9 +4594,11 @@ public void run() {
* Queues up a restart to be performed once there are no builds currently running.
* @deprecated since 2.378; use {@link #safeRestart(String)} instead.
*/
+ @Deprecated
public void safeRestart() throws RestartNotSupportedException {
safeRestart(null);
}
+
/**
* Queues up a restart to be performed once there are no builds currently running.
* @param message the message to show to users in the shutdown banner.
@@ -5791,6 +5798,7 @@ private static final class QuietDownInfo {
@CheckForNull
final String message;
+ @NonNull
private boolean safeRestart;
QuietDownInfo() {
From 650eed0afe4f0418da4ba0a088ff11c1421eeaba Mon Sep 17 00:00:00 2001
From: "Meiswinkel, Jan SF/HZA-ZC2S"
Date: Wed, 16 Nov 2022 11:31:40 +0100
Subject: [PATCH 07/36] Use TODO tag in javadoc since-param
---
core/src/main/java/jenkins/model/Jenkins.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/core/src/main/java/jenkins/model/Jenkins.java b/core/src/main/java/jenkins/model/Jenkins.java
index f7b8de61c6e7..44ffa508b291 100644
--- a/core/src/main/java/jenkins/model/Jenkins.java
+++ b/core/src/main/java/jenkins/model/Jenkins.java
@@ -2927,7 +2927,7 @@ public boolean isQuietingDown() {
/**
* Returns if the quietingDown is a safe restart.
- * @since 2.378
+ * @since TODO
*/
public boolean isPreparingSafeRestart() {
if (quietDownInfo == null) {
@@ -4101,7 +4101,7 @@ public synchronized HttpRedirect doQuietDown(boolean block, int timeout) {
* @param block Block until the system really quiets down and no builds are running
* @param timeout If non-zero, only block up to the specified number of milliseconds
* @param message Quiet reason that will be visible to user
- * @deprecated since 2.378; use {@link #doQuietDown2(boolean, int, String, boolean)} instead.
+ * @deprecated since TODO; use {@link #doQuietDown2(boolean, int, String, boolean)} instead.
*/
@Deprecated
public HttpRedirect doQuietDown(@QueryParameter boolean block,
@@ -4118,7 +4118,7 @@ public HttpRedirect doQuietDown(@QueryParameter boolean block,
* @param timeout If non-zero, only block up to the specified number of milliseconds
* @param message Quiet reason that will be visible to user
* @param safeRestart If the quietDown is for a safeRestart
- * @since 2.378
+ * @since TODO
*/
@RequirePOST
public HttpRedirect doQuietDown2(@QueryParameter boolean block,
@@ -4525,7 +4525,7 @@ public void doRestart(StaplerRequest req, StaplerResponse rsp) throws IOExceptio
*
* This first replaces "app" to {@link HudsonIsRestarting}
*
- * @deprecated since 2.378; use {@link #doSafeRestart2(StaplerRequest, String)} instead.
+ * @deprecated since TODO; use {@link #doSafeRestart2(StaplerRequest, String)} instead.
*
*/
@Deprecated
@@ -4538,7 +4538,7 @@ public HttpResponse doSafeRestart(StaplerRequest req) throws IOException, Servle
*
* This first replaces "app" to {@link HudsonIsRestarting}
*
- * @since 2.378
+ * @since TODO
*/
@CLIMethod(name = "safe-restart")
public HttpResponse doSafeRestart2(StaplerRequest req, @QueryParameter("message") String message) throws IOException, ServletException, RestartNotSupportedException {
@@ -4592,7 +4592,7 @@ public void run() {
/**
* Queues up a restart to be performed once there are no builds currently running.
- * @deprecated since 2.378; use {@link #safeRestart(String)} instead.
+ * @deprecated since TODO; use {@link #safeRestart(String)} instead.
*/
@Deprecated
public void safeRestart() throws RestartNotSupportedException {
@@ -4602,7 +4602,7 @@ public void safeRestart() throws RestartNotSupportedException {
/**
* Queues up a restart to be performed once there are no builds currently running.
* @param message the message to show to users in the shutdown banner.
- * @since 2.378
+ * @since TODO
*/
public void safeRestart(String message) throws RestartNotSupportedException {
final Lifecycle lifecycle = restartableLifecycle();
From bcbffe16faacaf378ead41d68068d01a26757d29 Mon Sep 17 00:00:00 2001
From: Jan Meiswinkel
Date: Fri, 18 Nov 2022 11:09:50 +0100
Subject: [PATCH 08/36] Restrict isPreparingSafeRestart()
Co-authored-by: Daniel Beck <1831569+daniel-beck@users.noreply.github.com>
---
core/src/main/java/jenkins/model/Jenkins.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/core/src/main/java/jenkins/model/Jenkins.java b/core/src/main/java/jenkins/model/Jenkins.java
index 44ffa508b291..9d608709b35f 100644
--- a/core/src/main/java/jenkins/model/Jenkins.java
+++ b/core/src/main/java/jenkins/model/Jenkins.java
@@ -2929,6 +2929,7 @@ public boolean isQuietingDown() {
* Returns if the quietingDown is a safe restart.
* @since TODO
*/
+ @Restricted(NoExternalUse.class)
public boolean isPreparingSafeRestart() {
if (quietDownInfo == null) {
return false;
From 402b30cb1e83a6172928594c88d2675d6231da39 Mon Sep 17 00:00:00 2001
From: "Meiswinkel, Jan SF/HZA-ZC2S"
Date: Mon, 16 Jan 2023 16:31:33 +0100
Subject: [PATCH 09/36] Remove duplicate code
---
.../java/hudson/util/HudsonIsRestarting.java | 11 +++++
core/src/main/java/jenkins/model/Jenkins.java | 3 +-
.../jenkins/util/JenkinsIsSafeRestarting.java | 48 -------------------
3 files changed, 12 insertions(+), 50 deletions(-)
delete mode 100644 core/src/main/java/jenkins/util/JenkinsIsSafeRestarting.java
diff --git a/core/src/main/java/hudson/util/HudsonIsRestarting.java b/core/src/main/java/hudson/util/HudsonIsRestarting.java
index a0dccc545a71..22a7d3ead1d6 100644
--- a/core/src/main/java/hudson/util/HudsonIsRestarting.java
+++ b/core/src/main/java/hudson/util/HudsonIsRestarting.java
@@ -41,8 +41,19 @@
* @author Kohsuke Kawaguchi
*/
public class HudsonIsRestarting {
+ private boolean safeRestart;
+ public HudsonIsRestarting(boolean safeRestart) {
+ this.safeRestart = safeRestart;
+ }
+ public HudsonIsRestarting() {
+ this.safeRestart = false;
+ }
public void doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, InterruptedException {
rsp.setStatus(SC_SERVICE_UNAVAILABLE);
req.getView(this, "index.jelly").forward(req, rsp);
}
+
+ public boolean isSafeRestart() {
+ return safeRestart;
+ }
}
diff --git a/core/src/main/java/jenkins/model/Jenkins.java b/core/src/main/java/jenkins/model/Jenkins.java
index 28b20eee81c9..16cf146b8418 100644
--- a/core/src/main/java/jenkins/model/Jenkins.java
+++ b/core/src/main/java/jenkins/model/Jenkins.java
@@ -280,7 +280,6 @@
import jenkins.security.stapler.StaplerFilteredActionListener;
import jenkins.security.stapler.TypedFilter;
import jenkins.slaves.WorkspaceLocator;
-import jenkins.util.JenkinsIsSafeRestarting;
import jenkins.util.JenkinsJVM;
import jenkins.util.Listeners;
import jenkins.util.SystemProperties;
@@ -4634,7 +4633,7 @@ public void run() {
doQuietDown2(true, 0, message, true);
// Make sure isQuietingDown is still true.
if (isQuietingDown()) {
- servletContext.setAttribute("app", new JenkinsIsSafeRestarting());
+ servletContext.setAttribute("app", new HudsonIsRestarting(true));
// give some time for the browser to load the "reloading" page
lifecycle.onStatusUpdate("Restart in 10 seconds");
Thread.sleep(TimeUnit.SECONDS.toMillis(10));
diff --git a/core/src/main/java/jenkins/util/JenkinsIsSafeRestarting.java b/core/src/main/java/jenkins/util/JenkinsIsSafeRestarting.java
deleted file mode 100644
index a079a83e97f6..000000000000
--- a/core/src/main/java/jenkins/util/JenkinsIsSafeRestarting.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * The MIT License
- *
- * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package jenkins.util;
-
-import static javax.servlet.http.HttpServletResponse.SC_SERVICE_UNAVAILABLE;
-
-import java.io.IOException;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import org.kohsuke.stapler.StaplerRequest;
-import org.kohsuke.stapler.StaplerResponse;
-
-/**
- * Model object used to display "Hudson is restarting".
- *
- * Set this object to {@link ServletContext#setAttribute(String, Object)} "app" while
- * the loading activity is taking place.
- *
- * @author Kohsuke Kawaguchi
- */
-public class JenkinsIsSafeRestarting {
- public void doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, InterruptedException {
- rsp.setStatus(SC_SERVICE_UNAVAILABLE);
- req.getView(this, "index.jelly").forward(req, rsp);
- }
-}
From d4fe2b73c0071eda1d021e5df7cc282818020908 Mon Sep 17 00:00:00 2001
From: "Meiswinkel, Jan SF/HZA-ZC2S"
Date: Tue, 17 Jan 2023 08:58:21 +0100
Subject: [PATCH 10/36] Add conditional jelly tag for safe restart
---
.../java/hudson/util/HudsonIsRestarting.java | 2 +-
core/src/main/java/jenkins/model/Jenkins.java | 22 +++---
.../util/HudsonIsRestarting/index.jelly | 6 ++
.../jenkins/model/Jenkins/_safeRestart.jelly | 2 +-
.../util/JenkinsIsSafeRestarting/index.jelly | 68 -------------------
.../index_bg.properties | 26 -------
.../index_da.properties | 24 -------
.../index_de.properties | 6 --
.../index_es.properties | 24 -------
.../index_fr.properties | 24 -------
.../index_it.properties | 29 --------
.../index_ja.properties | 26 -------
.../index_nb_NO.properties | 4 --
.../index_nl.properties | 24 -------
.../index_pt_BR.properties | 25 -------
.../index_ru.properties | 4 --
.../index_sr.properties | 4 --
.../index_uk.properties | 4 --
.../index_zh_TW.properties | 24 -------
19 files changed, 19 insertions(+), 329 deletions(-)
delete mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index.jelly
delete mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_bg.properties
delete mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_da.properties
delete mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_de.properties
delete mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_es.properties
delete mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_fr.properties
delete mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_it.properties
delete mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_ja.properties
delete mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_nb_NO.properties
delete mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_nl.properties
delete mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_pt_BR.properties
delete mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_ru.properties
delete mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_sr.properties
delete mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_uk.properties
delete mode 100644 core/src/main/resources/jenkins/util/JenkinsIsSafeRestarting/index_zh_TW.properties
diff --git a/core/src/main/java/hudson/util/HudsonIsRestarting.java b/core/src/main/java/hudson/util/HudsonIsRestarting.java
index 22a7d3ead1d6..2b8b1fd121d7 100644
--- a/core/src/main/java/hudson/util/HudsonIsRestarting.java
+++ b/core/src/main/java/hudson/util/HudsonIsRestarting.java
@@ -53,7 +53,7 @@ public void doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOExceptio
req.getView(this, "index.jelly").forward(req, rsp);
}
- public boolean isSafeRestart() {
+ public boolean getSafeRestart() {
return safeRestart;
}
}
diff --git a/core/src/main/java/jenkins/model/Jenkins.java b/core/src/main/java/jenkins/model/Jenkins.java
index 16cf146b8418..a2790da3a7e1 100644
--- a/core/src/main/java/jenkins/model/Jenkins.java
+++ b/core/src/main/java/jenkins/model/Jenkins.java
@@ -4098,7 +4098,7 @@ public synchronized HttpRedirect doQuietDown() {
*
* @param block Block until the system really quiets down and no builds are running
* @param timeout If non-zero, only block up to the specified number of milliseconds
- * @deprecated since 2.267; use {@link #doQuietDown2(boolean, int, String, boolean)} instead.
+ * @deprecated since 2.267; use {@link #doQuietDown(boolean, int, String, boolean)} instead.
*/
@Deprecated
public synchronized HttpRedirect doQuietDown(boolean block, int timeout) {
@@ -4115,14 +4115,14 @@ public synchronized HttpRedirect doQuietDown(boolean block, int timeout) {
* @param block Block until the system really quiets down and no builds are running
* @param timeout If non-zero, only block up to the specified number of milliseconds
* @param message Quiet reason that will be visible to user
- * @deprecated since TODO; use {@link #doQuietDown2(boolean, int, String, boolean)} instead.
+ * @deprecated since TODO; use {@link #doQuietDown(boolean, int, String, boolean)} instead.
*/
@Deprecated
- public HttpRedirect doQuietDown(@QueryParameter boolean block,
- @QueryParameter int timeout,
- @QueryParameter @CheckForNull String message) throws InterruptedException, IOException {
+ public HttpRedirect doQuietDown(boolean block,
+ int timeout,
+ @CheckForNull String message) throws InterruptedException, IOException {
- return doQuietDown2(block, timeout, message, false);
+ return doQuietDown(block, timeout, message, false);
}
/**
@@ -4135,7 +4135,7 @@ public HttpRedirect doQuietDown(@QueryParameter boolean block,
* @since TODO
*/
@RequirePOST
- public HttpRedirect doQuietDown2(@QueryParameter boolean block,
+ public HttpRedirect doQuietDown(@QueryParameter boolean block,
@QueryParameter int timeout,
@QueryParameter @CheckForNull String message, @QueryParameter boolean safeRestart) throws InterruptedException, IOException {
synchronized (this) {
@@ -4539,12 +4539,12 @@ public void doRestart(StaplerRequest req, StaplerResponse rsp) throws IOExceptio
*
* This first replaces "app" to {@link HudsonIsRestarting}
*
- * @deprecated since TODO; use {@link #doSafeRestart2(StaplerRequest, String)} instead.
+ * @deprecated since TODO; use {@link #doSafeRestart(StaplerRequest, String)} instead.
*
*/
@Deprecated
public HttpResponse doSafeRestart(StaplerRequest req) throws IOException, ServletException, RestartNotSupportedException {
- return doSafeRestart2(req, null);
+ return doSafeRestart(req, null);
}
/**
@@ -4555,7 +4555,7 @@ public HttpResponse doSafeRestart(StaplerRequest req) throws IOException, Servle
* @since TODO
*/
@CLIMethod(name = "safe-restart")
- public HttpResponse doSafeRestart2(StaplerRequest req, @QueryParameter("message") String message) throws IOException, ServletException, RestartNotSupportedException {
+ public HttpResponse doSafeRestart(StaplerRequest req, @QueryParameter("message") String message) throws IOException, ServletException, RestartNotSupportedException {
checkPermission(MANAGE);
if (req != null && req.getMethod().equals("GET"))
return HttpResponses.forwardToView(this, "_safeRestart.jelly");
@@ -4630,7 +4630,7 @@ public void run() {
try (ACLContext ctx = ACL.as2(ACL.SYSTEM2)) {
// Wait 'til we have no active executors.
- doQuietDown2(true, 0, message, true);
+ doQuietDown(true, 0, message, true);
// Make sure isQuietingDown is still true.
if (isQuietingDown()) {
servletContext.setAttribute("app", new HudsonIsRestarting(true));
diff --git a/core/src/main/resources/hudson/util/HudsonIsRestarting/index.jelly b/core/src/main/resources/hudson/util/HudsonIsRestarting/index.jelly
index 63c501a8426e..aadae0e98783 100644
--- a/core/src/main/resources/hudson/util/HudsonIsRestarting/index.jelly
+++ b/core/src/main/resources/hudson/util/HudsonIsRestarting/index.jelly
@@ -56,6 +56,12 @@ THE SOFTWARE.
${%Your browser will reload automatically when Jenkins is ready.}
+
+
+ ${%Safe Restart} ${%Jobs on agents can usually continue.}
+
+
+
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly
index a8e28490ec77..cbd58d27e443 100644
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly
+++ b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly
@@ -31,7 +31,7 @@ THE SOFTWARE.
-
- ${%The Jenkins Controller is going to shut down. No further jobs will be accepted.}
+ ${%The Jenkins Controller is going to shut down. No new builds can be started.}
From 09243fc47b377fd637e35553a645df976bb87af8 Mon Sep 17 00:00:00 2001
From: "Meiswinkel, Jan SF/HZA-ZC2S"
Date: Wed, 18 Jan 2023 13:42:12 +0100
Subject: [PATCH 16/36] Adapt comments, messages and translations
---
core/src/main/java/jenkins/model/Jenkins.java | 9 +++------
.../resources/jenkins/model/Jenkins/_safeRestart.jelly | 2 +-
.../jenkins/model/Jenkins/_safeRestart.properties | 2 +-
core/src/main/resources/lib/layout/main-panel.jelly | 2 +-
.../main/resources/lib/layout/main-panel_de.properties | 1 +
5 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/core/src/main/java/jenkins/model/Jenkins.java b/core/src/main/java/jenkins/model/Jenkins.java
index 67f6265f6a8a..7364bdff13fd 100644
--- a/core/src/main/java/jenkins/model/Jenkins.java
+++ b/core/src/main/java/jenkins/model/Jenkins.java
@@ -4534,9 +4534,7 @@ public void doRestart(StaplerRequest req, StaplerResponse rsp) throws IOExceptio
}
/**
- * Queues up a restart of Jenkins for when there are no builds running, if we can.
- *
- * This first replaces "app" to {@link HudsonIsRestarting}
+ * Queues up a safe restart of Jenkins. Jobs have to finish or pause before it can proceed. No new jobs are accepted.
*
* @deprecated since TODO; use {@link #doSafeRestart(StaplerRequest, String)} instead.
*
@@ -4547,9 +4545,7 @@ public HttpResponse doSafeRestart(StaplerRequest req) throws IOException, Servle
}
/**
- * Queues up a restart of Jenkins for when there are no builds running, if we can.
- *
- * This first replaces "app" to {@link HudsonIsRestarting}
+ * Queues up a safe restart of Jenkins. Jobs have to finish or pause before it can proceed. No new jobs are accepted.
*
* @since TODO
*/
@@ -5827,6 +5823,7 @@ private static final class QuietDownInfo {
this.safeRestart = safeRestart;
}
+ @NonNull
boolean isSafeRestart() {
return safeRestart;
}
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly
index cbd58d27e443..8d65e61b9a4f 100644
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly
+++ b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly
@@ -33,7 +33,7 @@ THE SOFTWARE.
- ${%The Jenkins Controller is restarting gently. No further jobs are accepted. Running jobs automatically continue afterwards.}
+ ${%The Jenkins Controller is restarting safely. Running builds will finish or continue afterwards, depending on the job type. No new builds can be started.}
diff --git a/core/src/main/resources/lib/layout/main-panel_de.properties b/core/src/main/resources/lib/layout/main-panel_de.properties
index 370bd836a5c8..4e53c3245cb9 100644
--- a/core/src/main/resources/lib/layout/main-panel_de.properties
+++ b/core/src/main/resources/lib/layout/main-panel_de.properties
@@ -1 +1,2 @@
Jenkins\ is\ going\ to\ shut\ down=Jenkins wird heruntergefahren
+The\ Jenkins\ Controller\ is\ restarting\ safely.\ Running\ builds\ will\ finish\ or\ continue\ afterwards,\ depending\ on\ the\ job\ type.\ No\ new\ builds\ can\ be\ started.=Jenkins wird sicher neugestartet. Laufende Jobs werden entweder beendet oder laufen nach dem Restart weiter, abhängig vom Jobtyp. Es können keine weiteren Jobs gestartet werden.
From 1e5074eafcc934aad4717d2180f59d8ec660b5d7 Mon Sep 17 00:00:00 2001
From: "Meiswinkel, Jan SF/HZA-ZC2S"
Date: Wed, 18 Jan 2023 16:00:43 +0100
Subject: [PATCH 17/36] Adapt translation
---
core/src/main/resources/lib/layout/main-panel_de.properties | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/core/src/main/resources/lib/layout/main-panel_de.properties b/core/src/main/resources/lib/layout/main-panel_de.properties
index 4e53c3245cb9..c0b0106505ba 100644
--- a/core/src/main/resources/lib/layout/main-panel_de.properties
+++ b/core/src/main/resources/lib/layout/main-panel_de.properties
@@ -1,2 +1,2 @@
-Jenkins\ is\ going\ to\ shut\ down=Jenkins wird heruntergefahren
+The\ Jenkins\ Controller\ is\ going\ to\ shut\ down.\ No\ new\ builds\ can\ be\ started.=Jenkins wird heruntergefahren. Es werden keine weiteren Jobs angenommen und laufende Jobs werden pausiert
The\ Jenkins\ Controller\ is\ restarting\ safely.\ Running\ builds\ will\ finish\ or\ continue\ afterwards,\ depending\ on\ the\ job\ type.\ No\ new\ builds\ can\ be\ started.=Jenkins wird sicher neugestartet. Laufende Jobs werden entweder beendet oder laufen nach dem Restart weiter, abhängig vom Jobtyp. Es können keine weiteren Jobs gestartet werden.
From 989d8361b6f10e9611ae2c45453c42e9c01c66ec Mon Sep 17 00:00:00 2001
From: "Meiswinkel, Jan SF/HZA-ZC2S"
Date: Thu, 19 Jan 2023 13:43:30 +0100
Subject: [PATCH 18/36] Update translations and move messages to dedicated file
---
core/src/main/resources/lib/layout/main-panel.jelly | 4 ++--
core/src/main/resources/lib/layout/main-panel.properties | 2 ++
core/src/main/resources/lib/layout/main-panel_de.properties | 4 ++--
3 files changed, 6 insertions(+), 4 deletions(-)
create mode 100644 core/src/main/resources/lib/layout/main-panel.properties
diff --git a/core/src/main/resources/lib/layout/main-panel.jelly b/core/src/main/resources/lib/layout/main-panel.jelly
index 89aa68e4b221..ab51015da45d 100644
--- a/core/src/main/resources/lib/layout/main-panel.jelly
+++ b/core/src/main/resources/lib/layout/main-panel.jelly
@@ -38,7 +38,7 @@ THE SOFTWARE.
${app.getQuietDownReason()}
- ${%The Jenkins Controller is restarting safely. Running builds will finish or continue afterwards, depending on the job type. No new builds can be started.}
+ ${%saferestart}
@@ -50,7 +50,7 @@ THE SOFTWARE.
${app.getQuietDownReason()}
- ${%The Jenkins Controller is going to shut down. No new builds can be started.}
+ ${%shutdown}
diff --git a/core/src/main/resources/lib/layout/main-panel.properties b/core/src/main/resources/lib/layout/main-panel.properties
new file mode 100644
index 000000000000..55b368387a92
--- /dev/null
+++ b/core/src/main/resources/lib/layout/main-panel.properties
@@ -0,0 +1,2 @@
+shutdown=The Jenkins Controller is preparing for shutdown. No new builds can be started.
+saferestart=The Jenkins Controller is restarting safely. Running builds will finish or continue afterwards, depending on the job type. No new builds can be started.
diff --git a/core/src/main/resources/lib/layout/main-panel_de.properties b/core/src/main/resources/lib/layout/main-panel_de.properties
index c0b0106505ba..731f4217f839 100644
--- a/core/src/main/resources/lib/layout/main-panel_de.properties
+++ b/core/src/main/resources/lib/layout/main-panel_de.properties
@@ -1,2 +1,2 @@
-The\ Jenkins\ Controller\ is\ going\ to\ shut\ down.\ No\ new\ builds\ can\ be\ started.=Jenkins wird heruntergefahren. Es werden keine weiteren Jobs angenommen und laufende Jobs werden pausiert
-The\ Jenkins\ Controller\ is\ restarting\ safely.\ Running\ builds\ will\ finish\ or\ continue\ afterwards,\ depending\ on\ the\ job\ type.\ No\ new\ builds\ can\ be\ started.=Jenkins wird sicher neugestartet. Laufende Jobs werden entweder beendet oder laufen nach dem Restart weiter, abhängig vom Jobtyp. Es können keine weiteren Jobs gestartet werden.
+shutdown=Jenkins wird heruntergefahren. Es werden keine weiteren Jobs angenommen und laufende Jobs werden pausiert
+saferestart=Jenkins wird sicher neugestartet. Laufende Jobs werden entweder beendet oder laufen nach dem Restart weiter, abhängig vom Jobtyp. Es können keine weiteren Jobs gestartet werden.
From 7f792a36d459016bff5df7b257a62bccb436248d Mon Sep 17 00:00:00 2001
From: Jan Meiswinkel
Date: Thu, 2 Feb 2023 10:34:55 +0100
Subject: [PATCH 19/36] Apply suggestions from @timja
Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com>
---
core/src/main/java/jenkins/model/Jenkins.java | 12 ++++++------
.../util/HudsonIsRestarting/index_de.properties | 4 ++--
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/core/src/main/java/jenkins/model/Jenkins.java b/core/src/main/java/jenkins/model/Jenkins.java
index 7364bdff13fd..e2904d04c62c 100644
--- a/core/src/main/java/jenkins/model/Jenkins.java
+++ b/core/src/main/java/jenkins/model/Jenkins.java
@@ -4114,9 +4114,9 @@ public synchronized HttpRedirect doQuietDown(boolean block, int timeout) {
* @param block Block until the system really quiets down and no builds are running
* @param timeout If non-zero, only block up to the specified number of milliseconds
* @param message Quiet reason that will be visible to user
- * @deprecated since TODO; use {@link #doQuietDown(boolean, int, String, boolean)} instead.
+ * @deprecated use {@link #doQuietDown(boolean, int, String, boolean)} instead.
*/
- @Deprecated
+ @Deprecated(since = "TODO")
public HttpRedirect doQuietDown(boolean block,
int timeout,
@CheckForNull String message) throws InterruptedException, IOException {
@@ -4536,10 +4536,10 @@ public void doRestart(StaplerRequest req, StaplerResponse rsp) throws IOExceptio
/**
* Queues up a safe restart of Jenkins. Jobs have to finish or pause before it can proceed. No new jobs are accepted.
*
- * @deprecated since TODO; use {@link #doSafeRestart(StaplerRequest, String)} instead.
+ * @deprecated use {@link #doSafeRestart(StaplerRequest, String)} instead.
*
*/
- @Deprecated
+ @Deprecated(since = "TODO")
public HttpResponse doSafeRestart(StaplerRequest req) throws IOException, ServletException, RestartNotSupportedException {
return doSafeRestart(req, null);
}
@@ -4601,9 +4601,9 @@ public void run() {
/**
* Queues up a restart to be performed once there are no builds currently running.
- * @deprecated since TODO; use {@link #safeRestart(String)} instead.
+ * @deprecated use {@link #safeRestart(String)} instead.
*/
- @Deprecated
+ @Deprecated(since = "TODO")
public void safeRestart() throws RestartNotSupportedException {
safeRestart(null);
}
diff --git a/core/src/main/resources/hudson/util/HudsonIsRestarting/index_de.properties b/core/src/main/resources/hudson/util/HudsonIsRestarting/index_de.properties
index 49a2071a142f..c85f0930b599 100644
--- a/core/src/main/resources/hudson/util/HudsonIsRestarting/index_de.properties
+++ b/core/src/main/resources/hudson/util/HudsonIsRestarting/index_de.properties
@@ -1,6 +1,6 @@
Please\ wait\ while\ Jenkins\ is\ restarting=Jenkins wird neu gestartet. Bitte warten.
Your\ browser\ will\ reload\ automatically\ when\ Jenkins\ is\ ready.=Der Webbrowser wird diese Seite automatisch neu laden, sobald Jenkins hochgefahren ist.
-Safe\ Restart =Sicherer Neustart
+Safe\ Restart=Sicherer Neustart
Jobs\ on\ agents\ can\ usually\ continue.=Jobs auf Agenten laufen in der Regel weiter.
-Restart =Neustarten
+Restart=Neustarten
Cancel =Abbrechen
\ No newline at end of file
From 0ec33239d53f29ae015cdcaaab514b26e61f27fb Mon Sep 17 00:00:00 2001
From: "Meiswinkel, Jan SF/HZA-ZC2S"
Date: Thu, 2 Feb 2023 10:49:28 +0100
Subject: [PATCH 20/36] Fix message display logic
---
core/src/main/java/hudson/util/HudsonIsRestarting.java | 2 +-
.../main/resources/jenkins/model/Jenkins/_safeRestart.jelly | 2 +-
core/src/main/resources/lib/layout/main-panel.jelly | 2 +-
core/src/main/resources/lib/layout/main-panel_de.properties | 4 ++--
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/core/src/main/java/hudson/util/HudsonIsRestarting.java b/core/src/main/java/hudson/util/HudsonIsRestarting.java
index c7188222bfe1..580a9713a08d 100644
--- a/core/src/main/java/hudson/util/HudsonIsRestarting.java
+++ b/core/src/main/java/hudson/util/HudsonIsRestarting.java
@@ -63,7 +63,7 @@ public void doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOExceptio
/**
* @since TODO
*/
- public boolean getSafeRestart() {
+ public boolean isSafeRestart() {
return safeRestart;
}
}
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly
index 8d65e61b9a4f..50534911f50f 100644
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly
+++ b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly
@@ -33,7 +33,7 @@ THE SOFTWARE.
- ${%Jobs on agents can usually continue.}
+ ${%safeRestartInfo}
diff --git a/core/src/main/resources/hudson/util/HudsonIsRestarting/index_de.properties b/core/src/main/resources/hudson/util/HudsonIsRestarting/index_de.properties
index c923bca9af51..0d503108cb7a 100644
--- a/core/src/main/resources/hudson/util/HudsonIsRestarting/index_de.properties
+++ b/core/src/main/resources/hudson/util/HudsonIsRestarting/index_de.properties
@@ -1,6 +1,6 @@
Please\ wait\ while\ Jenkins\ is\ restarting=Jenkins wird neu gestartet. Bitte warten.
Your\ browser\ will\ reload\ automatically\ when\ Jenkins\ is\ ready.=Der Webbrowser wird diese Seite automatisch neu laden, sobald Jenkins hochgefahren ist.
Safe\ Restart=Sicherer Neustart
-Jobs\ on\ agents\ can\ usually\ continue.=Jobs auf Agenten laufen in der Regel weiter.
+Jobs\ on\ agents\ can\ usually\ continue.=Builds auf Agenten laufen in der Regel weiter.
Restart=Neustarten
Cancel=Abbrechen
\ No newline at end of file
From 1553c0334494c68184f2aeb75c330e1509719d5b Mon Sep 17 00:00:00 2001
From: "Meiswinkel, Jan SF/HZA-ZC2S"
Date: Tue, 23 May 2023 10:00:46 +0200
Subject: [PATCH 33/36] fix: undo translation change
---
.../main/resources/hudson/util/HudsonIsRestarting/index.jelly | 2 +-
.../hudson/util/HudsonIsRestarting/index_de.properties | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/core/src/main/resources/hudson/util/HudsonIsRestarting/index.jelly b/core/src/main/resources/hudson/util/HudsonIsRestarting/index.jelly
index 665aee495314..c51e37e67687 100644
--- a/core/src/main/resources/hudson/util/HudsonIsRestarting/index.jelly
+++ b/core/src/main/resources/hudson/util/HudsonIsRestarting/index.jelly
@@ -62,7 +62,7 @@ THE SOFTWARE.
${%Safe Restart}
- ${%safeRestartInfo}
+ ${%Builds on agents can usually continue.}
diff --git a/core/src/main/resources/hudson/util/HudsonIsRestarting/index_de.properties b/core/src/main/resources/hudson/util/HudsonIsRestarting/index_de.properties
index 0d503108cb7a..1750883d183d 100644
--- a/core/src/main/resources/hudson/util/HudsonIsRestarting/index_de.properties
+++ b/core/src/main/resources/hudson/util/HudsonIsRestarting/index_de.properties
@@ -1,6 +1,6 @@
Please\ wait\ while\ Jenkins\ is\ restarting=Jenkins wird neu gestartet. Bitte warten.
Your\ browser\ will\ reload\ automatically\ when\ Jenkins\ is\ ready.=Der Webbrowser wird diese Seite automatisch neu laden, sobald Jenkins hochgefahren ist.
Safe\ Restart=Sicherer Neustart
-Jobs\ on\ agents\ can\ usually\ continue.=Builds auf Agenten laufen in der Regel weiter.
+Builds\ on\ agents\ can\ usually\ continue.=Builds auf Agenten laufen in der Regel weiter.
Restart=Neustarten
Cancel=Abbrechen
\ No newline at end of file
From b80928cf312491228694c1fc2864ccfd8ba88b44 Mon Sep 17 00:00:00 2001
From: Tim Jacomb
Date: Tue, 23 May 2023 09:25:23 +0100
Subject: [PATCH 34/36] Improve UI
---
.../jenkins/model/Jenkins/_safeRestart.jelly | 39 ++++++++++---------
.../model/Jenkins/_safeRestart.properties | 4 +-
.../Jenkins/_safeRestart_pt_BR.properties | 4 --
3 files changed, 22 insertions(+), 25 deletions(-)
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly
index 50534911f50f..0f1267478a60 100644
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly
+++ b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly
@@ -25,33 +25,36 @@ THE SOFTWARE.
-
+
-
+
+
-
+
${%restartWarning}
+
+
+
+
+
+
+
+
+
${%Jenkins cannot restart itself as currently configured.}
-
-
-
-
-
-
-
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.properties b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.properties
index 79e0cc7c48be..cd4dc2b44181 100644
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.properties
+++ b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.properties
@@ -20,7 +20,5 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-confirmRestart=\
- Are you sure you want to restart Jenkins? \
- Jenkins will try to pause jobs and restart once all running jobs are either finished or paused. \
+restartWarning=Jenkins will try to pause jobs and restart once all running jobs are either finished or paused. \
(Pipeline builds may prevent Jenkins from restarting for a short period of time in some cases, but if so, they will be paused at the next available opportunity and then resumed after Jenkins restarts.)
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_pt_BR.properties b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_pt_BR.properties
index 29dade803852..a50b00575c48 100644
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_pt_BR.properties
+++ b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_pt_BR.properties
@@ -23,7 +23,3 @@
Yes=Sim
Jenkins\ cannot\ restart\ itself\ as\ currently\ configured.=O Jenkins não pode se reiniciar da forma como está \
atualmente configurado.
-confirmRestart=Você tem certeza de que quer reiniciar o Jenkins? Ele irá reiniciar quando todos os trabalhos estiverem \
- terminado. Processos de construção podem impedir que o Jenkins reinicie por um período custo de tempo em alguns \
- casos, mas se isso ocorrer, eles irão ser colocados em pausa assim que possível e então continuarem quando o Jenkins \
- reiniciar.
From b6f78bb1089e1e97b47b5c349a671e6355c52d39 Mon Sep 17 00:00:00 2001
From: Tim Jacomb
Date: Tue, 23 May 2023 22:25:07 +0100
Subject: [PATCH 35/36] UI improvements (and simplified translating of page)
---
core/src/main/java/jenkins/model/Jenkins.java | 7 +++++-
.../jenkins/model/Jenkins/_safeRestart.jelly | 20 +++++++---------
.../model/Jenkins/_safeRestart.properties | 2 ++
.../model/Jenkins/_safeRestart_bg.properties | 4 +---
.../model/Jenkins/_safeRestart_da.properties | 23 -------------------
.../model/Jenkins/_safeRestart_de.properties | 3 +--
.../model/Jenkins/_safeRestart_es.properties | 23 -------------------
.../model/Jenkins/_safeRestart_fr.properties | 23 -------------------
.../model/Jenkins/_safeRestart_it.properties | 3 +--
.../model/Jenkins/_safeRestart_ja.properties | 23 -------------------
.../model/Jenkins/_safeRestart_lt.properties | 3 +--
.../model/Jenkins/_safeRestart_lv.properties | 23 -------------------
.../Jenkins/_safeRestart_pt_BR.properties | 3 +--
.../model/Jenkins/_safeRestart_ru.properties | 3 +--
.../model/Jenkins/_safeRestart_sr.properties | 3 +--
.../Jenkins/_safeRestart_zh_TW.properties | 3 +--
war/src/main/scss/simple-page.scss | 1 -
17 files changed, 24 insertions(+), 146 deletions(-)
delete mode 100644 core/src/main/resources/jenkins/model/Jenkins/_safeRestart_da.properties
delete mode 100644 core/src/main/resources/jenkins/model/Jenkins/_safeRestart_es.properties
delete mode 100644 core/src/main/resources/jenkins/model/Jenkins/_safeRestart_fr.properties
delete mode 100644 core/src/main/resources/jenkins/model/Jenkins/_safeRestart_ja.properties
delete mode 100644 core/src/main/resources/jenkins/model/Jenkins/_safeRestart_lv.properties
diff --git a/core/src/main/java/jenkins/model/Jenkins.java b/core/src/main/java/jenkins/model/Jenkins.java
index 9186526a8a28..17914efda4f2 100644
--- a/core/src/main/java/jenkins/model/Jenkins.java
+++ b/core/src/main/java/jenkins/model/Jenkins.java
@@ -4565,8 +4565,13 @@ public HttpResponse doSafeRestart(StaplerRequest req) throws IOException, Servle
*/
public HttpResponse doSafeRestart(StaplerRequest req, @QueryParameter("message") String message) throws IOException, ServletException, RestartNotSupportedException {
checkPermission(MANAGE);
- if (req != null && req.getMethod().equals("GET"))
+ if (req != null && req.getMethod().equals("GET")) {
return HttpResponses.forwardToView(this, "_safeRestart.jelly");
+ }
+
+ if (req != null && req.getParameter("cancel") != null) {
+ return doCancelQuietDown();
+ }
if (req == null || req.getMethod().equals("POST")) {
safeRestart(message);
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly
index 0f1267478a60..fb33dc32e89c 100644
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly
+++ b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.jelly
@@ -36,23 +36,19 @@ THE SOFTWARE.
-
-
-
-
-
-
-
- ${%Jenkins cannot restart itself as currently configured.}
+ ${%cannotRestart}
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.properties b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.properties
index cd4dc2b44181..e6093c94e436 100644
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.properties
+++ b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart.properties
@@ -20,5 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
+cannotRestart=Jenkins cannot restart itself as currently configured.
+description=This will be displayed on most Jenkins pages, you can use it to let users know what is happening. A default message will be added if you don't supply one.
restartWarning=Jenkins will try to pause jobs and restart once all running jobs are either finished or paused. \
(Pipeline builds may prevent Jenkins from restarting for a short period of time in some cases, but if so, they will be paused at the next available opportunity and then resumed after Jenkins restarts.)
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_bg.properties b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_bg.properties
index 6538046d0207..666e96c8a03f 100644
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_bg.properties
+++ b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_bg.properties
@@ -20,7 +20,5 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-Jenkins\ cannot\ restart\ itself\ as\ currently\ configured.=\
+cannotRestart=\
С текущите си настройки Jenkins не може да се рестартира.
-Yes=\
- Да
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_da.properties b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_da.properties
deleted file mode 100644
index 1d3dcce7bd16..000000000000
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_da.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-# The MIT License
-#
-# Copyright (c) 2004-2010, Sun Microsystems, Inc. Kohsuke Kawaguchi. Knud Poulsen.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-Yes=Ja
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_de.properties b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_de.properties
index 0339ce968f11..bf94beb0d5e6 100644
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_de.properties
+++ b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_de.properties
@@ -20,5 +20,4 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-Yes=Ja
-Jenkins\ cannot\ restart\ itself\ as\ currently\ configured.=Jenkins kann sich wie konfiguriert nicht selbst neu starten.
+cannotRestart=Jenkins kann sich wie konfiguriert nicht selbst neu starten.
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_es.properties b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_es.properties
deleted file mode 100644
index add83dfcb8f4..000000000000
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_es.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-# The MIT License
-#
-# Copyright (c) 2004-2010, Sun Microsystems, Inc.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-Yes=Sí
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_fr.properties b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_fr.properties
deleted file mode 100644
index 885c70af51db..000000000000
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_fr.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-# The MIT License
-#
-# Copyright (c) 2004-2010, Sun Microsystems, Inc.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-Yes=Oui
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_it.properties b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_it.properties
index 8eed9a0ce6e1..7236625bf82e 100644
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_it.properties
+++ b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_it.properties
@@ -21,6 +21,5 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-Jenkins\ cannot\ restart\ itself\ as\ currently\ configured.=Jenkins non può \
+cannotRestart=Jenkins non può \
riavviarsi autononomamente così come configurato attualmente.
-Yes=Sì
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_ja.properties b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_ja.properties
deleted file mode 100644
index b4b315371f24..000000000000
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_ja.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-# The MIT License
-#
-# Copyright (c) 2004-2010, Sun Microsystems, Inc., Seiji Sogabe
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-Yes=はい
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_lt.properties b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_lt.properties
index 5e2bb304fab3..86b8fa4f7937 100644
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_lt.properties
+++ b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_lt.properties
@@ -1,2 +1 @@
-Yes=Taip
-Jenkins\ cannot\ restart\ itself\ as\ currently\ configured.=Toks, kaip dabar sukonfigūruotas, Jenkinas negali pats savęs paleisti iš naujo.
+cannotRestart=Toks, kaip dabar sukonfigūruotas, Jenkinas negali pats savęs paleisti iš naujo.
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_lv.properties b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_lv.properties
deleted file mode 100644
index 6648ea4e403b..000000000000
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_lv.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-# The MIT License
-#
-# Copyright (c) 2004-2010, Sun Microsystems, Inc.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-Yes=Jā
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_pt_BR.properties b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_pt_BR.properties
index a50b00575c48..98a7deea70cb 100644
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_pt_BR.properties
+++ b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_pt_BR.properties
@@ -20,6 +20,5 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-Yes=Sim
-Jenkins\ cannot\ restart\ itself\ as\ currently\ configured.=O Jenkins não pode se reiniciar da forma como está \
+cannotRestart=O Jenkins não pode se reiniciar da forma como está \
atualmente configurado.
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_ru.properties b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_ru.properties
index c35bcb3f7b8d..1e5b14446762 100644
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_ru.properties
+++ b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_ru.properties
@@ -1,2 +1 @@
-Yes=Да
-Jenkins\ cannot\ restart\ itself\ as\ currently\ configured.=В текущей конфигурации Jenkins не может перезапуститься сам.
+cannotRestart=В текущей конфигурации Jenkins не может перезапуститься сам.
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_sr.properties b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_sr.properties
index 57eb4de45f1a..9ef52651a2d3 100644
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_sr.properties
+++ b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_sr.properties
@@ -1,4 +1,3 @@
# This file is under the MIT License by authors
-Yes=Да
-Jenkins\ cannot\ restart\ itself\ as\ currently\ configured.=Неможе се поново покренути Jenkins за овим подешавањима.
+cannotRestart=Неможе се поново покренути Jenkins за овим подешавањима.
diff --git a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_zh_TW.properties b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_zh_TW.properties
index 9f5f465bce40..b91deccbc994 100644
--- a/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_zh_TW.properties
+++ b/core/src/main/resources/jenkins/model/Jenkins/_safeRestart_zh_TW.properties
@@ -21,5 +21,4 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-Yes=是
-Jenkins\ cannot\ restart\ itself\ as\ currently\ configured.=Jenkins 無法在目前的設定值下自行重新啟動。
+cannotRestart=Jenkins 無法在目前的設定值下自行重新啟動。
diff --git a/war/src/main/scss/simple-page.scss b/war/src/main/scss/simple-page.scss
index 8a9852d59a52..86088e68ccfc 100644
--- a/war/src/main/scss/simple-page.scss
+++ b/war/src/main/scss/simple-page.scss
@@ -45,7 +45,6 @@ body {
border-width: 2px;
border-radius: 2px;
border-style: solid;
- width: 50%;
margin: 5% auto auto;
padding: 5px;
}
From 85dc1bdfc03e7883b368e2074b825cda65a6cdae Mon Sep 17 00:00:00 2001
From: Jan Meiswinkel
Date: Thu, 29 Jun 2023 08:24:05 +0200
Subject: [PATCH 36/36] chore: fix description
---
core/src/main/resources/hudson/cli/Messages.properties | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/core/src/main/resources/hudson/cli/Messages.properties b/core/src/main/resources/hudson/cli/Messages.properties
index fd8ac7492e53..15d27a2433b2 100644
--- a/core/src/main/resources/hudson/cli/Messages.properties
+++ b/core/src/main/resources/hudson/cli/Messages.properties
@@ -84,7 +84,7 @@ ReloadConfigurationCommand.ShortDescription=Discard all the loaded data in memor
ConnectNodeCommand.ShortDescription=Reconnect to a node(s)
DisconnectNodeCommand.ShortDescription=Disconnects from a node.
QuietDownCommand.ShortDescription=Quiet down Jenkins, in preparation for a restart. Don’t start any builds.
-SafeRestartCommand.ShortDescription=Safe Restart Jenkins. Don't start any builds and try to existing.
+SafeRestartCommand.ShortDescription=Safe Restart Jenkins. Don’t start any builds.
CancelQuietDownCommand.ShortDescription=Cancel the effect of the "quiet-down" command.
OfflineNodeCommand.ShortDescription=Stop using a node for performing builds temporarily, until the next "online-node" command.
WaitNodeOnlineCommand.ShortDescription=Wait for a node to become online.