From 58cf6fc0dfc93ed625733bf9e9477e8e57e0a9d2 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 27 Jan 2022 08:53:07 -0800
Subject: [PATCH 01/29] Bump `xmlunit.version` from 2.8.4 to 2.9.0 (#6218)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
core/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/core/pom.xml b/core/pom.xml
index 28fbaaaf812bd..af1529aa61b06 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -41,7 +41,7 @@ THE SOFTWARE.
true
2.2
- 2.8.4
+ 2.9.0
From adf23ab2e40d325aaa3ffefcfea0076dd8530bae Mon Sep 17 00:00:00 2001
From: Basil Crow
Date: Thu, 27 Jan 2022 08:56:22 -0800
Subject: [PATCH 02/29] EOL support for JRuby (#6209)
---
core/src/main/java/hudson/util/XStream2.java | 7 ------
.../jenkins/security/whitelisted-classes.txt | 24 -------------------
2 files changed, 31 deletions(-)
diff --git a/core/src/main/java/hudson/util/XStream2.java b/core/src/main/java/hudson/util/XStream2.java
index 2ac02f6062b6e..204fd0e39d851 100644
--- a/core/src/main/java/hudson/util/XStream2.java
+++ b/core/src/main/java/hudson/util/XStream2.java
@@ -81,7 +81,6 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
-import java.util.regex.Pattern;
import jenkins.model.Jenkins;
import jenkins.util.xstream.SafeURLConverter;
@@ -570,18 +569,12 @@ public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext co
throw new ConversionException("Refusing to unmarshal " + reader.getNodeName() + " for security reasons; see https://www.jenkins.io/redirect/class-filter/");
}
- /** TODO see comment in {@code whitelisted-classes.txt} */
- private static final Pattern JRUBY_PROXY = Pattern.compile("org[.]jruby[.]proxy[.].+[$]Proxy\\d+");
-
@Override
public boolean canConvert(Class type) {
if (type == null) {
return false;
}
String name = type.getName();
- if (JRUBY_PROXY.matcher(name).matches()) {
- return false;
- }
// claim we can convert all the scary stuff so we can throw exceptions when attempting to do so
return ClassFilter.DEFAULT.isBlacklisted(name) || ClassFilter.DEFAULT.isBlacklisted(type);
}
diff --git a/core/src/main/resources/jenkins/security/whitelisted-classes.txt b/core/src/main/resources/jenkins/security/whitelisted-classes.txt
index b7d4049406287..fbcdc1a9de017 100644
--- a/core/src/main/resources/jenkins/security/whitelisted-classes.txt
+++ b/core/src/main/resources/jenkins/security/whitelisted-classes.txt
@@ -135,34 +135,10 @@ org.apache.commons.fileupload.disk.DiskFileItem
org.apache.commons.fileupload.util.FileItemHeadersImpl
org.apache.tools.ant.Location
-# TODO see main ruby-runtime section below
-org.jenkinsci.jruby.JRubyMapper$DynamicProxy
-
# TODO remove when https://github.com/jenkinsci/xtrigger-lib/pull/9 is widely adopted in fstrigger-plugin, urltrigger-plugin, etc.
org.jenkinsci.lib.xtrigger.XTriggerCause
org.jenkinsci.lib.xtrigger.XTriggerCauseAction
-# TODO remove (also XStream2.BlacklistedTypesConverter.JRUBY_PROXY) when Ruby Runtime is fixed
-# Related PRs:
-# - https://github.com/jenkinsci/ruby-runtime-plugin/pull/5,
-# - https://github.com/jenkinsci/ruby-runtime-plugin/pull/6
-#
-# oleg-nenashev in PR#6 we are trying to get help from last maintainers due to the plugin codebase splitbrain.
-# It is required to fix JENKINS-50616 in a proper way for 2.107.x
-org.jruby.RubyArray
-org.jruby.RubyBignum
-org.jruby.RubyBoolean
-org.jruby.RubyBoolean$False
-org.jruby.RubyBoolean$True
-org.jruby.RubyFixnum
-org.jruby.RubyHash
-org.jruby.RubyNil
-org.jruby.RubyObject
-org.jruby.RubyString
-org.jruby.RubySymbol
-org.jruby.java.proxies.ConcreteJavaProxy
-org.jruby.runtime.builtin.IRubyObject
-
org.jvnet.hudson.MemoryUsage
org.jvnet.localizer.Localizable
org.jvnet.localizer.ResourceBundleHolder
From 726c68cf5a6a29d53ba2cb177a66a28c43ae1f1a Mon Sep 17 00:00:00 2001
From: EBIBO
Date: Fri, 28 Jan 2022 19:01:38 +0800
Subject: [PATCH 03/29] [JENKINS-67496] Drag & drop is messed up, drag
placeholders always have tiny size (#6184)
---
war/src/main/js/sortable-drag-drop.js | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/war/src/main/js/sortable-drag-drop.js b/war/src/main/js/sortable-drag-drop.js
index 84217f3ce2382..4130af451f915 100644
--- a/war/src/main/js/sortable-drag-drop.js
+++ b/war/src/main/js/sortable-drag-drop.js
@@ -23,6 +23,14 @@ function registerSortableDragDrop(e) {
forceFallback: true, // Do not use html5 drag & drop behaviour because it does not work with autoscroll
scroll: true,
bubbleScroll: true,
+ onChoose: function (event) {
+ const draggableDiv = event.item;
+ const height = draggableDiv.clientHeight;
+ draggableDiv.style.height = `${height}px`;
+ },
+ onUnchoose: function (event) {
+ event.item.style.removeProperty('height');
+ }
});
}
From 4a7d59496b1abb68b9a10c5babeac12ad8506561 Mon Sep 17 00:00:00 2001
From: Wadeck Follonier
Date: Fri, 28 Jan 2022 12:03:08 +0100
Subject: [PATCH 04/29] [JENKINS-67674] Update bundled dependencies after the
advisory (#6180)
Co-authored-by: Daniel Beck
---
.../hudson/model/AbstractProjectTest.java | 10 +++
war/pom.xml | 84 ++++++++++++++++++-
2 files changed, 90 insertions(+), 4 deletions(-)
diff --git a/test/src/test/java/hudson/model/AbstractProjectTest.java b/test/src/test/java/hudson/model/AbstractProjectTest.java
index d26f4d81f692f..105b4ea01a78d 100644
--- a/test/src/test/java/hudson/model/AbstractProjectTest.java
+++ b/test/src/test/java/hudson/model/AbstractProjectTest.java
@@ -438,6 +438,16 @@ public void configDotXmlSubmissionToDifferentType() throws Exception {
tpm.installDetachedPlugin("scm-api");
tpm.installDetachedPlugin("workflow-api");
tpm.installDetachedPlugin("script-security");
+ tpm.installDetachedPlugin("jquery3-api");
+ tpm.installDetachedPlugin("snakeyaml-api");
+ tpm.installDetachedPlugin("jackson2-api");
+ tpm.installDetachedPlugin("popper-api");
+ tpm.installDetachedPlugin("plugin-util-api");
+ tpm.installDetachedPlugin("font-awesome-api");
+ tpm.installDetachedPlugin("bootstrap4-api");
+ tpm.installDetachedPlugin("echarts-api");
+ tpm.installDetachedPlugin("display-url-api");
+ tpm.installDetachedPlugin("checks-api");
tpm.installDetachedPlugin("junit");
tpm.installDetachedPlugin("matrix-project");
diff --git a/war/pom.xml b/war/pom.xml
index e0c5d5f6e171a..034f1e06c29ae 100644
--- a/war/pom.xml
+++ b/war/pom.xml
@@ -258,13 +258,13 @@ THE SOFTWARE.
org.jenkins-ci.plugins
display-url-api
- 2.3.1
+ 2.3.4
hpi
org.jenkins-ci.plugins
mailer
- 1.32.1
+ 408.vd726a_1130320
hpi
@@ -288,7 +288,7 @@ THE SOFTWARE.
org.jenkins-ci.plugins
matrix-project
- 1.18
+ 1.20
hpi
@@ -300,7 +300,7 @@ THE SOFTWARE.
org.jenkins-ci.plugins
junit
- 1.29
+ 1.47
hpi
@@ -310,6 +310,82 @@ THE SOFTWARE.
2.42
hpi
+
+
+ io.jenkins.plugins
+ plugin-util-api
+ 1.5.0
+ hpi
+
+
+
+ io.jenkins.plugins
+ bootstrap4-api
+ 4.5.3-1
+ hpi
+
+
+
+ io.jenkins.plugins
+ checks-api
+ 1.1.1
+ hpi
+
+
+
+ org.jenkins-ci.plugins
+ jackson2-api
+ 2.12.0
+ hpi
+
+
+
+ io.jenkins.plugins
+ echarts-api
+ 4.9.0-2
+ hpi
+
+
+
+
+ io.jenkins.plugins
+ snakeyaml-api
+ 1.27.0
+ hpi
+
+
+
+
+ io.jenkins.plugins
+ jquery3-api
+ 3.5.1-2
+ hpi
+
+
+
+
+ org.jenkins-ci.plugins
+ jackson2-api
+ 2.12.0
+ hpi
+
+
+
+
+ io.jenkins.plugins
+ popper-api
+ 1.16.0-7
+ hpi
+
+
+
+
+ io.jenkins.plugins
+ font-awesome-api
+ 5.15.1-1
+ hpi
+
+
org.jenkins-ci.plugins.workflow
From 1af49f99754a73e6f5a997f576a339a43d4bffe4 Mon Sep 17 00:00:00 2001
From: Basil Crow
Date: Fri, 28 Jan 2022 09:06:40 -0800
Subject: [PATCH 05/29] Exclude newer versions of `tyrus-standalone-client-jdk`
that require Java 11 (#6227)
---
.github/dependabot.yml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 9cec7116807de..891d18c8a469f 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -23,6 +23,9 @@ updates:
- dependency-name: "javax.servlet.servlet-api"
# needs a jakarta upgrade project, imports changed
- dependency-name: "jakarta.servlet.jsp.jstl.jakarta.servlet.jsp.jstl-api"
+ # Starting with version 2.0.2, this library requires Java 11
+ - dependency-name: "org.glassfish.tyrus.bundles:tyrus-standalone-client-jdk"
+ versions: [">=2.0.2"]
# see https://github.com/jenkinsci/jenkins/pull/4224 can't be updated without breaking api
- dependency-name: "org.jfree:jfreechart"
# the dependency is actually provided by the Web container, hence it is aligned with Jetty. See https://github.com/jenkinsci/jenkins/pull/5211
From 691bc959c5b46b15c75e927935a93cd2c8026342 Mon Sep 17 00:00:00 2001
From: NivKeidan <51288016+NivKeidan@users.noreply.github.com>
Date: Sun, 30 Jan 2022 10:40:47 +0000
Subject: [PATCH 06/29] JENKINS-67635 consider agent label expressions when
applying trimLabels (#6193)
---
core/src/main/java/jenkins/model/Jenkins.java | 2 +-
.../hudson/slaves/NodeProvisionerTest.java | 85 +++++++++++++++++++
2 files changed, 86 insertions(+), 1 deletion(-)
diff --git a/core/src/main/java/jenkins/model/Jenkins.java b/core/src/main/java/jenkins/model/Jenkins.java
index a9323a48bf700..b52340f0cee52 100644
--- a/core/src/main/java/jenkins/model/Jenkins.java
+++ b/core/src/main/java/jenkins/model/Jenkins.java
@@ -2268,7 +2268,7 @@ private void trimLabels(@CheckForNull Set includedLabels) {
this.getNodes().forEach(n -> nodeLabels.addAll(n.getAssignedLabels()));
for (Iterator
-
-
diff --git a/test/src/test/java/hudson/util/LogTaskListenerTest.java b/test/src/test/java/hudson/util/LogTaskListenerTest.java
index 72b89f64a2058..f1dad026f5d62 100644
--- a/test/src/test/java/hudson/util/LogTaskListenerTest.java
+++ b/test/src/test/java/hudson/util/LogTaskListenerTest.java
@@ -30,6 +30,7 @@
import hudson.model.TaskListener;
import java.util.logging.Level;
import java.util.logging.Logger;
+import jenkins.security.MasterToSlaveCallable;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
@@ -56,4 +57,28 @@ public void annotations() throws Exception {
assertEquals("[plain line, from annotate, from hyperlink, there from encoded]", logging.getMessages().toString());
}
+ @Test
+ public void serialization() throws Exception {
+ TaskListener l = new LogTaskListener(Logger.getLogger("LogTaskListenerTest"), Level.INFO);
+ r.createOnlineSlave().getChannel().call(new Log(l));
+ assertEquals("[from agent]", logging.getMessages().toString());
+ }
+
+ private static final class Log extends MasterToSlaveCallable {
+
+ private final TaskListener l;
+
+ Log(TaskListener l) {
+ this.l = l;
+ }
+
+ @Override
+ public Void call() throws RuntimeException {
+ l.getLogger().println("from agent");
+ l.getLogger().flush();
+ return null;
+ }
+
+ }
+
}
From 405e97779732ccae7aefa7c47009bfd63394b20c Mon Sep 17 00:00:00 2001
From: Basil Crow
Date: Mon, 31 Jan 2022 07:51:23 -0800
Subject: [PATCH 13/29] Notify `systemd(1)` about start-up completion and other
service status changes (#6228)
---
core/src/main/java/hudson/WebAppMain.java | 2 +-
.../main/java/hudson/lifecycle/Lifecycle.java | 54 ++++++++++++++++
.../hudson/lifecycle/SystemdLifecycle.java | 62 +++++++++++++++++++
core/src/main/java/jenkins/model/Jenkins.java | 26 ++++----
4 files changed, 131 insertions(+), 13 deletions(-)
create mode 100644 core/src/main/java/hudson/lifecycle/SystemdLifecycle.java
diff --git a/core/src/main/java/hudson/WebAppMain.java b/core/src/main/java/hudson/WebAppMain.java
index b4b24f858fd6c..04d9aae1aa8ce 100644
--- a/core/src/main/java/hudson/WebAppMain.java
+++ b/core/src/main/java/hudson/WebAppMain.java
@@ -255,7 +255,7 @@ public void run() {
Files.deleteIfExists(BootFailure.getBootFailureFile(_home).toPath());
// at this point we are open for business and serving requests normally
- LOGGER.info("Jenkins is fully up and running");
+ Jenkins.get().getLifecycle().onReady();
success = true;
} catch (Error e) {
new HudsonFailedToLoad(e).publish(context, _home);
diff --git a/core/src/main/java/hudson/lifecycle/Lifecycle.java b/core/src/main/java/hudson/lifecycle/Lifecycle.java
index 8e84179b5a0fb..a46452420ec6a 100644
--- a/core/src/main/java/hudson/lifecycle/Lifecycle.java
+++ b/core/src/main/java/hudson/lifecycle/Lifecycle.java
@@ -24,6 +24,8 @@
package hudson.lifecycle;
+import edu.umd.cs.findbugs.annotations.CheckForNull;
+import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.ExtensionPoint;
import hudson.Functions;
import hudson.Util;
@@ -107,6 +109,9 @@ public void verifyRestartable() throws RestartNotSupportedException {
} else if (System.getenv("SMF_FMRI") != null && System.getenv("SMF_RESTARTER") != null) {
// when we are run by Solaris SMF, these environment variables are set.
instance = new SolarisSMFLifecycle();
+ } else if (System.getenv("NOTIFY_SOCKET") != null) {
+ // When we are running under systemd with Type=notify, this environment variable is set.
+ instance = new SystemdLifecycle();
} else {
// if run on Unix, we can do restart
try {
@@ -232,5 +237,54 @@ public boolean canRestart() {
}
}
+ /**
+ * Called when Jenkins startup is finished or when Jenkins has finished reloading its
+ * configuration.
+ */
+ public void onReady() {
+ LOGGER.log(Level.INFO, "Jenkins is fully up and running");
+ }
+
+ /**
+ * Called when Jenkins is reloading its configuration.
+ *
+ * Callers must also send an {@link #onReady()} notification when Jenkins has finished
+ * reloading its configuration.
+ */
+ public void onReload(@NonNull String user, @CheckForNull String remoteAddr) {
+ if (remoteAddr != null) {
+ LOGGER.log(
+ Level.INFO,
+ "Reloading Jenkins as requested by {0} from {1}",
+ new Object[] {user, remoteAddr});
+ } else {
+ LOGGER.log(Level.INFO, "Reloading Jenkins as requested by {0}", user);
+ }
+ }
+
+ /**
+ * Called when Jenkins is beginning its shutdown.
+ */
+ public void onStop(@NonNull String user, @CheckForNull String remoteAddr) {
+ if (remoteAddr != null) {
+ LOGGER.log(
+ Level.INFO,
+ "Stopping Jenkins as requested by {0} from {1}",
+ new Object[] {user, remoteAddr});
+ } else {
+ LOGGER.log(Level.INFO, "Stopping Jenkins as requested by {0}", user);
+ }
+ }
+
+ /**
+ * Called when Jenkins service state has changed.
+ *
+ * @param status The status string. This is free-form and can be used for various purposes:
+ * general state feedback, completion percentages, human-readable error message, etc.
+ */
+ public void onStatusUpdate(String status) {
+ LOGGER.log(Level.INFO, status);
+ }
+
private static final Logger LOGGER = Logger.getLogger(Lifecycle.class.getName());
}
diff --git a/core/src/main/java/hudson/lifecycle/SystemdLifecycle.java b/core/src/main/java/hudson/lifecycle/SystemdLifecycle.java
new file mode 100644
index 0000000000000..7ff1f5ca176e2
--- /dev/null
+++ b/core/src/main/java/hudson/lifecycle/SystemdLifecycle.java
@@ -0,0 +1,62 @@
+package hudson.lifecycle;
+
+import com.sun.jna.LastErrorException;
+import com.sun.jna.Library;
+import com.sun.jna.Native;
+import edu.umd.cs.findbugs.annotations.CheckForNull;
+import edu.umd.cs.findbugs.annotations.NonNull;
+import hudson.Extension;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.kohsuke.accmod.Restricted;
+import org.kohsuke.accmod.restrictions.NoExternalUse;
+
+/**
+ * {@link Lifecycle} that delegates its responsibility to {@code systemd(1)}.
+ *
+ * @author Basil Crow
+ */
+@Restricted(NoExternalUse.class)
+@Extension(optional = true)
+public class SystemdLifecycle extends ExitLifecycle {
+
+ private static final Logger LOGGER = Logger.getLogger(SystemdLifecycle.class.getName());
+
+ interface Systemd extends Library {
+ Systemd INSTANCE = Native.load("systemd", Systemd.class);
+
+ int sd_notify(int unset_environment, String state) throws LastErrorException;
+ }
+
+ @Override
+ public void onReady() {
+ super.onReady();
+ notify("READY=1");
+ }
+
+ @Override
+ public void onReload(@NonNull String user, @CheckForNull String remoteAddr) {
+ super.onReload(user, remoteAddr);
+ notify("RELOADING=1");
+ }
+
+ @Override
+ public void onStop(@NonNull String user, @CheckForNull String remoteAddr) {
+ super.onStop(user, remoteAddr);
+ notify("STOPPING=1");
+ }
+
+ @Override
+ public void onStatusUpdate(String status) {
+ super.onStatusUpdate(status);
+ notify(String.format("STATUS=%s", status));
+ }
+
+ private static synchronized void notify(String message) {
+ try {
+ Systemd.INSTANCE.sd_notify(0, message);
+ } catch (LastErrorException e) {
+ LOGGER.log(Level.WARNING, null, e);
+ }
+ }
+}
diff --git a/core/src/main/java/jenkins/model/Jenkins.java b/core/src/main/java/jenkins/model/Jenkins.java
index b52340f0cee52..3e20285052da3 100644
--- a/core/src/main/java/jenkins/model/Jenkins.java
+++ b/core/src/main/java/jenkins/model/Jenkins.java
@@ -3564,7 +3564,7 @@ public void cleanUp() {
cleanUpStarted = true;
}
try {
- LOGGER.log(Level.INFO, "Stopping Jenkins");
+ getLifecycle().onStatusUpdate("Stopping Jenkins");
final List errors = new ArrayList<>();
@@ -3596,7 +3596,7 @@ public void cleanUp() {
_cleanUpReleaseAllLoggers(errors);
- LOGGER.log(Level.INFO, "Jenkins stopped");
+ getLifecycle().onStatusUpdate("Jenkins stopped");
if (!errors.isEmpty()) {
StringBuilder message = new StringBuilder("Unexpected issues encountered during cleanUp: ");
@@ -4306,7 +4306,7 @@ public Slave.JnlpJar doJnlpJars(StaplerRequest req) {
@RequirePOST
public synchronized HttpResponse doReload() throws IOException {
checkPermission(MANAGE);
- LOGGER.log(Level.WARNING, "Reloading Jenkins as requested by {0}", getAuthentication2().getName());
+ getLifecycle().onReload(getAuthentication2().getName(), null);
// engage "loading ..." UI and then run the actual task in a separate thread
WebApp.get(servletContext).setApp(new HudsonIsLoading());
@@ -4316,6 +4316,7 @@ public synchronized HttpResponse doReload() throws IOException {
public void run() {
try (ACLContext ctx = ACL.as2(ACL.SYSTEM2)) {
reload();
+ getLifecycle().onReady();
} catch (Exception e) {
LOGGER.log(SEVERE, "Failed to reload Jenkins config", e);
new JenkinsReloadFailed(e).publish(servletContext, root);
@@ -4503,8 +4504,9 @@ public void restart() throws RestartNotSupportedException {
public void run() {
try (ACLContext ctx = ACL.as2(ACL.SYSTEM2)) {
// give some time for the browser to load the "reloading" page
+ lifecycle.onStatusUpdate("Restart in 5 seconds");
Thread.sleep(TimeUnit.SECONDS.toMillis(5));
- LOGGER.info(String.format("Restarting VM as requested by %s", exitUser));
+ lifecycle.onStop(exitUser, null);
Listeners.notify(RestartListener.class, true, RestartListener::onRestart);
lifecycle.restart();
} catch (InterruptedException | InterruptedIOException e) {
@@ -4539,13 +4541,13 @@ public void run() {
if (isQuietingDown()) {
servletContext.setAttribute("app", new HudsonIsRestarting());
// give some time for the browser to load the "reloading" page
- LOGGER.info("Restart in 10 seconds");
+ lifecycle.onStatusUpdate("Restart in 10 seconds");
Thread.sleep(TimeUnit.SECONDS.toMillis(10));
- LOGGER.info(String.format("Restarting VM as requested by %s", exitUser));
+ lifecycle.onStop(exitUser, null);
Listeners.notify(RestartListener.class, true, RestartListener::onRestart);
lifecycle.restart();
} else {
- LOGGER.info("Safe-restart mode cancelled");
+ lifecycle.onStatusUpdate("Safe-restart mode cancelled");
}
} catch (Throwable e) {
LOGGER.log(Level.WARNING, "Failed to restart Jenkins", e);
@@ -4585,6 +4587,8 @@ protected RestartCause() {
@RequirePOST
public void doExit(StaplerRequest req, StaplerResponse rsp) throws IOException {
checkPermission(ADMINISTER);
+ final String exitUser = getAuthentication2().getName();
+ final String exitAddr = req != null ? req.getRemoteAddr() : null;
if (rsp != null) {
rsp.setStatus(HttpServletResponse.SC_OK);
rsp.setContentType("text/plain");
@@ -4598,8 +4602,7 @@ public void doExit(StaplerRequest req, StaplerResponse rsp) throws IOException {
@SuppressFBWarnings(value = "DM_EXIT", justification = "Exit is really intended.")
public void run() {
try (ACLContext ctx = ACL.as2(ACL.SYSTEM2)) {
- LOGGER.info(String.format("Shutting down VM as requested by %s from %s",
- getAuthentication2().getName(), req != null ? req.getRemoteAddr() : "???"));
+ getLifecycle().onStop(exitUser, exitAddr);
cleanUp();
System.exit(0);
@@ -4620,14 +4623,13 @@ public HttpResponse doSafeExit(StaplerRequest req) throws IOException {
checkPermission(ADMINISTER);
quietDownInfo = new QuietDownInfo();
final String exitUser = getAuthentication2().getName();
- final String exitAddr = req != null ? req.getRemoteAddr() : "unknown";
+ final String exitAddr = req != null ? req.getRemoteAddr() : null;
new Thread("safe-exit thread") {
@Override
@SuppressFBWarnings(value = "DM_EXIT", justification = "Exit is really intended.")
public void run() {
try (ACLContext ctx = ACL.as2(ACL.SYSTEM2)) {
- LOGGER.info(String.format("Shutting down VM as requested by %s from %s",
- exitUser, exitAddr));
+ getLifecycle().onStop(exitUser, exitAddr);
// Wait 'til we have no active executors.
doQuietDown(true, 0, null);
// Make sure isQuietingDown is still true.
From 1a42044347502c59cd9c39d1be67f654df02908a Mon Sep 17 00:00:00 2001
From: Basil Crow
Date: Mon, 31 Jan 2022 07:51:35 -0800
Subject: [PATCH 14/29] Jenkins should terminate cleanly on `SIGTERM` (#6230)
---
core/src/main/java/hudson/lifecycle/Lifecycle.java | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/core/src/main/java/hudson/lifecycle/Lifecycle.java b/core/src/main/java/hudson/lifecycle/Lifecycle.java
index a46452420ec6a..fce497456b7f8 100644
--- a/core/src/main/java/hudson/lifecycle/Lifecycle.java
+++ b/core/src/main/java/hudson/lifecycle/Lifecycle.java
@@ -54,6 +54,19 @@
public abstract class Lifecycle implements ExtensionPoint {
private static Lifecycle INSTANCE = null;
+ public Lifecycle() {
+ Runtime.getRuntime().addShutdownHook(new Thread(() -> {
+ Jenkins jenkins = Jenkins.getInstanceOrNull();
+ if (jenkins != null) {
+ try {
+ jenkins.cleanUp();
+ } catch (Throwable t) {
+ LOGGER.log(Level.SEVERE, "Failed to clean up. Shutdown will continue.", t);
+ }
+ }
+ }));
+ }
+
/**
* Gets the singleton instance.
*
From 86be164df5565b13fc4ec5dbc0d560d99e3a3a57 Mon Sep 17 00:00:00 2001
From: Tim Jacomb
Date: Mon, 31 Jan 2022 09:06:35 +0000
Subject: [PATCH 15/29] JENKINS-67689 Don't hide cancel button with long build
names
---
core/src/main/resources/lib/hudson/buildCaption.jelly | 2 +-
war/src/main/less/base/layout-commons.less | 11 +++++++----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/core/src/main/resources/lib/hudson/buildCaption.jelly b/core/src/main/resources/lib/hudson/buildCaption.jelly
index 94de09be0ee8e..c3e0c400d0454 100644
--- a/core/src/main/resources/lib/hudson/buildCaption.jelly
+++ b/core/src/main/resources/lib/hudson/buildCaption.jelly
@@ -33,7 +33,7 @@ THE SOFTWARE.
-
+
${%Progress}:
diff --git a/war/src/main/less/base/layout-commons.less b/war/src/main/less/base/layout-commons.less
index fd85351bf5834..008b1c4b2a096 100644
--- a/war/src/main/less/base/layout-commons.less
+++ b/war/src/main/less/base/layout-commons.less
@@ -127,10 +127,13 @@ body.full-screen #main-panel {
h1.build-caption.page-headline {
display: flex;
align-items: center;
- max-width: 1200px;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
+}
+
+h1.build-caption.page-headline > span {
+ max-width: 1200px;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
}
// Clearfixes extracted from responsive-grid.css as they essential
From f023108ec324d51d77da15890b2db8f1f76a61d3 Mon Sep 17 00:00:00 2001
From: Jenkins Release Bot
<66998184+jenkins-release-bot@users.noreply.github.com>
Date: Tue, 1 Feb 2022 12:27:21 +0000
Subject: [PATCH 16/29] [maven-release-plugin] prepare release jenkins-2.333
---
bom/pom.xml | 2 +-
cli/pom.xml | 2 +-
core/pom.xml | 2 +-
pom.xml | 4 ++--
test/pom.xml | 2 +-
war/pom.xml | 2 +-
6 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/bom/pom.xml b/bom/pom.xml
index 35d5a93daa5c6..0d86f533b73e5 100644
--- a/bom/pom.xml
+++ b/bom/pom.xml
@@ -28,7 +28,7 @@ THE SOFTWARE.
org.jenkins-ci.main
jenkins-parent
- ${revision}${changelist}
+ 2.333
jenkins-bom
diff --git a/cli/pom.xml b/cli/pom.xml
index 8772f2658fc25..323608a4436c1 100644
--- a/cli/pom.xml
+++ b/cli/pom.xml
@@ -5,7 +5,7 @@
org.jenkins-ci.main
jenkins-parent
- ${revision}${changelist}
+ 2.333
cli
diff --git a/core/pom.xml b/core/pom.xml
index af1529aa61b06..2bf8fd65aa8ba 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -29,7 +29,7 @@ THE SOFTWARE.
org.jenkins-ci.main
jenkins-parent
- ${revision}${changelist}
+ 2.333
jenkins-core
diff --git a/pom.xml b/pom.xml
index bb9c30f111c11..c49b9e34c2c79 100644
--- a/pom.xml
+++ b/pom.xml
@@ -34,7 +34,7 @@ THE SOFTWARE.
org.jenkins-ci.main
jenkins-parent
- ${revision}${changelist}
+ 2.333
pom
Jenkins main module
@@ -60,7 +60,7 @@ THE SOFTWARE.
scm:git:git://github.com/jenkinsci/jenkins.git
scm:git:ssh://git@github.com/jenkinsci/jenkins.git
- ${scmTag}
+ jenkins-2.333
https://github.com/jenkinsci/jenkins
diff --git a/test/pom.xml b/test/pom.xml
index 3a6f3ce1dd7e1..5ffdd1383c36a 100644
--- a/test/pom.xml
+++ b/test/pom.xml
@@ -28,7 +28,7 @@ THE SOFTWARE.
org.jenkins-ci.main
jenkins-parent
- ${revision}${changelist}
+ 2.333
jenkins-test
diff --git a/war/pom.xml b/war/pom.xml
index 034f1e06c29ae..96f4107205cef 100644
--- a/war/pom.xml
+++ b/war/pom.xml
@@ -28,7 +28,7 @@ THE SOFTWARE.
org.jenkins-ci.main
jenkins-parent
- ${revision}${changelist}
+ 2.333
jenkins-war
From 59ab7d299c87ab26afc2ab315686998f20f7b983 Mon Sep 17 00:00:00 2001
From: Jenkins Release Bot
<66998184+jenkins-release-bot@users.noreply.github.com>
Date: Tue, 1 Feb 2022 12:27:44 +0000
Subject: [PATCH 17/29] [maven-release-plugin] prepare for next development
iteration
---
bom/pom.xml | 2 +-
cli/pom.xml | 2 +-
core/pom.xml | 2 +-
pom.xml | 6 +++---
test/pom.xml | 2 +-
war/pom.xml | 2 +-
6 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/bom/pom.xml b/bom/pom.xml
index 0d86f533b73e5..35d5a93daa5c6 100644
--- a/bom/pom.xml
+++ b/bom/pom.xml
@@ -28,7 +28,7 @@ THE SOFTWARE.
org.jenkins-ci.main
jenkins-parent
- 2.333
+ ${revision}${changelist}
jenkins-bom
diff --git a/cli/pom.xml b/cli/pom.xml
index 323608a4436c1..8772f2658fc25 100644
--- a/cli/pom.xml
+++ b/cli/pom.xml
@@ -5,7 +5,7 @@
org.jenkins-ci.main
jenkins-parent
- 2.333
+ ${revision}${changelist}
cli
diff --git a/core/pom.xml b/core/pom.xml
index 2bf8fd65aa8ba..af1529aa61b06 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -29,7 +29,7 @@ THE SOFTWARE.
org.jenkins-ci.main
jenkins-parent
- 2.333
+ ${revision}${changelist}
jenkins-core
diff --git a/pom.xml b/pom.xml
index c49b9e34c2c79..eee1bc41821d1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -34,7 +34,7 @@ THE SOFTWARE.
org.jenkins-ci.main
jenkins-parent
- 2.333
+ ${revision}${changelist}
pom
Jenkins main module
@@ -60,7 +60,7 @@ THE SOFTWARE.
scm:git:git://github.com/jenkinsci/jenkins.git
scm:git:ssh://git@github.com/jenkinsci/jenkins.git
- jenkins-2.333
+ ${scmTag}
https://github.com/jenkinsci/jenkins
@@ -70,7 +70,7 @@ THE SOFTWARE.
- 2.333
+ 2.334
-SNAPSHOT
- |