Skip to content

Commit

Permalink
Merge branch 'master' into with-console-url
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlatombe authored Sep 4, 2024
2 parents 49618a0 + 307f680 commit 2f6d77c
Show file tree
Hide file tree
Showing 374 changed files with 4,369 additions and 2,221 deletions.
11 changes: 0 additions & 11 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,6 @@
"org.jfree:jfreechart"
]
},
{
"description": "Starting with 6.x, Spring requires Java 17 at a minimum.",
"matchManagers": [
"maven"
],
"allowedVersions": "<6.0.0",
"matchPackageNames": [
"org.springframework:spring-framework-bom",
"org.springframework.security:spring-security-bom"
]
},
{
"description": "Starting with 7.x, Guice switches from javax.* to jakarta.* bindings. See https://github.com/google/guice/wiki/Guice700",
"matchManagers": [
Expand Down
9 changes: 3 additions & 6 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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=5941.v95f3439136c7
export ATH_VERSION=5957.v7c0e2f7ca_63e

if [[ $# -eq 0 ]]; then
export JDK=17
Expand Down
16 changes: 8 additions & 8 deletions 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>1894.v82b_2fb_35519d</stapler.version>
<stapler.version>1903.v994a_db_314d58</stapler.version>
<groovy.version>2.4.21</groovy.version>
</properties>

Expand All @@ -62,15 +62,15 @@ THE SOFTWARE.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>5.3.39</version>
<version>6.1.12</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 -->
<!-- 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>5.8.14</version>
<version>6.3.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -154,12 +154,12 @@ THE SOFTWARE.
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>4.0.4</version>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<version>1.2.7</version>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>jaxen</groupId>
Expand Down Expand Up @@ -189,7 +189,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.14</version>
<version>1.10.15</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down Expand Up @@ -295,7 +295,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.jvnet.hudson</groupId>
<artifactId>commons-jelly-tags-define</artifactId>
<version>1.1-jenkins-20240510</version>
<version>1.1-jenkins-20240903</version>
</dependency>
<dependency>
<groupId>org.jvnet.localizer</groupId>
Expand Down
24 changes: 23 additions & 1 deletion cli/src/main/java/hudson/cli/CLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import jakarta.websocket.ClientEndpointConfig;
import jakarta.websocket.Endpoint;
import jakarta.websocket.EndpointConfig;
import jakarta.websocket.HandshakeResponse;
import jakarta.websocket.Session;
import java.io.DataInputStream;
import java.io.File;
Expand Down Expand Up @@ -64,6 +65,7 @@
import org.glassfish.tyrus.client.ClientManager;
import org.glassfish.tyrus.client.ClientProperties;
import org.glassfish.tyrus.client.SslEngineConfigurator;
import org.glassfish.tyrus.client.exception.DeploymentHandshakeException;
import org.glassfish.tyrus.container.jdk.client.JdkClientContainer;

/**
Expand Down Expand Up @@ -340,13 +342,19 @@ public void onOpen(Session session, EndpointConfig config) {}
}

class Authenticator extends ClientEndpointConfig.Configurator {
HandshakeResponse hr;
@Override
public void beforeRequest(Map<String, List<String>> headers) {
if (factory.authorization != null) {
headers.put("Authorization", List.of(factory.authorization));
}
}
@Override
public void afterResponse(HandshakeResponse hr) {
this.hr = hr;
}
}
var authenticator = new Authenticator();

ClientManager client = ClientManager.createClient(JdkClientContainer.class.getName()); // ~ ContainerProvider.getWebSocketContainer()
client.getProperties().put(ClientProperties.REDIRECT_ENABLED, true); // https://tyrus-project.github.io/documentation/1.13.1/index/tyrus-proprietary-config.html#d0e1775
Expand All @@ -357,7 +365,21 @@ public void beforeRequest(Map<String, List<String>> headers) {
sslEngineConfigurator.setHostnameVerifier((s, sslSession) -> true);
client.getProperties().put(ClientProperties.SSL_ENGINE_CONFIGURATOR, sslEngineConfigurator);
}
Session session = client.connectToServer(new CLIEndpoint(), ClientEndpointConfig.Builder.create().configurator(new Authenticator()).build(), URI.create(url.replaceFirst("^http", "ws") + "cli/ws"));
Session session;
try {
session = client.connectToServer(new CLIEndpoint(), ClientEndpointConfig.Builder.create().configurator(authenticator).build(), URI.create(url.replaceFirst("^http", "ws") + "cli/ws"));
} catch (DeploymentHandshakeException x) {
System.err.println("CLI handshake failed with status code " + x.getHttpStatusCode());
if (authenticator.hr != null) {
for (var entry : authenticator.hr.getHeaders().entrySet()) {
// org.glassfish.tyrus.core.Utils.parseHeaderValue improperly splits values like Date at commas, so undo that:
System.err.println(entry.getKey() + ": " + String.join(", ", entry.getValue()));
}
// UpgradeResponse.getReasonPhrase is useless since Jetty generates it from the code,
// and the body is not accessible at all.
}
return 15; // compare CLICommand.main
}
PlainCLIProtocol.Output out = new PlainCLIProtocol.Output() {
@Override
public void send(byte[] data) throws IOException {
Expand Down
20 changes: 19 additions & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,20 @@ THE SOFTWARE.
<!-- needed by Jelly -->
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<exclusions>
<exclusion>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>jaxen</groupId>
Expand Down Expand Up @@ -288,7 +302,7 @@ THE SOFTWARE.
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-fileupload2-javax</artifactId>
<artifactId>commons-fileupload2-jakarta-servlet5</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
Expand Down Expand Up @@ -427,6 +441,10 @@ THE SOFTWARE.
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<exclusions>
<exclusion>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-observation</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-jcl</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/DescriptorExtensionList.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public T newInstanceFromRadioList(JSONObject config) throws FormException {
if (config.isNullObject())
return null; // none was selected
int idx = config.getInt("value");
return get(idx).newInstance(Stapler.getCurrentRequest(), config);
return get(idx).newInstance(Stapler.getCurrentRequest2(), config);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/hudson/ExpressionFactory2.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.apache.commons.jelly.expression.ExpressionSupport;
import org.apache.commons.jexl.JexlContext;
import org.kohsuke.stapler.Stapler;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;
import org.springframework.security.access.AccessDeniedException;

/**
Expand Down Expand Up @@ -78,7 +78,7 @@ public Object evaluate(JellyContext context) {
// let the security exception pass through
throw e;
} catch (Exception e) {
StaplerRequest currentRequest = Stapler.getCurrentRequest();
StaplerRequest2 currentRequest = Stapler.getCurrentRequest2();
LOGGER.log(Level.WARNING, "Caught exception evaluating: " + expression + " in " + (currentRequest != null ? currentRequest.getOriginalRequestURI() : "?") + ". Reason: " + e, e);
return null;
} finally {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/FilePath.java
Original file line number Diff line number Diff line change
Expand Up @@ -3510,7 +3510,7 @@ public FormValidation validateRelativePath(String value, boolean errorIfNotExist
}

private static void checkPermissionForValidate() {
AccessControlled subject = Stapler.getCurrentRequest().findAncestorObject(AbstractProject.class);
AccessControlled subject = Stapler.getCurrentRequest2().findAncestorObject(AbstractProject.class);
if (subject == null)
Jenkins.get().checkPermission(Jenkins.MANAGE);
else
Expand Down
Loading

0 comments on commit 2f6d77c

Please sign in to comment.