Skip to content

Commit

Permalink
Merge pull request #26941 from gsmet/2.11.1-backports-1
Browse files Browse the repository at this point in the history
2.11.1 backports 1
  • Loading branch information
gsmet authored Jul 26, 2022
2 parents fbe4c36 + 94f67ef commit 64a9e87
Show file tree
Hide file tree
Showing 51 changed files with 444 additions and 204 deletions.
4 changes: 2 additions & 2 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<smallrye-config.version>2.10.1</smallrye-config.version>
<smallrye-health.version>3.2.1</smallrye-health.version>
<smallrye-metrics.version>3.0.5</smallrye-metrics.version>
<smallrye-open-api.version>2.1.22</smallrye-open-api.version>
<smallrye-open-api.version>2.1.23</smallrye-open-api.version>
<smallrye-graphql.version>1.6.0</smallrye-graphql.version>
<smallrye-opentracing.version>2.1.0</smallrye-opentracing.version>
<smallrye-fault-tolerance.version>5.5.0</smallrye-fault-tolerance.version>
Expand Down Expand Up @@ -116,7 +116,7 @@
<httpasync.version>4.1.5</httpasync.version>
<cronutils.version>9.1.6</cronutils.version>
<quartz.version>2.3.2</quartz.version>
<h2.version>2.1.210</h2.version>
<h2.version>2.1.214</h2.version>
<postgresql-jdbc.version>42.4.0</postgresql-jdbc.version>
<mariadb-jdbc.version>3.0.6</mariadb-jdbc.version>
<mysql-jdbc.version>8.0.29</mysql-jdbc.version>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package io.quarkus.deployment.builditem;

import java.util.Collection;
import java.util.List;

import io.quarkus.builder.item.MultiBuildItem;

/**
Expand All @@ -12,21 +15,40 @@
*/
public final class DevServicesAdditionalConfigBuildItem extends MultiBuildItem {

private final String triggeringKey;
private final Collection<String> triggeringKeys;
private final String key;
private final String value;
private final Runnable callbackWhenEnabled;

/**
* @deprecated Call
* {@link DevServicesAdditionalConfigBuildItem#DevServicesAdditionalConfigBuildItem(Collection, String, String, Runnable)}
* instead.
*/
@Deprecated
public DevServicesAdditionalConfigBuildItem(String triggeringKey,
String key, String value, Runnable callbackWhenEnabled) {
this.triggeringKey = triggeringKey;
this(List.of(triggeringKey), key, value, callbackWhenEnabled);
}

public DevServicesAdditionalConfigBuildItem(Collection<String> triggeringKeys,
String key, String value, Runnable callbackWhenEnabled) {
this.triggeringKeys = triggeringKeys;
this.key = key;
this.value = value;
this.callbackWhenEnabled = callbackWhenEnabled;
}

/**
* @deprecated Call {@link #getTriggeringKeys()} instead.
*/
@Deprecated
public String getTriggeringKey() {
return triggeringKey;
return getTriggeringKeys().iterator().next();
}

public Collection<String> getTriggeringKeys() {
return triggeringKeys;
}

public String getKey() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void run() {
// On contrary to dev services config, "additional" config build items are
// produced on each restart, so we don't want to remember them from one restart to the next.
for (DevServicesAdditionalConfigBuildItem item : devServicesAdditionalConfigBuildItems) {
if (newProperties.containsKey(item.getTriggeringKey())) {
if (item.getTriggeringKeys().stream().anyMatch(newProperties::containsKey)) {
var callback = item.getCallbackWhenEnabled();
if (callback != null) {
callback.run(); // This generally involves logging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ public final void stop() {
* stop, that exception is propagated.
*/
public final void stop(Runnable afterStopTask) {
Logger logger = Logger.getLogger(Application.class);
logger.debugf("Stopping application");
if (logger.isTraceEnabled()) {
logger.tracef(new RuntimeException("Application Stop Stack Trace"), "Application shutting down");
}
final Lock stateLock = this.stateLock;
stateLock.lock();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ public class ApplicationLifecycleManager {
private static volatile BiConsumer<Integer, Throwable> defaultExitCodeHandler = new BiConsumer<Integer, Throwable>() {
@Override
public void accept(Integer integer, Throwable cause) {
Logger logger = Logger.getLogger(Application.class);
logger.debugf("Shutting down with exit code %s", integer);
if (logger.isTraceEnabled()) {
logger.tracef(new RuntimeException("Shutdown Stack Trace"), "Shutdown triggered");
}
System.exit(integer);
}
};
Expand Down Expand Up @@ -273,6 +278,8 @@ private static void registerSignalHandlers(final BiConsumer<Integer, Throwable>
final SignalHandler exitHandler = new SignalHandler() {
@Override
public void handle(Signal signal) {
Logger applicationLogger = Logger.getLogger(Application.class);
applicationLogger.debugf("Received signed %s, shutting down", signal.getNumber());
exitCodeHandler.accept(signal.getNumber() + 0x80, null);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.OptionalInt;
import java.util.Properties;
import java.util.Set;
Expand All @@ -25,6 +26,7 @@
import java.util.UUID;
import java.util.function.IntFunction;

import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.ConfigProvider;
import org.eclipse.microprofile.config.spi.ConfigSource;
import org.eclipse.microprofile.config.spi.ConfigSourceProvider;
Expand Down Expand Up @@ -270,6 +272,48 @@ public static boolean isPropertyPresent(String propertyName) {
return ConfigProvider.getConfig().unwrap(SmallRyeConfig.class).isPropertyPresent(propertyName);
}

/**
* Checks if any of the given properties is present in the current Configuration.
* <p>
* Because the sources may not expose the property directly in {@link ConfigSource#getPropertyNames()}, we cannot
* reliably determine if the property is present in the properties list. The property needs to be retrieved to make
* sure it exists. Also, if the value is an expression, we want to ignore expansion, because this is not relevant
* for the check and the expansion value may not be available at this point.
* <p>
* It may be interesting to expose such API in SmallRyeConfig directly.
*
* @param propertyNames The configuration property names
* @return true if the property is present or false otherwise.
*/
public static boolean isAnyPropertyPresent(Collection<String> propertyNames) {
for (String propertyName : propertyNames) {
if (isPropertyPresent(propertyName)) {
return true;
}
}
return false;
}

/**
* Get the value of the first given property present in the current Configuration,
* or {@link Optional#empty()} if none of the properties is present.
*
* @param <T> The property type
* @param propertyNames The configuration property names
* @param propertyType The type that the resolved property value should be converted to
* @return true if the property is present or false otherwise.
*/
public static <T> Optional<T> getFirstOptionalValue(List<String> propertyNames, Class<T> propertyType) {
Config config = ConfigProvider.getConfig();
for (String propertyName : propertyNames) {
Optional<T> value = config.getOptionalValue(propertyName, propertyType);
if (value.isPresent()) {
return value;
}
}
return Optional.empty();
}

/**
* We override the EnvConfigSource, because we don't want the nothing back from getPropertiesNames at build time.
* The mapping is one way and there is no way to map them back.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public void startDev() {
String outputFile = System.getProperty(IO_QUARKUS_DEVMODE_ARGS);
if (outputFile == null) {
getProject().exec(action -> {
action.commandLine(runner.args()).workingDir(QuarkusPluginExtension.getLastFile(getCompilationOutput()));
action.commandLine(runner.args()).workingDir(getWorkingDirectory().get());
action.setStandardInput(System.in)
.setErrorOutput(System.out)
.setStandardOutput(System.out);
Expand Down
9 changes: 8 additions & 1 deletion devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.aesh.readline.terminal.impl.Pty;
import org.aesh.terminal.Attributes;
import org.aesh.terminal.utils.ANSI;
import org.apache.commons.lang3.StringUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.BuildBase;
Expand Down Expand Up @@ -514,7 +515,13 @@ private void handleAutoCompile() throws MojoExecutionException {
String jandexGoalPhase = getGoalPhaseOrNull(ORG_JBOSS_JANDEX, JANDEX_MAVEN_PLUGIN, "jandex", "process-classes");
boolean indexClassNeeded = jandexGoalPhase != null;

for (String goal : session.getGoals()) {
List<String> goals = session.getGoals();
// check for default goal(s) if none were specified explicitly,
// see also org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator
if (goals.isEmpty() && !StringUtils.isEmpty(project.getDefaultGoal())) {
goals = List.of(StringUtils.split(project.getDefaultGoal()));
}
for (String goal : goals) {
if (goal.endsWith("quarkus:generate-code")) {
prepareNeeded = false;
}
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/config-mappings.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ server.port=8080

==== `@WithParentName`

The `@WithParent` annotation allows to configurations mapping to inherit its container name, simplifying the
The `@WithParentName` annotation allows to configurations mapping to inherit its container name, simplifying the
configuration property name required to match the mapping:

[source,java]
Expand Down
8 changes: 4 additions & 4 deletions docs/src/main/asciidoc/deploying-to-kubernetes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1078,9 +1078,9 @@ The provided replicas <1>, labels <2> and environment variables <3> were retain

== Service Binding [[service_binding]]

Quarkus supports the link:https://github.com/k8s-service-bindings/spec[Service Binding Specification for Kubernetes] to bind services to applications.
Quarkus supports the link:https://github.com/servicebinding/spec[Service Binding Specification for Kubernetes] to bind services to applications.

Specifically, Quarkus implements the link:https://github.com/k8s-service-bindings/spec#workload-projection[Workload Projection] part of the specification, therefore allowing applications to bind to services, such as a Database or a Broker, without the need for user configuration.
Specifically, Quarkus implements the link:https://github.com/servicebinding/spec#workload-projection[Workload Projection] part of the specification, therefore allowing applications to bind to services, such as a Database or a Broker, without the need for user configuration.

To enable Service Binding for supported extensions, add the `quarkus-kubernetes-service-binding` extension to the application dependencies.

Expand Down Expand Up @@ -1116,7 +1116,7 @@ For an example of a workload projection where the directory structure is include

== Introduction to the Service Binding Operator

The link:https://github.com/redhat-developer/service-binding-operator[Service Binding Operator] is an Operator that implements link:https://github.com/k8s-service-bindings/spec[Service Binding Specification for Kubernetes] and is meant to simplify the binding of services to an application. Containerized applications that support link:https://github.com/k8s-service-bindings/spec#workload-projection[Workload Projection] obtain service binding information in the form of volume mounts. The Service Binding Operator reads binding service information and mounts it to the application containers that need it.
The link:https://github.com/redhat-developer/service-binding-operator[Service Binding Operator] is an Operator that implements link:https://github.com/servicebinding/spec[Service Binding Specification for Kubernetes] and is meant to simplify the binding of services to an application. Containerized applications that support link:https://github.com/servicebinding/spec#workload-projection[Workload Projection] obtain service binding information in the form of volume mounts. The Service Binding Operator reads binding service information and mounts it to the application containers that need it.

The correlation between application and bound services is expressed through the `ServiceBinding` resources, which declares the intent of what services are meant to be bound to what application.

Expand Down Expand Up @@ -1322,4 +1322,4 @@ quarkus.kubernetes-service-binding.services.fruits-db.name=fruits-db
====

.Additional resources
* For more details about the available properties and how do they work, see the link:https://github.com/k8s-service-bindings/spec#workload-projection[Workload Projection] part of the Service Binding specification.
* For more details about the available properties and how do they work, see the link:https://github.com/servicebinding/spec#workload-projection[Workload Projection] part of the Service Binding specification.
5 changes: 4 additions & 1 deletion docs/src/main/asciidoc/includes/extension-status.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ endif::[]
ifeval::["{extension-status}" == "stable"]
Being _stable_, backward compatibility and presence in the ecosystem are taken very seriously.
endif::[]
ifeval::["{extension-status}" == "deprecated"]
Being _deprecated_ means that this extension is likely to be replaced or removed in a future version of Quarkus.
endif::[]
For a full list of possible statuses, check our https://quarkus.io/faq/#extension-status[FAQ entry].
For a full list of possible statuses, check our https://quarkus.io/faq/#what-are-the-extension-statuses[FAQ entry].
====
4 changes: 2 additions & 2 deletions docs/src/main/asciidoc/resteasy-reactive.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@ The following parameter types will be supported out of the box:
|link:{jdkapi}/java/math/BigDecimal.html[`BigDecimal`], link:{jdkapi}/java/math/BigInteger.html[`BigInteger`]
|Large integers and decimals.

|link:{jsonpapi}/javax/json/JsonArray.html[`JsonArray`], link:{jsonpapi}/javax/json/JsonArray.html[`JsonObject`],
link:{jsonpapi}/javax/json/JsonArray.html[`JsonStructure`], link:{jsonpapi}/javax/json/JsonArray.html[`JsonValue`]
|link:{jsonpapi}/javax/json/JsonArray.html[`JsonArray`], link:{jsonpapi}/javax/json/JsonObject.html[`JsonObject`],
link:{jsonpapi}/javax/json/JsonStructure.html[`JsonStructure`], link:{jsonpapi}/javax/json/JsonValue.html[`JsonValue`]
|JSON value types

|link:{vertxapi}io/vertx/core/buffer/Buffer.html[`Buffer`]
Expand Down
10 changes: 10 additions & 0 deletions docs/src/main/asciidoc/stork-kubernetes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,16 @@ The generated manifest can be applied to the cluster from the project root using
kubectl apply -f target/kubernetes/kubernetes.yml -n=development
----


[NOTE]
====
Please note that if you use Elliptic Curve keys with Stork and are getting exceptions like `java.lang.ClassNotFoundException: org.bouncycastle.jce.provider.BouncyCastleProvider`, then adding a BouncyCastle PKIX dependency (`org.bouncycastle:bcpkix-jdk15on`) is required.
Note that internally an `org.bouncycastle.jce.provider.BouncyCastleProvider` provider will be registered if it has not already been registered.
You can have this provider registered as described in the xref:security-customization.adoc#bouncy-castle[BouncyCastle] or xref:security-customization.adoc#bouncy-castle-fips[BouncyCastle FIPS] sections.
====

We're done!
So, let's see if it works.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public class OpenshiftBuild implements BooleanSupplier {

private ContainerImageConfig containerImageConfig;
private final ContainerImageConfig containerImageConfig;

OpenshiftBuild(ContainerImageConfig containerImageConfig) {
this.containerImageConfig = containerImageConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public class S2iBuild implements BooleanSupplier {

private ContainerImageConfig containerImageConfig;
private final ContainerImageConfig containerImageConfig;

S2iBuild(ContainerImageConfig containerImageConfig) {
this.containerImageConfig = containerImageConfig;
Expand Down
Loading

0 comments on commit 64a9e87

Please sign in to comment.