-
-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JENKINS-73137] Adapt Jira plugin for jetty 12 EE8 #613
base: master
Are you sure you want to change the base?
Changes from all commits
5db534d
613f89e
dee8347
da6281e
b761776
a5ef2e4
9c88099
81d0cf1
56c44ae
4ce859e
8bfca0a
d8d8d10
7c8c778
ea89921
94e22b2
a6d1d30
d85b50a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
// Builds a module using https://github.com/jenkins-infra/pipeline-library | ||
buildPlugin(useContainerAgent: true, configurations: [ | ||
[platform: 'linux', jdk: 11], | ||
[platform: 'windows', jdk: 11], | ||
[platform: 'windows', jdk: 17], | ||
[platform: 'linux', jdk: 17], | ||
[platform: 'linux', jdk: 21] | ||
]) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,17 +52,20 @@ | |
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo> | ||
<jira-rest-client.version>5.2.7</jira-rest-client.version> | ||
<fugue.version>4.7.2</fugue.version> | ||
<!-- jenkins --> | ||
<jenkins.version>2.440.3</jenkins.version> | ||
<!-- TODO: Remove when 2.472 is available in LTS --> | ||
<jenkins.version>2.472</jenkins.version> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are supporting only LTS line, so let's make this PR a draft until there is an LTS released >=2.472 |
||
<!-- TODO JENKINS-73339 until in parent POM --> | ||
<jenkins-test-harness.version>2254.vcff7a_d4969e5</jenkins-test-harness.version> | ||
<spotless.check.skip>false</spotless.check.skip> | ||
<maven.compiler.release>17</maven.compiler.release> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is/should be coming from parent-pom, we don't want an override here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rantoniuk There is not yet a release of plugin parent POM that requires Java 17, but there will be one around the October timeframe, at which point this temporary code can be deleted. We aren't releasing a plugin parent POM that requires Java 17 right now because most of the ecosystem is still targeting Jenkins core releases that support Java 11. |
||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.jenkins.tools.bom</groupId> | ||
<artifactId>bom-2.440.x</artifactId> | ||
<version>3234.v5ca_5154341ef</version> | ||
<artifactId>bom-2.462.x</artifactId> | ||
<version>3258.vcdcf15936a_fd</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,25 +10,24 @@ | |
import hudson.ProxyConfiguration; | ||
import java.io.File; | ||
import java.io.IOException; | ||
import java.nio.charset.StandardCharsets; | ||
import java.nio.file.Path; | ||
import java.util.Base64; | ||
import java.util.Date; | ||
import java.util.Optional; | ||
import java.util.concurrent.TimeUnit; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import jenkins.model.Jenkins; | ||
import org.apache.commons.io.IOUtils; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.eclipse.jetty.http.HttpHeader; | ||
import org.eclipse.jetty.http.HttpStatus; | ||
import org.eclipse.jetty.io.Content; | ||
import org.eclipse.jetty.server.ConnectionFactory; | ||
import org.eclipse.jetty.server.Handler; | ||
import org.eclipse.jetty.server.HttpConnectionFactory; | ||
import org.eclipse.jetty.server.Server; | ||
import org.eclipse.jetty.server.ServerConnector; | ||
import org.eclipse.jetty.server.handler.AbstractHandler; | ||
import org.eclipse.jetty.util.Callback; | ||
import org.junit.After; | ||
import org.junit.Assert; | ||
import org.junit.Rule; | ||
|
@@ -151,7 +150,7 @@ public void simple_post_with_proxy() throws Exception { | |
Assert.assertEquals("FOO", testHandler.postReceived); | ||
} | ||
|
||
public class ProxyTestHandler extends AbstractHandler { | ||
public static class ProxyTestHandler extends Handler.Abstract { | ||
|
||
String postReceived; | ||
|
||
|
@@ -164,55 +163,50 @@ public class ProxyTestHandler extends AbstractHandler { | |
final String realm = "test_realm"; | ||
|
||
@Override | ||
public void handle( | ||
String target, | ||
org.eclipse.jetty.server.Request jettyRequest, | ||
HttpServletRequest request, | ||
HttpServletResponse response) | ||
throws IOException, ServletException { | ||
public boolean handle( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changes looks good. |
||
org.eclipse.jetty.server.Request request, org.eclipse.jetty.server.Response response, Callback callback) | ||
throws IOException { | ||
|
||
final String credentials = Base64.getEncoder().encodeToString((user + ":" + password).getBytes("UTF-8")); | ||
|
||
jettyRequest.setHandled(true); | ||
|
||
String authorization = request.getHeader(HttpHeader.PROXY_AUTHORIZATION.asString()); | ||
String authorization = request.getHeaders().get(HttpHeader.PROXY_AUTHORIZATION.asString()); | ||
if (authorization == null) { | ||
response.setStatus(HttpStatus.PROXY_AUTHENTICATION_REQUIRED_407); | ||
response.setHeader(HttpHeader.PROXY_AUTHENTICATE.asString(), "Basic realm=\"" + realm + "\""); | ||
return; | ||
response.getHeaders().add(HttpHeader.PROXY_AUTHENTICATE.asString(), "Basic realm=\"" + realm + "\""); | ||
callback.succeeded(); | ||
return true; | ||
} else { | ||
String prefix = "Basic "; | ||
if (authorization.startsWith(prefix)) { | ||
String attempt = authorization.substring(prefix.length()); | ||
if (!credentials.equals(attempt)) { | ||
return; | ||
callback.succeeded(); | ||
return true; | ||
} | ||
} | ||
} | ||
|
||
if (StringUtils.equalsIgnoreCase("post", request.getMethod())) { | ||
postReceived = IOUtils.toString(request.getReader()); | ||
postReceived = Content.Source.asString(request, StandardCharsets.UTF_8); | ||
} | ||
response.getWriter().write(CONTENT_RESPONSE); | ||
Content.Sink.write(response, true, CONTENT_RESPONSE, callback); | ||
return true; | ||
} | ||
} | ||
|
||
public class TestHandler extends AbstractHandler { | ||
public static class TestHandler extends Handler.Abstract { | ||
|
||
String postReceived; | ||
|
||
@Override | ||
public void handle( | ||
String target, | ||
org.eclipse.jetty.server.Request jettyRequest, | ||
HttpServletRequest request, | ||
HttpServletResponse response) | ||
throws IOException, ServletException { | ||
jettyRequest.setHandled(true); | ||
public boolean handle( | ||
org.eclipse.jetty.server.Request request, org.eclipse.jetty.server.Response response, Callback callback) | ||
throws IOException { | ||
if (StringUtils.equalsIgnoreCase("post", request.getMethod())) { | ||
postReceived = IOUtils.toString(request.getReader()); | ||
postReceived = Content.Source.asString(request, StandardCharsets.UTF_8); | ||
} | ||
response.getWriter().write(CONTENT_RESPONSE); | ||
Content.Sink.write(response, true, CONTENT_RESPONSE, callback); | ||
return true; | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not dropping JDK11 until there is an LTS release that is no longer supporting Java11.