Skip to content

Commit

Permalink
Merge branch 'master' into command-palette
Browse files Browse the repository at this point in the history
  • Loading branch information
timja authored Nov 6, 2024
2 parents f4f567a + b0e47a7 commit 89da576
Show file tree
Hide file tree
Showing 12 changed files with 378 additions and 344 deletions.
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=6059.veb_df63f37069
export ATH_VERSION=6072.vc7e4e6a_970b_c

if [[ $# -eq 0 ]]; then
export JDK=17
Expand Down
2 changes: 1 addition & 1 deletion bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ THE SOFTWARE.

<properties>
<commons-fileupload2.version>2.0.0-M2</commons-fileupload2.version>
<stapler.version>1903.v994a_db_314d58</stapler.version>
<stapler.version>1922.v3f3302a_7f16f</stapler.version>
<groovy.version>2.4.21</groovy.version>
</properties>

Expand Down
62 changes: 42 additions & 20 deletions core/src/main/java/hudson/model/Job.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import hudson.BulkChange;
import hudson.EnvVars;
import hudson.Extension;
import hudson.ExtensionList;
import hudson.ExtensionPoint;
import hudson.FeedAdapter;
import hudson.PermalinkList;
Expand Down Expand Up @@ -221,29 +222,20 @@ public void onLoad(ItemGroup<? extends Item> parent, String name)

TextFile f = getNextBuildNumberFile();
if (f.exists()) {
// starting 1.28, we store nextBuildNumber in a separate file.
// but old Hudson didn't do it, so if the file doesn't exist,
// assume that nextBuildNumber was read from config.xml
try {
synchronized (this) {
this.nextBuildNumber = Integer.parseInt(f.readTrim());
}
} catch (NumberFormatException e) {
LOGGER.log(Level.WARNING, "Corruption in {0}: {1}", new Object[] {f, e});
//noinspection StatementWithEmptyBody
if (this instanceof LazyBuildMixIn.LazyLoadingJob) {
// allow LazyBuildMixIn.onLoad to fix it
} else {
RunT lB = getLastBuild();
synchronized (this) {
this.nextBuildNumber = lB != null ? lB.getNumber() + 1 : 1;
}
saveNextBuildNumber();
RunT lB = getLastBuild();
synchronized (this) {
this.nextBuildNumber = lB != null ? lB.getNumber() + 1 : 1;
}
saveNextBuildNumber();
}
} else {
// From the old Hudson, or doCreateItem. Create this file now.
saveNextBuildNumber();
} else if (nextBuildNumber == 0) {
nextBuildNumber = 1;
}

if (properties == null) // didn't exist < 1.72
Expand Down Expand Up @@ -346,12 +338,42 @@ public boolean isKeepDependencies() {
}

/**
* Allocates a new buildCommand number.
* Allocates a new build number.
* @see BuildNumberAssigner
*/
public synchronized int assignBuildNumber() throws IOException {
int r = nextBuildNumber++;
saveNextBuildNumber();
return r;
public int assignBuildNumber() throws IOException {
return ExtensionList.lookupFirst(BuildNumberAssigner.class).assignBuildNumber(this, this::saveNextBuildNumber);
}

/**
* Alternate strategy for assigning build numbers.
*/
@Restricted(Beta.class)
public interface BuildNumberAssigner extends ExtensionPoint {
/**
* Implementation of {@link Job#assignBuildNumber}.
*/
int assignBuildNumber(Job<?, ?> job, SaveNextBuildNumber saveNextBuildNumber) throws IOException;
/**
* Provides an externally accessible alias for {@link Job#saveNextBuildNumber}, which is {@code protected}.
* ({@link #getNextBuildNumber} and {@link #fastUpdateNextBuildNumber} are already accessible.)
*/
interface SaveNextBuildNumber {
void call() throws IOException;
}
}

@Restricted(DoNotUse.class)
@Extension(ordinal = -1000)
public static final class DefaultBuildNumberAssigner implements BuildNumberAssigner {
@Override
public int assignBuildNumber(Job<?, ?> job, SaveNextBuildNumber saveNextBuildNumber) throws IOException {
synchronized (job) {
int r = job.nextBuildNumber++;
saveNextBuildNumber.call();
return r;
}
}
}

/**
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ public void onLoad(ItemGroup<? extends Item> parent, String name) throws IOExcep
int max = _builds.maxNumberOnDisk();
int next = asJob().getNextBuildNumber();
if (next <= max) {
LOGGER.log(Level.WARNING, "JENKINS-27530: improper nextBuildNumber {0} detected in {1} with highest build number {2}; adjusting", new Object[] {next, asJob(), max});
asJob().updateNextBuildNumber(max + 1);
LOGGER.log(Level.FINE, "nextBuildNumber {0} detected in {1} with highest build number {2}; adjusting", new Object[] {next, asJob(), max});
asJob().fastUpdateNextBuildNumber(max + 1);
}
RunMap<RunT> currentBuilds = this.builds;
if (parent != null) {
Expand Down
28 changes: 8 additions & 20 deletions core/src/main/java/jenkins/security/stapler/TypedFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import hudson.ExtensionList;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import jenkins.util.SystemProperties;
Expand All @@ -25,8 +23,6 @@
public class TypedFilter implements FieldRef.Filter, FunctionList.Filter {
private static final Logger LOGGER = Logger.getLogger(TypedFilter.class.getName());

private static final Map<Class<?>, Boolean> staplerCache = new HashMap<>();

private boolean isClassAcceptable(Class<?> clazz) {
if (clazz.isArray()) {
// special case to allow klass.isArray() dispatcher
Expand All @@ -46,31 +42,23 @@ private boolean isClassAcceptable(Class<?> clazz) {
return false;
}
}
return SKIP_TYPE_CHECK || isStaplerRelevantCached(clazz);
return SKIP_TYPE_CHECK || isStaplerRelevant.get(clazz);
}

private static boolean isStaplerRelevantCached(@NonNull Class<?> clazz) {
if (staplerCache.containsKey(clazz)) {
return staplerCache.get(clazz);
private static final ClassValue<Boolean> isStaplerRelevant = new ClassValue<>() {
@Override
protected Boolean computeValue(Class<?> clazz) {
return isSpecificClassStaplerRelevant(clazz) || isSuperTypesStaplerRelevant(clazz);
}
boolean ret = isStaplerRelevant(clazz);

staplerCache.put(clazz, ret);
return ret;
}

@Restricted(NoExternalUse.class)
public static boolean isStaplerRelevant(@NonNull Class<?> clazz) {
return isSpecificClassStaplerRelevant(clazz) || isSuperTypesStaplerRelevant(clazz);
}
};

private static boolean isSuperTypesStaplerRelevant(@NonNull Class<?> clazz) {
Class<?> superclass = clazz.getSuperclass();
if (superclass != null && isStaplerRelevantCached(superclass)) {
if (superclass != null && isStaplerRelevant.get(superclass)) {
return true;
}
for (Class<?> interfaceClass : clazz.getInterfaces()) {
if (isStaplerRelevantCached(interfaceClass)) {
if (isStaplerRelevant.get(interfaceClass)) {
return true;
}
}
Expand Down
4 changes: 4 additions & 0 deletions core/src/main/resources/lib/hudson/rssBar_tr.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Legend=İkonlar hakkında
All=Tümü
Failures=Başarısız olanlar
LatestBuilds=Son yapılandırmalar
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,29 @@
"@babel/cli": "7.25.9",
"@babel/core": "7.26.0",
"@babel/preset-env": "7.26.0",
"@eslint/js": "9.13.0",
"@eslint/js": "9.14.0",
"babel-loader": "9.2.1",
"clean-webpack-plugin": "4.0.0",
"css-loader": "7.1.2",
"css-minimizer-webpack-plugin": "7.0.0",
"eslint": "9.13.0",
"eslint": "9.14.0",
"eslint-config-prettier": "9.1.0",
"eslint-formatter-checkstyle": "8.40.0",
"globals": "15.11.0",
"handlebars-loader": "1.7.3",
"mini-css-extract-plugin": "2.9.1",
"mini-css-extract-plugin": "2.9.2",
"postcss": "8.4.47",
"postcss-loader": "8.1.1",
"postcss-preset-env": "10.0.8",
"postcss-preset-env": "10.0.9",
"postcss-scss": "4.0.9",
"prettier": "3.3.3",
"sass": "1.80.5",
"sass-loader": "16.0.2",
"sass": "1.80.6",
"sass-loader": "16.0.3",
"style-loader": "4.0.0",
"stylelint": "16.10.0",
"stylelint-checkstyle-reporter": "1.0.0",
"stylelint-config-standard": "36.0.1",
"webpack": "5.95.0",
"webpack": "5.96.1",
"webpack-cli": "5.1.4",
"webpack-remove-empty-scripts": "1.0.4"
},
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ THE SOFTWARE.
</issueManagement>

<properties>
<revision>2.484</revision>
<revision>2.485</revision>
<changelist>-SNAPSHOT</changelist>
<project.build.outputTimestamp>2024-10-29T13:43:58Z</project.build.outputTimestamp>
<project.build.outputTimestamp>2024-11-05T13:51:04Z</project.build.outputTimestamp>

<!-- configuration for patch tracker plugin -->
<project.patchManagement.system>github</project.patchManagement.system>
Expand All @@ -87,7 +87,7 @@ THE SOFTWARE.
<changelog.url>https://www.jenkins.io/changelog</changelog.url>

<!-- Bundled Remoting version -->
<remoting.version>3273.v4cfe589b_fd83</remoting.version>
<remoting.version>3283.v92c105e0f819</remoting.version>

<spotbugs.effort>Max</spotbugs.effort>
<spotbugs.threshold>Medium</spotbugs.threshold>
Expand Down Expand Up @@ -281,7 +281,7 @@ THE SOFTWARE.
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.19.0</version>
<version>10.20.0</version>
</dependency>
</dependencies>
<executions>
Expand Down
2 changes: 1 addition & 1 deletion test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ THE SOFTWARE.
<!-- Required by plugin-util-api -->
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-support</artifactId>
<version>930.vf51d22b_ce488</version>
<version>932.vb_555de1b_a_b_94</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down
9 changes: 4 additions & 5 deletions test/src/test/java/hudson/tasks/LogRotatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeFalse;

import hudson.Functions;
import hudson.Launcher;
import hudson.model.AbstractBuild;
import hudson.model.BuildListener;
Expand All @@ -50,10 +52,8 @@
import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.BuildWatcher;
import org.jvnet.hudson.test.FailureBuilder;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.JenkinsRule;
Expand All @@ -64,9 +64,6 @@
*/
public class LogRotatorTest {

@ClassRule
public static BuildWatcher watcher = new BuildWatcher();

@Rule
public JenkinsRule j = new JenkinsRule();

Expand Down Expand Up @@ -103,6 +100,8 @@ public void successVsFailureWithRemoveLastBuild() throws Exception {

@Test
public void ableToDeleteCurrentBuild() throws Exception {
assumeFalse("Deleting the current build while is is completing does not work consistently on Windows",
Functions.isWindows());
var p = j.createFreeStyleProject();
// Keep 0 builds, i.e. immediately delete builds as they complete.
LogRotator logRotator = new LogRotator(-1, 0, -1, -1);
Expand Down
2 changes: 1 addition & 1 deletion war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ THE SOFTWARE.
<!-- dependency of checks-api and plugin-util-api -->
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-support</artifactId>
<version>930.vf51d22b_ce488</version>
<version>932.vb_555de1b_a_b_94</version>
<type>hpi</type>
</artifactItem>

Expand Down
Loading

0 comments on commit 89da576

Please sign in to comment.