Merge remote-tracking branch 'origin/jetty-10.0.x' into jetty-11.0.x

This commit is contained in:
Joakim Erdfelt 2022-07-01 16:25:50 -05:00
commit 26c44f4033
No known key found for this signature in database
GPG Key ID: 2D0E1FB8FE4B68B4
10 changed files with 195 additions and 16 deletions

87
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@ -0,0 +1,87 @@
name: "CodeQL"
on:
push:
branches: [ 'jetty-10.[1-9]?[0-9].x', 'jetty-11.[1-9]?[0-9].x', 'jetty-12.[1-9]?[0-9].x' ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ 'jetty-10.[1-9]?[0-9].x', 'jetty-11.[1-9]?[0-9].x', 'jetty-12.[1-9]?[0-9].x' ]
schedule:
- cron: '22 1 * * 2'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'java', 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Install and setup JDK 11
- name: Setup JDK 11
uses: actions/setup-java@v3
if: ${{
startsWith(github.ref, 'refs/heads/jetty-10.') ||
startsWith(github.ref, 'refs/heads/jetty-11.') ||
startsWith(github.base_ref, 'jetty-10.') ||
startsWith(github.base_ref, 'jetty-11.')
}}
with:
distribution: temurin
java-version: 11
cache: maven
# Install and setup JDK 17
- name: Setup JDK 17
uses: actions/setup-java@v3
if: ${{
startsWith(github.ref, 'refs/heads/jetty-12.') ||
startsWith(github.base_ref, 'jetty-12.')
}}
with:
distribution: temurin
java-version: 17
cache: maven
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

7
Jenkinsfile vendored
View File

@ -3,7 +3,10 @@
pipeline { pipeline {
agent any agent any
// save some io during the build // save some io during the build
options { durabilityHint('PERFORMANCE_OPTIMIZED') } options {
skipDefaultCheckout()
durabilityHint('PERFORMANCE_OPTIMIZED')
}
stages { stages {
stage("Parallel Stage") { stage("Parallel Stage") {
parallel { parallel {
@ -12,6 +15,7 @@ pipeline {
steps { steps {
container('jetty-build') { container('jetty-build') {
timeout( time: 180, unit: 'MINUTES' ) { timeout( time: 180, unit: 'MINUTES' ) {
checkout scm
mavenBuild( "jdk17", "clean install -Perrorprone", "maven3") mavenBuild( "jdk17", "clean install -Perrorprone", "maven3")
// Collect up the jacoco execution results (only on main build) // Collect up the jacoco execution results (only on main build)
jacoco inclusionPattern: '**/org/eclipse/jetty/**/*.class', jacoco inclusionPattern: '**/org/eclipse/jetty/**/*.class',
@ -42,6 +46,7 @@ pipeline {
steps { steps {
container( 'jetty-build' ) { container( 'jetty-build' ) {
timeout( time: 180, unit: 'MINUTES' ) { timeout( time: 180, unit: 'MINUTES' ) {
checkout scm
mavenBuild( "jdk11", "clean install -Dspotbugs.skip=true -Djacoco.skip=true", "maven3") mavenBuild( "jdk11", "clean install -Dspotbugs.skip=true -Djacoco.skip=true", "maven3")
recordIssues id: "jdk11", name: "Static Analysis jdk11", aggregatingResults: true, enabledForFailure: true, tools: [mavenConsole(), java(), checkStyle()] recordIssues id: "jdk11", name: "Static Analysis jdk11", aggregatingResults: true, enabledForFailure: true, tools: [mavenConsole(), java(), checkStyle()]
} }

View File

@ -13,7 +13,7 @@
<name>Jetty :: GCloud</name> <name>Jetty :: GCloud</name>
<properties> <properties>
<gcloud.version>2.7.0</gcloud.version> <gcloud.version>2.9.1</gcloud.version>
</properties> </properties>
<modules> <modules>

View File

@ -12,7 +12,7 @@
<packaging>pom</packaging> <packaging>pom</packaging>
<properties> <properties>
<osgi-version>3.17.200</osgi-version> <osgi-version>3.18.0</osgi-version>
<osgi-services-version>3.10.200</osgi-services-version> <osgi-services-version>3.10.200</osgi-services-version>
<osgi-util-version>3.6.100</osgi-util-version> <osgi-util-version>3.6.100</osgi-util-version>
<equinox-http-servlet-version>1.0.0-v20070606</equinox-http-servlet-version> <equinox-http-servlet-version>1.0.0-v20070606</equinox-http-servlet-version>

View File

@ -29,6 +29,7 @@ import java.net.Socket;
import java.net.SocketTimeoutException; import java.net.SocketTimeoutException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -187,7 +188,7 @@ public class Main
public void invokeMain(ClassLoader classloader, StartArgs args) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, IOException public void invokeMain(ClassLoader classloader, StartArgs args) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, IOException
{ {
if (args.getEnabledModules().isEmpty()) if (args.getSelectedModules().isEmpty())
{ {
if (Files.exists(getBaseHome().getBasePath("start.jar"))) if (Files.exists(getBaseHome().getBasePath("start.jar")))
StartLog.error("Do not start with ${jetty.base} == ${jetty.home}!"); StartLog.error("Do not start with ${jetty.base} == ${jetty.home}!");
@ -325,12 +326,22 @@ public class Main
modules.registerAll(); modules.registerAll();
// 4) Active Module Resolution // 4) Active Module Resolution
for (String enabledModule : modules.getSortedNames(args.getEnabledModules())) List<String> selectedModules = args.getSelectedModules();
List<String> sortedSelectedModules = modules.getSortedNames(selectedModules);
List<String> unknownModules = new ArrayList<>(selectedModules);
unknownModules.removeAll(sortedSelectedModules);
if (unknownModules.size() >= 1)
{ {
for (String source : args.getSources(enabledModule)) throw new UsageException(UsageException.ERR_UNKNOWN, "Unknown module%s=[%s] List available with --list-modules",
unknownModules.size() > 1 ? 's' : "",
String.join(", ", unknownModules));
}
for (String selectedModule : sortedSelectedModules)
{
for (String source : args.getSources(selectedModule))
{ {
String shortForm = baseHome.toShortForm(source); String shortForm = baseHome.toShortForm(source);
modules.enable(enabledModule, shortForm); modules.enable(selectedModule, shortForm);
} }
} }
@ -470,8 +481,7 @@ public class Main
CommandLineBuilder cmd = args.getMainArgs(StartArgs.ALL_PARTS); CommandLineBuilder cmd = args.getMainArgs(StartArgs.ALL_PARTS);
cmd.debug(); cmd.debug();
List<String> execModules = args.getEnabledModules().stream() List<String> execModules = args.getAllModules().getEnabled().stream()
.map(name -> args.getAllModules().get(name))
// Keep only the forking modules. // Keep only the forking modules.
.filter(module -> !module.getJvmArgs().isEmpty()) .filter(module -> !module.getJvmArgs().isEmpty())
.map(Module::getName) .map(Module::getName)

View File

@ -395,7 +395,6 @@ public class Modules implements Iterable<Module>
order.add(name); order.add(name);
} }
} }
return order; return order;
} }

View File

@ -646,7 +646,29 @@ public class StartArgs
return classpath; return classpath;
} }
/**
* @deprecated use {@link #getSelectedModules()} instead
*/
@Deprecated
public List<String> getEnabledModules() public List<String> getEnabledModules()
{
return getSelectedModules();
}
/**
* <p>
* The list of selected Modules to enable based on configuration
* obtained from {@code start.d/*.ini}, {@code start.ini}, and command line.
* </p>
*
* <p>
* For full list of enabled modules, use {@link Modules#getEnabled()}
* </p>
*
* @return the list of selected modules (by name) that the configuration has.
* @see Modules#getEnabled()
*/
public List<String> getSelectedModules()
{ {
return this.modules; return this.modules;
} }
@ -1315,11 +1337,11 @@ public class StartArgs
return; return;
} }
// Enable a module // Select a module to eventually be enabled
if (arg.startsWith("--module=")) if (arg.startsWith("--module="))
{ {
List<String> moduleNames = Props.getValues(arg); List<String> moduleNames = Props.getValues(arg);
enableModules(source, moduleNames); selectModules(source, moduleNames);
return; return;
} }
@ -1464,7 +1486,7 @@ public class StartArgs
setProperty(key, value, source); setProperty(key, value, source);
} }
private void enableModules(String source, List<String> moduleNames) private void selectModules(String source, List<String> moduleNames)
{ {
for (String moduleName : moduleNames) for (String moduleName : moduleNames)
{ {

View File

@ -71,7 +71,7 @@ public class MavenMetadataTest
@Test @Test
public void testIsExpiredTimestampNow() public void testIsExpiredTimestampNow()
{ {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now(ZoneId.of("UTC"));
String timestamp = getTimestampFormatter().format(now); String timestamp = getTimestampFormatter().format(now);
assertFalse(MavenMetadata.isExpiredTimestamp(timestamp), "Timestamp should NOT be stale: " + timestamp); assertFalse(MavenMetadata.isExpiredTimestamp(timestamp), "Timestamp should NOT be stale: " + timestamp);
} }

View File

@ -26,6 +26,7 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import org.eclipse.jetty.start.Props; import org.eclipse.jetty.start.Props;
import org.eclipse.jetty.start.UsageException;
import org.eclipse.jetty.toolchain.test.FS; import org.eclipse.jetty.toolchain.test.FS;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.toolchain.test.PathAssert; import org.eclipse.jetty.toolchain.test.PathAssert;
@ -34,10 +35,12 @@ import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.empty; import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.startsWith; import static org.hamcrest.Matchers.startsWith;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class BasicTest extends AbstractUseCase public class BasicTest extends AbstractUseCase
{ {
@ -110,6 +113,59 @@ public class BasicTest extends AbstractUseCase
assertThat("System.getProperty(jetty.base)", System.getProperty("jetty.base"), is(not(startsWith("file:")))); assertThat("System.getProperty(jetty.base)", System.getProperty("jetty.base"), is(not(startsWith("file:"))));
} }
@Test
public void testAddModuleDoesNotExist() throws Exception
{
setupDistHome();
Files.write(baseDir.resolve("start.ini"),
List.of(
"--module=main",
"--module=does-not-exist"
),
StandardCharsets.UTF_8);
// === Execute Main
List<String> runArgs = new ArrayList<>();
runArgs.add("--create-files");
UsageException usage = assertThrows(UsageException.class, () ->
{
ExecResults results = exec(runArgs, true);
if (results.exception != null)
{
throw results.exception;
}
});
assertThat(usage.getMessage(), containsString("Unknown module=[does-not-exist]"));
}
@Test
public void testAddModuleDoesNotExistMultiple() throws Exception
{
setupDistHome();
Files.write(baseDir.resolve("start.ini"),
List.of(
"--module=main",
"--module=does-not-exist",
"--module=also-not-present"
),
StandardCharsets.UTF_8);
// === Execute Main
List<String> runArgs = new ArrayList<>();
runArgs.add("--create-files");
UsageException usage = assertThrows(UsageException.class, () ->
{
ExecResults results = exec(runArgs, true);
if (results.exception != null)
{
throw results.exception;
}
});
assertThat(usage.getMessage(), containsString("Unknown modules=[does-not-exist, also-not-present]"));
}
@Test @Test
public void testProvidersUsingDefault() throws Exception public void testProvidersUsingDefault() throws Exception
{ {

View File

@ -91,7 +91,7 @@
<jetty-test-policy.version>1.2</jetty-test-policy.version> <jetty-test-policy.version>1.2</jetty-test-policy.version>
<jetty.test.version>5.9</jetty.test.version> <jetty.test.version>5.9</jetty.test.version>
<jmh.version>1.35</jmh.version> <jmh.version>1.35</jmh.version>
<jna.version>5.11.0</jna.version> <jna.version>5.12.1</jna.version>
<jnr-constants.version>0.10.3</jnr-constants.version> <jnr-constants.version>0.10.3</jnr-constants.version>
<jnr-enxio.version>0.32.13</jnr-enxio.version> <jnr-enxio.version>0.32.13</jnr-enxio.version>
<jnr-ffi.version>2.2.12</jnr-ffi.version> <jnr-ffi.version>2.2.12</jnr-ffi.version>
@ -120,7 +120,7 @@
<springboot.version>2.1.1.RELEASE</springboot.version> <springboot.version>2.1.1.RELEASE</springboot.version>
<taglibs-standard-impl.version>1.2.5</taglibs-standard-impl.version> <taglibs-standard-impl.version>1.2.5</taglibs-standard-impl.version>
<taglibs-standard-spec.version>1.2.5</taglibs-standard-spec.version> <taglibs-standard-spec.version>1.2.5</taglibs-standard-spec.version>
<testcontainers.version>1.17.2</testcontainers.version> <testcontainers.version>1.17.3</testcontainers.version>
<weld.version>4.0.3.Final</weld.version> <weld.version>4.0.3.Final</weld.version>
<wildfly.common.version>1.6.0.Final</wildfly.common.version> <wildfly.common.version>1.6.0.Final</wildfly.common.version>
<wildfly.elytron.version>1.19.0.Final</wildfly.elytron.version> <wildfly.elytron.version>1.19.0.Final</wildfly.elytron.version>