Skip to content

Commit

Permalink
Merge branch 'master' into OptionHandlerExtension
Browse files Browse the repository at this point in the history
  • Loading branch information
basil authored Dec 17, 2024
2 parents 33d8280 + d73c0ea commit b3b5a69
Show file tree
Hide file tree
Showing 66 changed files with 1,380 additions and 464 deletions.
10 changes: 0 additions & 10 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,6 @@
"org.fusesource.jansi:jansi"
]
},
{
"description": "Depends on commons-lang3 which is in progress for removal from core. See: https://issues.jenkins.io/browse/JENKINS-73355",
"matchManagers": [
"maven"
],
"enabled": false,
"matchPackageNames": [
"org.apache.commons:commons-compress"
]
},
{
"description": "Contains incompatible API changes and needs compatibility work. See: https://github.com/jenkinsci/jenkins/pull/4224",
"matchManagers": [
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/publish-release-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
wget -q https://get.jenkins.io/${REPO}/${PROJECT_VERSION}/${FILE_NAME}
- name: Upload Release Asset
id: upload-war
uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974 # v2.1.0
uses: softprops/action-gh-release@7b4da11513bf3f43f9999e90eabced41ab8bb048 # v2.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
- name: Upload Release Asset
id: upload-deb
if: always()
uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974 # v2.1.0
uses: softprops/action-gh-release@7b4da11513bf3f43f9999e90eabced41ab8bb048 # v2.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down Expand Up @@ -144,7 +144,7 @@ jobs:
- name: Upload Release Asset
id: upload-rpm
if: always()
uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974 # v2.1.0
uses: softprops/action-gh-release@7b4da11513bf3f43f9999e90eabced41ab8bb048 # v2.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down Expand Up @@ -180,7 +180,7 @@ jobs:
- name: Upload Release Asset
id: upload-msi
if: always()
uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974 # v2.1.0
uses: softprops/action-gh-release@7b4da11513bf3f43f9999e90eabced41ab8bb048 # v2.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down Expand Up @@ -216,7 +216,7 @@ jobs:
- name: Upload Release Asset
id: upload-suse-rpm
if: always()
uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974 # v2.1.0
uses: softprops/action-gh-release@7b4da11513bf3f43f9999e90eabced41ab8bb048 # v2.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
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=6081.v29b_ce3c2771c
export ATH_VERSION=6107.v8c73fa_b_8f784

if [[ $# -eq 0 ]]; then
export JDK=17
Expand Down
11 changes: 3 additions & 8 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ THE SOFTWARE.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>6.2.0</version>
<version>6.2.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<!-- https://docs.spring.io/spring-security/reference/6.3/getting-spring-security.html#getting-maven-no-boot -->
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-bom</artifactId>
<version>6.4.1</version>
<version>6.4.2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -88,7 +88,7 @@ THE SOFTWARE.
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>33.3.1-jre</version>
<version>33.4.0-jre</version>
</dependency>
<dependency>
<!-- Overriding Stapler’s 1.1.3 version to diagnose JENKINS-20618: -->
Expand Down Expand Up @@ -191,11 +191,6 @@ THE SOFTWARE.
<artifactId>ant</artifactId>
<version>1.10.15</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.26.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-fileupload2</artifactId>
Expand Down
11 changes: 0 additions & 11 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -285,17 +285,6 @@ THE SOFTWARE.
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<exclusions>
<!-- Only needed for Pack200UnpackerAdapter, which we do not use -->
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-fileupload2-core</artifactId>
Expand Down
32 changes: 32 additions & 0 deletions core/src/main/java/hudson/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import hudson.model.View;
import hudson.scm.SCM;
import hudson.scm.SCMDescriptor;
import hudson.search.SearchFactory;
import hudson.search.SearchableModelObject;
import hudson.security.ACL;
import hudson.security.AccessControlled;
Expand Down Expand Up @@ -124,6 +125,7 @@
import java.nio.charset.StandardCharsets;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.MessageFormat;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
Expand Down Expand Up @@ -2576,4 +2578,34 @@ static String guessIcon(String iconGuess, String rootURL) {
public static String generateItemId() {
return String.valueOf(Math.floor(Math.random() * 3000));
}

@Restricted(NoExternalUse.class)
public static ExtensionList<SearchFactory> getSearchFactories() {
return SearchFactory.all();
}

/**
* @param keyboardShortcut the shortcut to be translated
* @return the translated shortcut, e.g. CMD+K to ⌘+K for macOS, CTRL+K for Windows
*/
@Restricted(NoExternalUse.class)
public static String translateModifierKeysForUsersPlatform(String keyboardShortcut) {
StaplerRequest2 currentRequest = Stapler.getCurrentRequest2();
currentRequest.getWebApp().getDispatchValidator().allowDispatch(currentRequest, Stapler.getCurrentResponse2());
String userAgent = currentRequest.getHeader("User-Agent");

List<String> platformsThatUseCommand = List.of("MAC", "IPHONE", "IPAD");
boolean useCmdKey = platformsThatUseCommand.stream().anyMatch(e -> userAgent.toUpperCase().contains(e));

return keyboardShortcut.replace("CMD", useCmdKey ? "⌘" : "CTRL");

Check warning on line 2600 in core/src/main/java/hudson/Functions.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 2600 is only partially covered, one branch is missing
}

@Restricted(NoExternalUse.class)
public static String formatMessage(String format, Object args) {
if (format == null) {
return args.toString();
}

return MessageFormat.format(format, args);
}
}
8 changes: 4 additions & 4 deletions core/src/main/java/hudson/model/DirectoryBrowserSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import jenkins.model.Jenkins;
import jenkins.security.MasterToSlaveCallable;
import jenkins.security.ResourceDomainConfiguration;
import jenkins.security.ResourceDomainRootAction;
import jenkins.util.SystemProperties;
import jenkins.util.VirtualFile;
import org.apache.commons.io.IOUtils;
import org.apache.tools.zip.ZipEntry;
import org.apache.tools.zip.ZipOutputStream;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.HttpResponse;
Expand Down Expand Up @@ -530,8 +530,8 @@ private static String createBackRef(int times) {

private static void zip(StaplerResponse2 rsp, VirtualFile root, VirtualFile dir, String glob) throws IOException, InterruptedException {
OutputStream outputStream = rsp.getOutputStream();
try (ZipOutputStream zos = new ZipOutputStream(outputStream)) {
zos.setEncoding(Charset.defaultCharset().displayName()); // TODO JENKINS-20663 make this overridable via query parameter
// TODO JENKINS-20663 make encoding overridable via query parameter
try (ZipOutputStream zos = new ZipOutputStream(outputStream, Charset.defaultCharset())) {

Check warning on line 534 in core/src/main/java/hudson/model/DirectoryBrowserSupport.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 534 is not covered by tests
// TODO consider using run(Callable) here

if (glob.isEmpty()) {
Expand Down
13 changes: 9 additions & 4 deletions core/src/main/java/hudson/model/Job.java
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,11 @@ public boolean supportsLogRotator() {
return true;
}

@Override
public String getSearchIcon() {
return "symbol-status-" + this.getIconColor().getIconName();
}

@Override
protected SearchIndexBuilder makeSearchIndex() {
return super.makeSearchIndex().add(new SearchIndex() {
Expand All @@ -541,7 +546,7 @@ public void find(String token, List<SearchItem> result) {
public void suggest(String token, List<SearchItem> result) {
find(token, result);
}
}).add("configure", "config", "configure");
});
}

@Override
Expand Down Expand Up @@ -853,7 +858,7 @@ public RunT getBuildForCLI(@Argument(required = true, metaVar = "BUILD#", usage
}

/**
* Gets the youngest build #m that satisfies {@code n&lt;=m}.
* Gets the oldest build #m that satisfies {@code m ≥ n}.
*
* This is useful when you'd like to fetch a build but the exact build might
* be already gone (deleted, rotated, etc.)
Expand All @@ -868,7 +873,7 @@ public RunT getNearestBuild(int n) {
}

/**
* Gets the latest build #m that satisfies {@code m&lt;=n}.
* Gets the newest build #m that satisfies {@code mn}.
*
* This is useful when you'd like to fetch a build but the exact build might
* be already gone (deleted, rotated, etc.)
Expand Down Expand Up @@ -977,7 +982,7 @@ public File getBuildDir() {
protected abstract void removeRun(RunT run);

/**
* Returns the last build.
* Returns the newest build.
* @see LazyBuildMixIn#getLastBuild
*/
@Exported
Expand Down
11 changes: 9 additions & 2 deletions core/src/main/java/hudson/model/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import hudson.security.AccessControlled;
import hudson.security.SecurityRealm;
import hudson.security.UserMayOrMayNotExistException2;
import hudson.tasks.UserAvatarResolver;
import hudson.util.FormValidation;
import hudson.util.RunList;
import hudson.util.XStream2;
Expand Down Expand Up @@ -77,6 +78,7 @@
import jenkins.util.SystemProperties;
import org.jenkinsci.Symbol;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.Beta;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.StaplerProxy;
import org.kohsuke.stapler.StaplerRequest2;
Expand Down Expand Up @@ -277,6 +279,11 @@ public String getId() {
return "/user/" + Util.rawEncode(idStrategy().keyFor(id));
}

@Override
public String getSearchIcon() {
return UserAvatarResolver.resolve(this, "48x48");

Check warning on line 284 in core/src/main/java/hudson/model/User.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 284 is not covered by tests
}

/**
* The URL of the user page.
*/
Expand Down Expand Up @@ -673,9 +680,9 @@ public void doSubmitDescription(StaplerRequest2 req, StaplerResponse2 rsp) throw
}

/**
* To be called from {@link Jenkins#reload} only.
* Called from {@link Jenkins#reload}.
*/
@Restricted(NoExternalUse.class)
@Restricted(Beta.class)
public static void reload() throws IOException {
UserIdMapper.getInstance().reload();
AllUsers.reload();
Expand Down
5 changes: 5 additions & 0 deletions core/src/main/java/hudson/model/View.java
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,11 @@ public String getSearchUrl() {
return getUrl();
}

@Override
public String getSearchIcon() {
return "symbol-jobs";

Check warning on line 565 in core/src/main/java/hudson/model/View.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 565 is not covered by tests
}

/**
* Returns the transient {@link Action}s associated with the top page.
*
Expand Down
Loading

0 comments on commit b3b5a69

Please sign in to comment.