Skip to content

Commit

Permalink
Incremental build for testing (Jakarta)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Jun 3, 2024
1 parent 657322a commit 9895071
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 25 deletions.
16 changes: 14 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
<revision>5.2.3</revision>
<changelist>-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<jenkins.version>2.426.3</jenkins.version>
<!-- TODO https://ci.jenkins.io/job/Core/job/jenkins/job/jakarta/ -->
<jenkins.version>2.461-rc35012.3072a_f48c3df</jenkins.version>
<no-test-jar>false</no-test-jar>
<!-- Jenkins.MANAGE is still in Beta -->
<useBeta>true</useBeta>
Expand All @@ -81,17 +82,28 @@
<linkXRef>false</linkXRef>
<spotbugs.effort>Max</spotbugs.effort>
<spotbugs.threshold>Low</spotbugs.threshold>

<!-- TODO https://github.com/jenkinsci/jenkins-test-harness/pull/631 -->
<jenkins-test-harness.version>2214.v7769a_49f3381</jenkins-test-harness.version>
<!-- TODO JENKINS-73121 until in parent POM -->
<maven.compiler.release>17</maven.compiler.release>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.426.x</artifactId>
<artifactId>bom-2.452.x</artifactId>
<version>3105.v672692894683</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- TODO https://github.com/jenkinsci/plugin-pom/issues/936 -->
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>5.0.0</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
Expand Down
30 changes: 17 additions & 13 deletions src/main/java/hudson/plugins/git/GitStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import hudson.security.ACL;
import hudson.security.ACLContext;
import hudson.triggers.SCMTrigger;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URISyntaxException;
import java.util.*;
Expand Down Expand Up @@ -177,20 +178,23 @@ public HttpResponse doNotifyCommit(HttpServletRequest request, @QueryParameter(r
contributors.addAll(listener.onNotifyCommit(origin, uri, sha1, buildParameters, branchesArray));
}

return (StaplerRequest req, StaplerResponse rsp, Object node) -> {
rsp.setStatus(SC_OK);
rsp.setContentType("text/plain");
for (int i = 0; i < contributors.size(); i++) {
if (i == MAX_REPORTED_CONTRIBUTORS) {
rsp.addHeader("Triggered", "<" + (contributors.size() - i) + " more>");
break;
} else {
contributors.get(i).addHeaders(req, rsp);
return new HttpResponse() {
@Override
public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException {
rsp.setStatus(SC_OK);
rsp.setContentType("text/plain");
for (int i = 0; i < contributors.size(); i++) {
if (i == MAX_REPORTED_CONTRIBUTORS) {
rsp.addHeader("Triggered", "<" + (contributors.size() - i) + " more>");
break;
} else {
contributors.get(i).addHeaders(req, rsp);
}
}
PrintWriter w = rsp.getWriter();
for (ResponseContributor c : contributors) {
c.writeBody(req, rsp, w);
}
}
PrintWriter w = rsp.getWriter();
for (ResponseContributor c : contributors) {
c.writeBody(req, rsp, w);
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hudson/plugins/git/browser/AssemblaWeb.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public FormValidation doCheckRepoUrl(@AncestorInPath Item project, @QueryParamet
return FormValidation.error(Messages.invalidUrl());
}
return new URLCheck() {
protected FormValidation check() throws IOException, ServletException {
protected FormValidation check() throws IOException {
String v = cleanUrl;
if (!v.endsWith("/")) {
v += '/';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public FormValidation doCheckRepoUrl(@QueryParameter(fixEmpty = true) String val
final String finalValue = value;
return new URLCheck() {
@Override
protected FormValidation check() throws IOException, ServletException {
protected FormValidation check() throws IOException {
try {
if (findText(open(new URL(finalValue)), "FishEye")) {
return FormValidation.ok();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public FormValidation doCheckRepoUrl(@AncestorInPath Item project, @QueryParamet
return FormValidation.error(Messages.invalidUrl());
}
return new URLCheck() {
protected FormValidation check() throws IOException, ServletException {
protected FormValidation check() throws IOException {
String v = cleanUrl;
if (!v.endsWith("/")) {
v += '/';
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hudson/plugins/git/browser/Gitiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public FormValidation doCheckRepoUrl(@AncestorInPath Item project, @QueryParamet
return FormValidation.error(Messages.invalidUrl());
}
return new URLCheck() {
protected FormValidation check() throws IOException, ServletException {
protected FormValidation check() throws IOException {
String v = cleanUrl;
if (!v.endsWith("/"))
v += '/';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public FormValidation doCheckRepoUrl(@QueryParameter(fixEmpty = true) String val
final String finalValue = value;
return new FormValidation.URLCheck() {
@Override
protected FormValidation check() throws IOException, ServletException {
protected FormValidation check() throws IOException {
try {
if (findText(open(new URL(finalValue)), "icrosoft")) {
return FormValidation.ok();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hudson/plugins/git/browser/ViewGitWeb.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public FormValidation doCheckRepoUrl(@AncestorInPath Item project, @QueryParamet
return FormValidation.error(Messages.invalidUrl());
}
return new URLCheck() {
protected FormValidation check() throws IOException, ServletException {
protected FormValidation check() throws IOException {
String v = cleanUrl;
if (!v.endsWith("/"))
v += '/';
Expand Down
9 changes: 5 additions & 4 deletions src/test/java/hudson/plugins/git/GitStatusTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.StaplerResponse2;

public class GitStatusTest extends AbstractGitProject {

Expand Down Expand Up @@ -584,7 +585,7 @@ public void testDoNotifyCommitWithValidSha1AndValidApiToken() throws Exception {
@Issue("SECURITY-284")
public void testDoNotifyCommitWithInvalidApiToken() throws Exception {
setupProjectWithTrigger("a", "master", false);
StaplerResponse res = mock(StaplerResponse.class);
StaplerResponse2 res = mock(StaplerResponse2.class);

HttpResponse httpResponse = this.gitStatus.doNotifyCommit(requestWithNoParameter, "a", "master", null, "invalid");
httpResponse.generateResponse(null, res, null);
Expand All @@ -608,7 +609,7 @@ public void testDoNotifyCommitWithUnauthenticatedPollingAllowed() throws Excepti
public void testDoNotifyCommitWithAllowModeRandomValue() throws Exception {
GitStatus.NOTIFY_COMMIT_ACCESS_CONTROL = "random";
setupProjectWithTrigger("a", "master", false);
StaplerResponse res = mock(StaplerResponse.class);
StaplerResponse2 res = mock(StaplerResponse2.class);

HttpResponse httpResponse = this.gitStatus.doNotifyCommit(requestWithNoParameter, "a", "master", null, null);
httpResponse.generateResponse(null, res, null);
Expand All @@ -621,7 +622,7 @@ public void testDoNotifyCommitWithAllowModeRandomValue() throws Exception {
public void testDoNotifyCommitWithSha1AndAllowModePoll() throws Exception {
GitStatus.NOTIFY_COMMIT_ACCESS_CONTROL = "disabled-for-polling";
setupProjectWithTrigger("a", "master", false);
StaplerResponse res = mock(StaplerResponse.class);
StaplerResponse2 res = mock(StaplerResponse2.class);

HttpResponse httpResponse = this.gitStatus.doNotifyCommit(requestWithNoParameter, "a", "master", sha1, null);
httpResponse.generateResponse(null, res, null);
Expand All @@ -634,7 +635,7 @@ public void testDoNotifyCommitWithSha1AndAllowModePoll() throws Exception {
public void testDoNotifyCommitWithSha1AndAllowModePollWithInvalidToken() throws Exception {
GitStatus.NOTIFY_COMMIT_ACCESS_CONTROL = "disabled-for-polling";
setupProjectWithTrigger("a", "master", false);
StaplerResponse res = mock(StaplerResponse.class);
StaplerResponse2 res = mock(StaplerResponse2.class);

HttpResponse httpResponse = this.gitStatus.doNotifyCommit(requestWithNoParameter, "a", "master", sha1, "invalid");
httpResponse.generateResponse(null, res, null);
Expand Down

0 comments on commit 9895071

Please sign in to comment.