Skip to content
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

2.9.0 backports 1 #25344

Merged
merged 31 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
83ac9bb
Kubernetes: Merge StatefulSet resources from input if set
Sgitario Apr 27, 2022
10f47d3
Use plain old ldc in RR generated code
geoand Apr 27, 2022
9c47bbe
Document how to configure well-known OIDC providers
sberyozkin Apr 27, 2022
83daee0
Bump dokka-maven-plugin from 1.6.10 to 1.6.21
dependabot[bot] Apr 25, 2022
3e6320f
Ensure that RESTEasy Reactive Links works with async return types
geoand Apr 27, 2022
e0e56a7
Re-initialize the Maven repo system on POM change in DevMojo
aloubyansky Apr 27, 2022
787a5a9
Fix Spotify image reference
sberyozkin Apr 28, 2022
974ceaf
Qute - fix param declaration validation
mkouba Apr 28, 2022
044ae0b
Sync with v0.92.2 tag of src/main/scripts from https://github.com/jba…
holly-cummins Apr 26, 2022
c3397c7
Add OIDC TLS key store provider property
sberyozkin Apr 28, 2022
3ce9053
Bump flyway.version from 8.5.9 to 8.5.10
dependabot[bot] Apr 28, 2022
00943b5
Scheduler - fix Trigger#isOverdue() for simple cron trigger
mkouba Apr 27, 2022
1974cef
Downgrade PostgreSQL driver to 42.3.3
gsmet Apr 27, 2022
e82d014
Fix GenerateToken class location in the JWT guide
sberyozkin Apr 29, 2022
80fb050
Scheduled methods - mark vertx context as safe
mkouba Apr 29, 2022
63237e5
Change path to http://localhost:8080/tokens
aona42 Apr 29, 2022
35f63e0
Ensure that @Produces is taken into account when checking for compres…
geoand Apr 30, 2022
b4898c5
Exclude hamcrest from testcontainers
rsvoboda Apr 28, 2022
0774835
Ignore ContextNotActiveException in RESTEasy Reactive when clearing r…
geoand May 2, 2022
9b3e801
Update Quarkus Tools for IntelliJ description
jeffmaury May 2, 2022
012cdbe
update jakarta websocket link
Apr 30, 2022
6582d52
Make templates adjust with scala version
ia3andy May 2, 2022
b785b36
Remove unused imports in RestEasy Reactive Client guide
gastaldi May 3, 2022
61670ea
Upgrades Infinispan to 13.0.9.Final and Protostream 4.4.3.Final
karesti May 2, 2022
673490c
Add migration note about Provider discovery via the Service Loader
geoand May 3, 2022
a193145
Keep ordering for parsing cookies as it is important
ejba May 1, 2022
29bac1d
Scheduled javadoc - clarify config property expressions
mkouba Apr 29, 2022
75b74fe
Properly pass media type to MessageBodyWriters
geoand May 2, 2022
3714f30
Add ClientBuilder service loader file to jaxrs-client-reactive
xstefank May 3, 2022
9e386e1
Add default sources unless default-jar has a custom classifier
aloubyansky Apr 29, 2022
3556287
DockerStatusBuildItem for caching isDockerWorking status.
ozangunalp Apr 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
<cronutils.version>9.1.6</cronutils.version>
<quartz.version>2.3.2</quartz.version>
<h2.version>2.1.210</h2.version>
<postgresql-jdbc.version>42.3.4</postgresql-jdbc.version>
<postgresql-jdbc.version>42.3.3</postgresql-jdbc.version>
<mariadb-jdbc.version>3.0.4</mariadb-jdbc.version>
<mysql-jdbc.version>8.0.29</mysql-jdbc.version>
<mssql-jdbc.version>7.2.2.jre8</mssql-jdbc.version>
Expand All @@ -127,8 +127,8 @@
<junit.jupiter.version>5.8.2</junit.jupiter.version>
<junit-pioneer.version>1.5.0</junit-pioneer.version>
<testng.version>6.14.2</testng.version>
<infinispan.version>13.0.8.Final</infinispan.version>
<infinispan.protostream.version>4.4.1.Final</infinispan.protostream.version>
<infinispan.version>13.0.9.Final</infinispan.version>
<infinispan.protostream.version>4.4.3.Final</infinispan.protostream.version>
<caffeine.version>2.9.3</caffeine.version>
<netty.version>4.1.74.Final</netty.version>
<reactive-streams.version>1.0.3</reactive-streams.version>
Expand All @@ -152,7 +152,7 @@
<maven-invoker.version>3.1.0</maven-invoker.version>
<awaitility.version>4.2.0</awaitility.version>
<jboss-logmanager.version>1.0.9</jboss-logmanager.version>
<flyway.version>8.5.9</flyway.version>
<flyway.version>8.5.10</flyway.version>
<yasson.version>1.0.11</yasson.version>
<liquibase.version>4.9.1</liquibase.version>
<snakeyaml.version>1.30</snakeyaml.version>
Expand Down Expand Up @@ -317,6 +317,17 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>${testcontainers.version}</version>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- OpenTelemetry components, imported as a BOM -->
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<!-- Quarkus uses jboss-parent and it comes with 3.8.1-jboss-1, we don't want that in the templates -->
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<kotlin.version>1.6.21</kotlin.version>
<dokka.version>1.6.10</dokka.version>
<dokka.version>1.6.21</dokka.version>
<scala.version>2.13.8</scala.version>
<scala-maven-plugin.version>4.6.1</scala-maven-plugin.version>
<!-- not pretty but this is used in the codestarts and we don't want to break compatibility -->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.quarkus.deployment;

import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.DockerStatusBuildItem;
import io.quarkus.deployment.builditem.LaunchModeBuildItem;

public class DockerStatusProcessor {

@BuildStep
DockerStatusBuildItem IsDockerWorking(LaunchModeBuildItem launchMode) {
return new DockerStatusBuildItem(new IsDockerWorking(launchMode.getLaunchMode().isDevOrTest()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.InvocationTargetException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.URI;
import java.net.URISyntaxException;
import java.time.Duration;
import java.util.List;
import java.util.Optional;
import java.util.function.BooleanSupplier;
Expand All @@ -25,6 +27,8 @@
public class IsDockerWorking implements BooleanSupplier {

private static final Logger LOGGER = Logger.getLogger(IsDockerWorking.class.getName());
public static final int DOCKER_HOST_CHECK_TIMEOUT = 1000;
public static final int DOCKER_CMD_CHECK_TIMEOUT = 3000;

private final List<Strategy> strategies;

Expand All @@ -40,6 +44,7 @@ public IsDockerWorking(boolean silent) {
@Override
public boolean getAsBoolean() {
for (Strategy strategy : strategies) {
LOGGER.debugf("Checking Docker Environment using strategy %s", strategy.getClass().getName());
Result result = strategy.get();
if (result == Result.AVAILABLE) {
return true;
Expand Down Expand Up @@ -113,7 +118,8 @@ public Result get() {
if (dockerHost != null && !dockerHost.startsWith("unix:")) {
try {
URI url = new URI(dockerHost);
try (Socket s = new Socket(url.getHost(), url.getPort())) {
try (Socket s = new Socket()) {
s.connect(new InetSocketAddress(url.getHost(), url.getPort()), DOCKER_HOST_CHECK_TIMEOUT);
return Result.AVAILABLE;
} catch (IOException e) {
LOGGER.warnf(
Expand Down Expand Up @@ -143,7 +149,7 @@ private DockerBinaryStrategy(boolean silent) {
@Override
public Result get() {
try {
if (!ExecUtil.execSilent(binary, "-v")) {
if (!ExecUtil.execSilentWithTimeout(Duration.ofMillis(DOCKER_CMD_CHECK_TIMEOUT), binary, "-v")) {
LOGGER.warnf("'%s -v' returned an error code. Make sure your Docker binary is correct", binary);
return Result.UNKNOWN;
}
Expand All @@ -154,7 +160,8 @@ public Result get() {

try {
OutputFilter filter = new OutputFilter();
if (ExecUtil.exec(new File("."), filter, "docker", "version", "--format", "'{{.Server.Version}}'")) {
if (ExecUtil.execWithTimeout(new File("."), filter, Duration.ofMillis(DOCKER_CMD_CHECK_TIMEOUT),
"docker", "version", "--format", "'{{.Server.Version}}'")) {
LOGGER.debugf("Docker daemon found. Version: %s", filter.getOutput());
return Result.AVAILABLE;
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package io.quarkus.deployment.builditem;

import io.quarkus.builder.item.SimpleBuildItem;
import io.quarkus.deployment.IsDockerWorking;

public final class DockerStatusBuildItem extends SimpleBuildItem {

private final IsDockerWorking isDockerWorking;
private Boolean cachedStatus;

public DockerStatusBuildItem(IsDockerWorking isDockerWorking) {
this.isDockerWorking = isDockerWorking;
}

public synchronized boolean isDockerAvailable() {
if (cachedStatus == null) {
cachedStatus = isDockerWorking.getAsBoolean();
}
return cachedStatus;
}
}
130 changes: 122 additions & 8 deletions core/deployment/src/main/java/io/quarkus/deployment/util/ExecUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.time.Duration;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;

import org.jboss.logging.Logger;
Expand All @@ -17,6 +19,8 @@ public class ExecUtil {
private static final Function<InputStream, Runnable> PRINT_OUTPUT = i -> new HandleOutput(i);
private static final Function<InputStream, Runnable> SILENT = i -> new HandleOutput(i, Logger.Level.DEBUG);

private static final int PROCESS_CHECK_INTERVAL = 500;

private static class HandleOutput implements Runnable {

private final InputStream is;
Expand Down Expand Up @@ -60,6 +64,18 @@ public static boolean exec(String command, String... args) {
return exec(new File("."), command, args);
}

/**
* Execute the specified command until the given timeout from within the current directory.
*
* @param timeout The timeout
* @param command The command
* @param args The command arguments
* @return true if commands where executed successfully
*/
public static boolean execWithTimeout(Duration timeout, String command, String... args) {
return execWithTimeout(new File("."), timeout, command, args);
}

/**
* Execute the specified command from within the current directory and hide the output.
*
Expand All @@ -71,6 +87,18 @@ public static boolean execSilent(String command, String... args) {
return execSilent(new File("."), command, args);
}

/**
* Execute the specified command until the given timeout from within the current directory and hide the output.
*
* @param timeout The timeout
* @param command The command
* @param args The command arguments
* @return true if commands where executed successfully
*/
public static boolean execSilentWithTimeout(Duration timeout, String command, String... args) {
return execSilentWithTimeout(new File("."), timeout, command, args);
}

/**
* Execute the specified command from within the specified directory.
*
Expand All @@ -83,6 +111,19 @@ public static boolean exec(File directory, String command, String... args) {
return exec(directory, PRINT_OUTPUT, command, args);
}

/**
* Execute the specified command until the given timeout from within the specified directory.
*
* @param directory The directory
* @param timeout The timeout
* @param command The command
* @param args The command arguments
* @return true if commands where executed successfully
*/
public static boolean execWithTimeout(File directory, Duration timeout, String command, String... args) {
return execWithTimeout(directory, PRINT_OUTPUT, timeout, command, args);
}

/**
* Execute the specified command from within the specified directory and hide the output.
*
Expand All @@ -95,6 +136,19 @@ public static boolean execSilent(File directory, String command, String... args)
return exec(directory, SILENT, command, args);
}

/**
* Execute the specified command until the given timeout from within the specified directory and hide the output.
*
* @param directory The directory
* @param timeout The timeout
* @param command The command
* @param args The command arguments
* @return true if commands where executed successfully
*/
public static boolean execSilentWithTimeout(File directory, Duration timeout, String command, String... args) {
return execWithTimeout(directory, SILENT, timeout, command, args);
}

/**
* Execute the specified command from within the specified directory.
* The method allows specifying an output filter that processes the command output.
Expand All @@ -107,27 +161,87 @@ public static boolean execSilent(File directory, String command, String... args)
*/
public static boolean exec(File directory, Function<InputStream, Runnable> outputFilterFunction, String command,
String... args) {
Process process = null;
try {
Process process = startProcess(directory, command, args);
outputFilterFunction.apply(process.getInputStream());
process.waitFor();
return process.exitValue() == 0;
} catch (InterruptedException e) {
return false;
}
}

/**
* Execute the specified command until the given timeout from within the specified directory.
* The method allows specifying an output filter that processes the command output.
*
* @param directory The directory
* @param outputFilterFunction A {@link Function} that gets an {@link InputStream} and returns an outputFilter.
* @param timeout The timeout
* @param command The command
* @param args The command arguments
* @return true if commands where executed successfully
*/
public static boolean execWithTimeout(File directory, Function<InputStream, Runnable> outputFilterFunction,
Duration timeout, String command, String... args) {
try {
Process process = startProcess(directory, command, args);
Thread t = new Thread(outputFilterFunction.apply(process.getInputStream()));
t.setName("Process stdout");
t.setDaemon(true);
t.start();
process.waitFor(timeout.toMillis(), TimeUnit.MILLISECONDS);
destroyProcess(process);
return process.exitValue() == 0;
} catch (InterruptedException e) {
return false;
}
}

/**
* Start a process executing given command with arguments within the specified directory.
*
* @param directory The directory
* @param command The command
* @param args The command arguments
* @return the process
*/
public static Process startProcess(File directory, String command, String... args) {
try {
String[] cmd = new String[args.length + 1];
cmd[0] = command;
if (args.length > 0) {
System.arraycopy(args, 0, cmd, 1, args.length);
}
process = new ProcessBuilder()
return new ProcessBuilder()
.directory(directory)
.command(cmd)
.redirectErrorStream(true)
.start();

outputFilterFunction.apply(process.getInputStream()).run();
process.waitFor();
} catch (IOException e) {
throw new RuntimeException("Input/Output error while executing command.", e);
} catch (InterruptedException e) {
return false;
}
return process != null && process.exitValue() == 0;
}

/**
* Kill the process, if still alive, kill it forcibly
*
* @param process the process to kill
*/
public static void destroyProcess(Process process) {
process.destroy();
int i = 0;
while (process.isAlive() && i++ < 10) {
try {
process.waitFor(PROCESS_CHECK_INTERVAL, TimeUnit.MILLISECONDS);
} catch (InterruptedException ignored) {
Thread.currentThread().interrupt();
}
}

if (process.isAlive()) {
process.destroyForcibly();
}
}

}
Loading