Skip to content

Commit

Permalink
Merge branch 'master' into flabrie-patch-3
Browse files Browse the repository at this point in the history
* master: (72 commits)
  [JENKINS-72189] fix drag&drop handle for existing repeatables (jenkinsci#8613)
  [JENKINS-72222] Fix inconsistent wording between login page and security configuration (jenkinsci#8633)
  More helpful error message for `ExtensionList.lookupSingleton` (jenkinsci#8646)
  Turkish localization fixes for build page (jenkinsci#8651)
  Update dependabot branch for LTS 2.426.x (jenkinsci#8659)
  Update dependency node to v20.9.0 (jenkinsci#8656)
  Update dependency sass to v1.69.5 (jenkinsci#8657)
  Bump org.jenkins-ci.main:jenkins-test-harness from 2096.vcfd8fa_a_67f86 to 2099.vc95b_86578f37 (jenkinsci#8653)
  Bump org.jenkins-ci.main:remoting from 3190.va_7870fc137d9 to 3192.v713e3b_039fb_e (jenkinsci#8654)
  Bump org.jenkins-ci.plugins:credentials from 1304.v5ec13eecef46 to 1307.v3757c78f17c3 (jenkinsci#8655)
  Bump commons-io:commons-io from 2.14.0 to 2.15.0 (jenkinsci#8647)
  Update Yarn to v4 (jenkinsci#8641)
  Bump org.jenkins-ci.plugins:credentials from 1293.vff276f713473 to 1304.v5ec13eecef46 (jenkinsci#8650)
  Bump org.jenkins-ci.main:remoting from 3186.vc3b_7249b_87eb_ to 3190.va_7870fc137d9 (jenkinsci#8649)
  Fix issues with help texts under security configuration (jenkinsci#8630)
  Turkish localization fixes for login and users management pages (jenkinsci#8631)
  Bump com.github.eirslett:frontend-maven-plugin from 1.14.0 to 1.14.2 (jenkinsci#8648)
  Bump org.jenkins-ci.main:remoting from 3181.v78543a_987053 to 3186.vc3b_7249b_87eb_ (jenkinsci#8643)
  Bump org.jenkins-ci.main:jenkins-test-harness from 2090.v6d1706e434a_b_ to 2096.vcfd8fa_a_67f86 (jenkinsci#8642)
  [maven-release-plugin] prepare for next development iteration
  ...

# Conflicts:
#	core/src/main/resources/lib/form/repeatable.jelly
  • Loading branch information
Francis Labrie committed Oct 30, 2023
2 parents 2a0d528 + c5442a0 commit 0a1ca59
Show file tree
Hide file tree
Showing 257 changed files with 6,724 additions and 2,946 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ updates:
versions: [">=7.0.0"]
- package-ecosystem: "maven"
directory: "/"
target-branch: "stable-2.414"
target-branch: "stable-2.426"
labels:
- "into-lts"
- "needs-justification"
Expand Down
2 changes: 1 addition & 1 deletion ath.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -o xtrace
cd "$(dirname "$0")"

# https://github.com/jenkinsci/acceptance-test-harness/releases
export ATH_VERSION=5717.v51fb_b_1f0f6d1
export ATH_VERSION=5740.vd30f30408987

if [[ $# -eq 0 ]]; then
export JDK=17
Expand Down
10 changes: 5 additions & 5 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ THE SOFTWARE.
<properties>
<asm.version>9.6</asm.version>
<slf4jVersion>2.0.9</slf4jVersion>
<stapler.version>1814.vdc9dd5217ee2</stapler.version>
<stapler.version>1819.v4a_093e9c82f9</stapler.version>
<groovy.version>2.4.21</groovy.version>
</properties>

Expand All @@ -56,15 +56,15 @@ THE SOFTWARE.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>5.3.29</version>
<version>5.3.30</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<!-- https://docs.spring.io/spring-security/site/docs/5.5.4/reference/html5/#getting-maven-no-boot -->
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-bom</artifactId>
<version>5.8.7</version>
<version>5.8.8</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -82,7 +82,7 @@ THE SOFTWARE.
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.1.2-jre</version>
<version>32.1.3-jre</version>
</dependency>
<dependency>
<!-- Overriding Stapler’s 1.1.3 version to diagnose JENKINS-20618: -->
Expand Down Expand Up @@ -128,7 +128,7 @@ THE SOFTWARE.
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.14.0</version>
<version>2.15.0</version>
</dependency>
<dependency>
<groupId>commons-jelly</groupId>
Expand Down
2 changes: 1 addition & 1 deletion cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<url>https://github.com/jenkinsci/jenkins</url>

<properties>
<mina-sshd.version>2.10.0</mina-sshd.version>
<mina-sshd.version>2.11.0</mina-sshd.version>
<!-- Filled in by jacoco-maven-plugin -->
<jacocoSurefireArgs />
</properties>
Expand Down
5 changes: 4 additions & 1 deletion core/src/main/java/hudson/ExtensionList.java
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,10 @@ public static <T> ExtensionList<T> create(Jenkins jenkins, Class<T> type) {
*/
public static @NonNull <U> U lookupSingleton(Class<U> type) {
ExtensionList<U> all = lookup(type);
if (all.size() != 1) {
if (Main.isUnitTest && all.isEmpty()) {
throw new IllegalStateException("Found no instances of " + type.getName() +
" registered (possible annotation processor issue); try using `mvn clean test -Dtest=…` rather than an IDE test runner");
} else if (all.size() != 1) {
throw new IllegalStateException("Expected 1 instance of " + type.getName() + " but got " + all.size());
}
return all.get(0);
Expand Down
8 changes: 5 additions & 3 deletions core/src/main/java/hudson/Plugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import javax.servlet.http.HttpServletResponse;
import jenkins.model.GlobalConfiguration;
import jenkins.model.Jenkins;
import jenkins.model.Loadable;
import jenkins.util.SystemProperties;
import net.sf.json.JSONObject;
import org.kohsuke.accmod.Restricted;
Expand Down Expand Up @@ -84,7 +85,7 @@
* @author Kohsuke Kawaguchi
* @since 1.42
*/
public abstract class Plugin implements Saveable, StaplerProxy {
public abstract class Plugin implements Loadable, Saveable, StaplerProxy {

private static final Logger LOGGER = Logger.getLogger(Plugin.class.getName());

Expand Down Expand Up @@ -265,7 +266,8 @@ public void doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOExceptio
*
* @since 1.245
*/
protected void load() throws IOException {
@Override
public synchronized void load() throws IOException {
XmlFile xml = getConfigXml();
if (xml.exists())
xml.unmarshal(this);
Expand All @@ -277,7 +279,7 @@ protected void load() throws IOException {
* @since 1.245
*/
@Override
public void save() throws IOException {
public synchronized void save() throws IOException {
if (BulkChange.contains(this)) return;
XmlFile config = getConfigXml();
config.write(this);
Expand Down
13 changes: 10 additions & 3 deletions core/src/main/java/hudson/PluginManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,10 @@ protected void reactOnCycle(PluginWrapper q, List<PluginWrapper> cycle) {

// obtain topologically sorted list and overwrite the list
for (PluginWrapper p : cgd.getSorted()) {
if (p.isActive())
if (p.isActive()) {
activePlugins.add(p);
((UberClassLoader) uberClassLoader).clearCacheMisses();
}
}
} catch (CycleDetectedException e) { // TODO this should be impossible, since we override reactOnCycle to not throw the exception
stop(); // disable all plugins since classloading from them can lead to StackOverflow
Expand Down Expand Up @@ -932,9 +934,10 @@ public void dynamicLoad(File arc, boolean removeExisting, @CheckForNull List<Plu
// so existing plugins can't be depending on this newly deployed one.

plugins.add(p);
if (p.isActive())
if (p.isActive()) {
activePlugins.add(p);
((UberClassLoader) uberClassLoader).loaded.clear();
((UberClassLoader) uberClassLoader).clearCacheMisses();
}

// TODO antimodular; perhaps should have a PluginListener to complement ExtensionListListener?
CustomClassFilter.Contributed.load();
Expand Down Expand Up @@ -2385,6 +2388,10 @@ protected Enumeration<URL> findResources(String name) throws IOException {
return Collections.enumeration(resources);
}

void clearCacheMisses() {
loaded.values().removeIf(Optional::isEmpty);
}

@Override
public String toString() {
// only for debugging purpose
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/cli/GroovyCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected int run() throws Exception {
final String scriptListenerCorrelationId = String.valueOf(System.identityHashCode(this));

Binding binding = new Binding();
binding.setProperty("out", new ScriptListener.ListenerWriter(new PrintWriter(new OutputStreamWriter(stdout, getClientCharset()), true), GroovyCommand.class, null, scriptListenerCorrelationId, User.current()));
binding.setProperty("out", new PrintWriter(new ScriptListener.ListenerWriter(new OutputStreamWriter(stdout, getClientCharset()), GroovyCommand.class, null, scriptListenerCorrelationId, User.current()), true));
binding.setProperty("stdin", stdin);
binding.setProperty("stdout", stdout);
binding.setProperty("stderr", stderr);
Expand Down
33 changes: 27 additions & 6 deletions core/src/main/java/hudson/lifecycle/Lifecycle.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import hudson.ExtensionPoint;
import hudson.Functions;
import hudson.Util;
import hudson.init.InitMilestone;
import hudson.init.Initializer;
import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
Expand All @@ -40,6 +42,8 @@
import jenkins.model.Jenkins;
import jenkins.util.SystemProperties;
import org.apache.commons.io.FileUtils;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;

/**
* Provides the capability for starting/stopping/restarting/uninstalling Hudson.
Expand All @@ -48,7 +52,8 @@
* The steps to perform these operations depend on how Hudson is launched,
* so the concrete instance of this method (which is VM-wide singleton) is discovered
* by looking up a FQCN from the system property "hudson.lifecycle".
*
* (This may be set to a class defined in a plugin,
* in which case the singleton switches during startup.)
* @author Kohsuke Kawaguchi
* @since 1.254
*/
Expand All @@ -57,9 +62,8 @@ public abstract class Lifecycle implements ExtensionPoint {

/**
* Gets the singleton instance.
*
* @return never null
*/
@NonNull
public static synchronized Lifecycle get() {
if (INSTANCE == null) {
Lifecycle instance;
Expand All @@ -81,9 +85,8 @@ public static synchronized Lifecycle get() {
x.initCause(e);
throw x;
} catch (ClassNotFoundException e) {
NoClassDefFoundError x = new NoClassDefFoundError(e.getMessage());
x.initCause(e);
throw x;
LOGGER.log(Level.FINE, e, () -> "Failed to load " + p + " so will try again later");
instance = new PlaceholderLifecycle();
} catch (InvocationTargetException e) {
Throwable t = e.getCause();
if (t instanceof RuntimeException) {
Expand Down Expand Up @@ -307,5 +310,23 @@ public void onStatusUpdate(String status) {
LOGGER.log(Level.INFO, status);
}

@Restricted(NoExternalUse.class)
public static final class PlaceholderLifecycle extends ExitLifecycle {

@Initializer(after = InitMilestone.PLUGINS_STARTED, before = InitMilestone.EXTENSIONS_AUGMENTED)
public static synchronized void replacePlaceholder() {
if (get() instanceof PlaceholderLifecycle) {
String p = SystemProperties.getString("hudson.lifecycle");
try {
INSTANCE = (Lifecycle) Jenkins.get().getPluginManager().uberClassLoader.loadClass(p).getConstructor().newInstance();
LOGGER.fine(() -> "Updated to " + INSTANCE);
} catch (Exception | LinkageError x) {
LOGGER.log(Level.WARNING, x, () -> "Failed to load " + p + "; using fallback exit lifecycle");
}
}
}

}

private static final Logger LOGGER = Logger.getLogger(Lifecycle.class.getName());
}
4 changes: 3 additions & 1 deletion core/src/main/java/hudson/logging/LogRecorder.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
import java.util.logging.Logger;
import javax.servlet.ServletException;
import jenkins.model.Jenkins;
import jenkins.model.Loadable;
import jenkins.security.MasterToSlaveCallable;
import jenkins.util.MemoryReductionUtil;
import net.sf.json.JSONObject;
Expand All @@ -99,7 +100,7 @@
* @author Kohsuke Kawaguchi
* @see LogRecorderManager
*/
public class LogRecorder extends AbstractModelObject implements Saveable {
public class LogRecorder extends AbstractModelObject implements Loadable, Saveable {
private volatile String name;

/**
Expand Down Expand Up @@ -476,6 +477,7 @@ public HttpResponse doClear() throws IOException {
/**
* Loads the settings from a file.
*/
@Override
public synchronized void load() throws IOException {
getConfigFile().unmarshal(this);
loggers.forEach(Target::enable);
Expand Down
8 changes: 7 additions & 1 deletion core/src/main/java/hudson/model/AbstractItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
import javax.xml.transform.stream.StreamSource;
import jenkins.model.DirectlyModifiableTopLevelItemGroup;
import jenkins.model.Jenkins;
import jenkins.model.Loadable;
import jenkins.model.queue.ItemDeletion;
import jenkins.security.NotReallyRoleSensitiveCallable;
import jenkins.util.SystemProperties;
Expand Down Expand Up @@ -111,7 +112,7 @@
// Item doesn't necessarily have to be Actionable, but
// Java doesn't let multiple inheritance.
@ExportedBean
public abstract class AbstractItem extends Actionable implements Item, HttpDeletable, AccessControlled, DescriptorByNameOwner, StaplerProxy {
public abstract class AbstractItem extends Actionable implements Loadable, Item, HttpDeletable, AccessControlled, DescriptorByNameOwner, StaplerProxy {

private static final Logger LOGGER = Logger.getLogger(AbstractItem.class.getName());

Expand Down Expand Up @@ -934,6 +935,11 @@ public void updateByXml(Source source) throws IOException {
*/
@RequirePOST
public void doReload() throws IOException {
load();
}

@Override
public void load() throws IOException {
checkPermission(CONFIGURE);

// try to reflect the changes by reloading
Expand Down
8 changes: 5 additions & 3 deletions core/src/main/java/hudson/model/Descriptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
import jenkins.model.GlobalConfiguration;
import jenkins.model.GlobalConfigurationCategory;
import jenkins.model.Jenkins;
import jenkins.model.Loadable;
import jenkins.security.RedactSecretJsonInErrorMessageSanitizer;
import jenkins.util.io.OnMaster;
import net.sf.json.JSONArray;
Expand Down Expand Up @@ -103,7 +104,7 @@
* to {@link Object}/{@link Class} relationship.
*
* A {@link Descriptor}/{@link Describable}
* combination is used throughout in Hudson to implement a
* combination is used throughout in Jenkins to implement a
* configuration/extensibility mechanism.
*
* <p>
Expand All @@ -116,7 +117,7 @@
* configuration of a view (what projects are in it, regular expression, etc.)
*
* <p>
* For Hudson to create such configured {@link ListView} instance, Hudson
* For Jenkins to create such configured {@link ListView} instance, Jenkins
* needs another object that captures the metadata of {@link ListView},
* and that is what a {@link Descriptor} is for. {@link ListView} class
* has a singleton descriptor, and this descriptor helps render
Expand All @@ -143,7 +144,7 @@
* @author Kohsuke Kawaguchi
* @see Describable
*/
public abstract class Descriptor<T extends Describable<T>> implements Saveable, OnMaster {
public abstract class Descriptor<T extends Describable<T>> implements Loadable, Saveable, OnMaster {
/**
* The class being described by this descriptor.
*/
Expand Down Expand Up @@ -924,6 +925,7 @@ public synchronized void save() {
* (If we do that in the base class, the derived class won't
* get a chance to set default values.)
*/
@Override
public synchronized void load() {
XmlFile file = getConfigFile();
if (!file.exists())
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/java/hudson/model/PersistentDescriptor.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package hudson.model;

import jakarta.annotation.PostConstruct;
import jenkins.model.Loadable;

/**
* Marker interface for Descriptors which use xml persistent data, and as such need to load from disk when instantiated.
Expand All @@ -10,8 +11,9 @@
* @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
* @since 2.140
*/
public interface PersistentDescriptor extends Saveable {
public interface PersistentDescriptor extends Loadable, Saveable {

@PostConstruct
@Override
void load();
}
4 changes: 3 additions & 1 deletion core/src/main/java/hudson/model/UpdateCenter.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
import jenkins.install.InstallUtil;
import jenkins.management.Badge;
import jenkins.model.Jenkins;
import jenkins.model.Loadable;
import jenkins.security.stapler.StaplerDispatchable;
import jenkins.util.SystemProperties;
import jenkins.util.Timer;
Expand Down Expand Up @@ -154,7 +155,7 @@
* @since 1.220
*/
@ExportedBean
public class UpdateCenter extends AbstractModelObject implements Saveable, OnMaster, StaplerProxy {
public class UpdateCenter extends AbstractModelObject implements Loadable, Saveable, OnMaster, StaplerProxy {

private static final Logger LOGGER;
private static final String UPDATE_CENTER_URL;
Expand Down Expand Up @@ -984,6 +985,7 @@ public synchronized void save() {
/**
* Loads the data from the disk into this object.
*/
@Override
public synchronized void load() throws IOException {
XmlFile file = getConfigFile();
if (file.exists()) {
Expand Down
Loading

0 comments on commit 0a1ca59

Please sign in to comment.