mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-16 13:32:24 +00:00
Merge branch 'master' into remove_ioexception2
This commit is contained in:
8 files changed
+52
-11
No files matched your search
+1
-1
@@ -41,7 +41,7 @@ THE SOFTWARE.
|
||||
<commons-fileupload2.version>2.0.0-M2</commons-fileupload2.version>
|
||||
<groovy.version>2.4.21</groovy.version>
|
||||
<jelly.version>1.1-jenkins-20250108</jelly.version>
|
||||
<stapler.version>1982.vc1cb_57843281</stapler.version>
|
||||
<stapler.version>1983.v93c53e94b_c04</stapler.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
|
||||
@@ -43,6 +43,7 @@ import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Objects;
|
||||
import java.util.SortedMap;
|
||||
import java.util.function.IntPredicate;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import jenkins.model.lazy.AbstractLazyLoadRunMap;
|
||||
@@ -240,6 +241,7 @@ public final class RunMap<R extends Run<?, R>> extends AbstractLazyLoadRunMap<R>
|
||||
return r.createReference();
|
||||
}
|
||||
|
||||
@Restricted(NoExternalUse.class)
|
||||
@Override
|
||||
protected boolean allowLoad(int buildNumber) {
|
||||
if (job == null) {
|
||||
@@ -256,6 +258,27 @@ public final class RunMap<R extends Run<?, R>> extends AbstractLazyLoadRunMap<R>
|
||||
return true;
|
||||
}
|
||||
|
||||
@Restricted(NoExternalUse.class)
|
||||
@Override
|
||||
protected IntPredicate createLoadAllower() {
|
||||
if (job == null) {
|
||||
LOGGER.fine(() -> "deprecated constructor without Job used on " + dir);
|
||||
return buildNumber -> true;
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
var allowers = RunListener.all().stream().map(l -> l.createLoadAllower(job)).toList();
|
||||
return buildNumber -> {
|
||||
for (var allower : allowers) {
|
||||
if (!allower.test(buildNumber)) {
|
||||
LOGGER.finer(() -> allower + " declined to load " + buildNumber + " in " + job);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
LOGGER.finest(() -> "no RunListener declined to load " + buildNumber + " in " + job + " so proceeding");
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected R retrieve(File d) throws IOException {
|
||||
if (new File(d, "build.xml").exists()) {
|
||||
|
||||
@@ -47,6 +47,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.function.IntPredicate;
|
||||
import jenkins.model.lazy.AbstractLazyLoadRunMap;
|
||||
import jenkins.util.Listeners;
|
||||
import org.jvnet.tiger_types.Types;
|
||||
@@ -187,6 +188,16 @@ public abstract class RunListener<R extends Run> implements ExtensionPoint {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows listeners to veto build loading during startup.
|
||||
* Same behavior as {@link #allowLoad} but permits an implementation to more
|
||||
* efficiently respond to numerous queries about historical build numbers.
|
||||
*/
|
||||
@Restricted(Beta.class)
|
||||
public IntPredicate createLoadAllower(@NonNull Job<?, ?> job) {
|
||||
return buildNumber -> allowLoad(job, buildNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers this object as an active listener so that it can start getting
|
||||
* callbacks invoked.
|
||||
|
||||
@@ -50,6 +50,7 @@ import java.util.Spliterator;
|
||||
import java.util.Spliterators;
|
||||
import java.util.TreeMap;
|
||||
import java.util.function.IntConsumer;
|
||||
import java.util.function.IntPredicate;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -343,6 +344,7 @@ public abstract class AbstractLazyLoadRunMap<R> extends AbstractMap<Integer, R>
|
||||
kids = MemoryReductionUtil.EMPTY_STRING_ARRAY;
|
||||
}
|
||||
SortedIntList list = new SortedIntList(kids.length / 2);
|
||||
var allower = createLoadAllower();
|
||||
for (String s : kids) {
|
||||
if (!BUILD_NUMBER.matcher(s).matches()) {
|
||||
// not a build directory
|
||||
@@ -350,7 +352,7 @@ public abstract class AbstractLazyLoadRunMap<R> extends AbstractMap<Integer, R>
|
||||
}
|
||||
try {
|
||||
int buildNumber = Integer.parseInt(s);
|
||||
if (allowLoad(buildNumber)) {
|
||||
if (allower.test(buildNumber)) {
|
||||
list.add(buildNumber);
|
||||
} else {
|
||||
LOGGER.fine(() -> "declining to consider " + buildNumber + " in " + dir);
|
||||
@@ -368,6 +370,11 @@ public abstract class AbstractLazyLoadRunMap<R> extends AbstractMap<Integer, R>
|
||||
return true;
|
||||
}
|
||||
|
||||
@Restricted(NoExternalUse.class)
|
||||
protected IntPredicate createLoadAllower() {
|
||||
return this::allowLoad;
|
||||
}
|
||||
|
||||
/**
|
||||
* Permits a previous blocked build number to be eligible for loading.
|
||||
* @param buildNumber a build number
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@
|
||||
"css-loader": "7.1.2",
|
||||
"css-minimizer-webpack-plugin": "7.0.2",
|
||||
"eslint": "9.26.0",
|
||||
"eslint-config-prettier": "10.1.3",
|
||||
"eslint-config-prettier": "10.1.5",
|
||||
"eslint-formatter-checkstyle": "8.40.0",
|
||||
"globals": "16.1.0",
|
||||
"handlebars-loader": "1.7.3",
|
||||
|
||||
+2
-2
@@ -183,7 +183,7 @@ THE SOFTWARE.
|
||||
<dependency>
|
||||
<groupId>org.jenkins-ci.main</groupId>
|
||||
<artifactId>jenkins-test-harness</artifactId>
|
||||
<version>2444.v82e008e25040</version>
|
||||
<version>2447.v8a_ce9e0fca_32</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
@@ -235,7 +235,7 @@ THE SOFTWARE.
|
||||
<dependency>
|
||||
<groupId>org.jenkins-ci.plugins</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>1322.v1556dc1c59a_f</version>
|
||||
<version>1334.vd3b_b_2094e438</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
+1
-1
@@ -317,7 +317,7 @@ THE SOFTWARE.
|
||||
<!-- detached after 1.577 -->
|
||||
<groupId>org.jenkins-ci.plugins</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>1322.v1556dc1c59a_f</version>
|
||||
<version>1334.vd3b_b_2094e438</version>
|
||||
<type>hpi</type>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
|
||||
@@ -3627,14 +3627,14 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"eslint-config-prettier@npm:10.1.3":
|
||||
version: 10.1.3
|
||||
resolution: "eslint-config-prettier@npm:10.1.3"
|
||||
"eslint-config-prettier@npm:10.1.5":
|
||||
version: 10.1.5
|
||||
resolution: "eslint-config-prettier@npm:10.1.5"
|
||||
peerDependencies:
|
||||
eslint: ">=7.0.0"
|
||||
bin:
|
||||
eslint-config-prettier: bin/cli.js
|
||||
checksum: 10c0/8e0b1fea63cb606afe5fe1c01b38eacd8764cc257cbe9af6ee3c8b4b9532432a7bf720eda1434f6e16e31be37ed9e279c3efcf1f3853b608bb67068e73dcd534
|
||||
checksum: 10c0/5486255428e4577e8064b40f27db299faf7312b8e43d7b4bc913a6426e6c0f5950cd519cad81ae24e9aecb4002c502bc665c02e3b52efde57af2debcf27dd6e0
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -4689,7 +4689,7 @@ __metadata:
|
||||
css-loader: "npm:7.1.2"
|
||||
css-minimizer-webpack-plugin: "npm:7.0.2"
|
||||
eslint: "npm:9.26.0"
|
||||
eslint-config-prettier: "npm:10.1.3"
|
||||
eslint-config-prettier: "npm:10.1.5"
|
||||
eslint-formatter-checkstyle: "npm:8.40.0"
|
||||
globals: "npm:16.1.0"
|
||||
handlebars: "npm:4.7.8"
|
||||
|
||||
Reference in new issue
Block a user