Skip to content

Commit

Permalink
Add Java 17 to build/test matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Mar 16, 2022
1 parent 1f9d510 commit 9f48658
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ properties([
])

def buildTypes = ['Linux', 'Windows']
def jdks = [8, 11]
def jdks = [8, 11, 17]

def builds = [:]
for (i = 0; i < buildTypes.size(); i++) {
Expand All @@ -30,6 +30,9 @@ for (i = 0; i < buildTypes.size(); i++) {
if (buildType == 'Windows' && jdk == 8) {
continue // unnecessary use of hardware
}
if (buildType == 'Windows' && jdk == 17) {
continue // TODO pending jenkins-infra/helpdesk#2822
}
builds["${buildType}-jdk${jdk}"] = {
// see https://github.com/jenkins-infra/documentation/blob/master/ci.adoc#node-labels for information on what node types are available
def agentContainerLabel = jdk == 8 ? 'maven' : 'maven-' + jdk
Expand Down
16 changes: 16 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -818,5 +818,21 @@ THE SOFTWARE.
<maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
</properties>
</profile>
<profile>
<id>jdk-9-and-above</id>
<activation>
<jdk>[9,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
22 changes: 22 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -822,5 +822,27 @@ THE SOFTWARE.
<failIfNoTests>false</failIfNoTests>
</properties>
</profile>
<profile>
<id>jdk-17-and-above</id>
<activation>
<jdk>[17,)</jdk>
</activation>
<properties>
<!--
Animal Sniffer does not work on Java 17, but we cannot remove it from our configuration
entirely until we drop support for Java 8. As a temporary solution, we skip it when
running on Java 17. When JENKINS-54842 is resolved, this can be deleted.
-->
<animal.sniffer.skip>true</animal.sniffer.skip>

<!--
Spotless requires custom arguments to be added to .mvn/jvm.config when running on Java 17,
but we cannot add those custom arguments until we drop support for Java 8. As a temporary
workaround, we skip Spotless when running on Java 17. When JENKINS-68015 is rseolved, this
can be deleted.
-->
<spotless.check.skip>true</spotless.check.skip>
</properties>
</profile>
</profiles>
</project>
33 changes: 32 additions & 1 deletion test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ THE SOFTWARE.
<artifactId>maven-surefire-plugin</artifactId>
<!-- version specified in grandparent pom -->
<configuration>
<argLine>${jacocoSurefireArgs} -Xmx1g</argLine>
<systemPropertyVariables>
<hudson.maven.debug>${mavenDebug}</hudson.maven.debug>
<buildDirectory>${project.build.directory}</buildDirectory>
Expand Down Expand Up @@ -338,5 +337,37 @@ THE SOFTWARE.
</plugins>
</build>
</profile>
<profile>
<id>jdk-8-and-below</id>
<activation>
<jdk>(,1.8]</jdk>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>${jacocoSurefireArgs} -Xmx1g</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>jdk-9-and-above</id>
<activation>
<jdk>[9,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>${jacocoSurefireArgs} -Xmx1g --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
12 changes: 12 additions & 0 deletions test/src/test/java/jenkins/security/Security637Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assume.assumeTrue;

import hudson.Launcher;
import hudson.model.AbstractBuild;
Expand All @@ -38,6 +39,7 @@
import hudson.model.JobProperty;
import hudson.model.JobPropertyDescriptor;
import hudson.slaves.DumbSlave;
import hudson.util.VersionNumber;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.URL;
Expand All @@ -60,6 +62,11 @@ public class Security637Test {
@Test
@Issue("SECURITY-637")
public void urlSafeDeserialization_handler_inSameJVMRemotingContext() throws Throwable {
assumeTrue(
"TODO does not work on Java 17+",
new VersionNumber(System.getProperty("java.specification.version"))
.isOlderThan(new VersionNumber("17")));

sessions.then(j -> {
DumbSlave slave = j.createOnlineSlave();
String unsafeHandlerClassName = slave.getChannel().call(new URLHandlerCallable(new URL("https://www.google.com/")));
Expand Down Expand Up @@ -169,6 +176,11 @@ public URL call() throws Exception {
@Test
@Issue("SECURITY-637")
public void urlSafeDeserialization_inXStreamContext() throws Throwable {
assumeTrue(
"TODO does not work on Java 17+",
new VersionNumber(System.getProperty("java.specification.version"))
.isOlderThan(new VersionNumber("17")));

sessions.then(j -> {
FreeStyleProject project = j.createFreeStyleProject("project-with-url");
URLJobProperty URLJobProperty = new URLJobProperty(
Expand Down

0 comments on commit 9f48658

Please sign in to comment.