Skip to content

Commit

Permalink
Merge pull request #22060 from gsmet/2.5.2-backports-1
Browse files Browse the repository at this point in the history
2.5.2 backports 1
  • Loading branch information
gsmet authored Dec 9, 2021
2 parents bbcb89b + 881dc4b commit 2a48003
Show file tree
Hide file tree
Showing 59 changed files with 472 additions and 121 deletions.
2 changes: 1 addition & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<microprofile-jwt.version>1.2</microprofile-jwt.version>
<microprofile-lra.version>1.0</microprofile-lra.version>
<smallrye-common.version>1.8.0</smallrye-common.version>
<smallrye-config.version>2.6.1</smallrye-config.version>
<smallrye-config.version>2.7.0</smallrye-config.version>
<smallrye-health.version>3.1.2</smallrye-health.version>
<smallrye-metrics.version>3.0.4</smallrye-metrics.version>
<smallrye-open-api.version>2.1.16</smallrye-open-api.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static boolean trigger(ClassLoader deploymentClassLoader,

final PropertiesConfigSource pcs = new PropertiesConfigSource(properties, "Build system");

final SmallRyeConfig config = ConfigUtils.configBuilder(false, launchMode)
final SmallRyeConfig config = ConfigUtils.configBuilder(false, false, launchMode)
.withProfile(launchMode.getDefaultProfile())
.withSources(pcs)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ private static NativeConfig.ContainerRuntime detectContainerRuntime() {
} else if (podmanAvailable) {
return NativeConfig.ContainerRuntime.PODMAN;
} else {
throw new IllegalStateException("No container runtime was found to run the native image builder");
throw new IllegalStateException("No container runtime was found to run the native image builder. "
+ "Make sure you have Docker or Podman installed in your environment.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public NativeImageBuildItem build(NativeConfig nativeConfig, NativeImageSourceJa
resultingExecutableName, outputDir,
nativeConfig.debug.enabled, processInheritIODisabled.isPresent());
if (buildNativeResult.getExitCode() != 0) {
throw imageGenerationFailed(buildNativeResult.getExitCode(), nativeImageArgs);
throw imageGenerationFailed(buildNativeResult.getExitCode(), nativeConfig.isContainerBuild());
}
IoUtils.copy(generatedExecutablePath, finalExecutablePath);
Files.delete(generatedExecutablePath);
Expand Down Expand Up @@ -357,9 +357,9 @@ private static void copySourcesToSourceCache(OutputTargetBuildItem outputTargetB
}
}

private RuntimeException imageGenerationFailed(int exitValue, List<String> command) {
private RuntimeException imageGenerationFailed(int exitValue, boolean isContainerBuild) {
if (exitValue == OOM_ERROR_VALUE) {
if (command.contains("docker") && !SystemUtils.IS_OS_LINUX) {
if (isContainerBuild && !SystemUtils.IS_OS_LINUX) {
return new RuntimeException("Image generation failed. Exit code was " + exitValue
+ " which indicates an out of memory error. The most likely cause is Docker not being given enough memory. Also consider increasing the Xmx value for native image generation by setting the \""
+ QUARKUS_XMX_PROPERTY + "\" property");
Expand Down Expand Up @@ -603,6 +603,9 @@ public NativeImageInvokerInfo build() {
*/
nativeImageArgs.add("-J--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED");

//address https://github.com/quarkusio/quarkus-quickstarts/issues/993
nativeImageArgs.add("-J--add-opens=java.base/java.text=ALL-UNNAMED");

handleAdditionalProperties(nativeImageArgs);

nativeImageArgs.add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public void execute(Task test) {
});
tasks.named(JavaPlugin.COMPILE_TEST_JAVA_TASK_NAME, JavaCompile.class,
compileTestJava -> {
compileTestJava.dependsOn(quarkusGenerateCode);
compileTestJava.dependsOn(quarkusGenerateCodeTests);
if (project.getGradle().getStartParameter().getTaskNames().contains(QUARKUS_DEV_TASK_NAME)) {
compileTestJava.getOptions().setFailOnError(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,13 @@ public static ExtensionDependency getExtensionInfoOrNull(Project project, Resolv
((ProjectComponentIdentifier) artifact.getId().getComponentIdentifier()).getProjectPath());
final JavaPluginConvention javaExtension = projectDep == null ? null
: projectDep.getConvention().findPlugin(JavaPluginConvention.class);
SourceSet mainSourceSet = javaExtension.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME);
File resourcesDir = mainSourceSet.getOutput().getResourcesDir();
Path descriptorPath = resourcesDir.toPath().resolve(BootstrapConstants.DESCRIPTOR_PATH);
if (Files.exists(descriptorPath)) {
return loadExtensionInfo(project, descriptorPath, artifactId, projectDep);
if (javaExtension != null) {
SourceSet mainSourceSet = javaExtension.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME);
File resourcesDir = mainSourceSet.getOutput().getResourcesDir();
Path descriptorPath = resourcesDir.toPath().resolve(BootstrapConstants.DESCRIPTOR_PATH);
if (Files.exists(descriptorPath)) {
return loadExtensionInfo(project, descriptorPath, artifactId, projectDep);
}
}
}

Expand Down
12 changes: 8 additions & 4 deletions docs/src/main/asciidoc/deploying-to-openshift.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,14 @@ To trigger a build and deployment in a single step:
./mvnw clean package -Dquarkus.kubernetes.deploy=true
----

TIP: If you want to test your application immediately then set the `quarkus.openshift.route.expose` config property to `true` to <<exposing_routes,expose the service automatically>>, e.g. add `-Dquarkus.openshift.route.expose=true` to the command above.

This command will build your application locally, then trigger a container image build and finally apply the generated OpenShift resources automatically.
The generated resources use OpenShift's `DeploymentConfig` that is configured to automatically trigger a redeployment when a change in the `ImageStream` is noticed.
In other words, any container image build after the initial deployment will automatically trigger redeployment, without the need to delete, update or re-apply the generated resources.

To confirm the above command has created an image stream, a service resource and has deployed the application (has a pod running), apply these commands:

You can use the OpenShift web console to verify that the above command has created an image stream, a service resource and has deployed the application.
Alternatively, you can run the following OpenShift CLI commands:
[source,bash,subs=attributes+]
----
oc get is <1>
Expand All @@ -109,9 +111,10 @@ oc get svc <3>
<2> Get the list of pods.
<3> Get the list of Kubernetes services.

By default, the service is not exposed to the outside world.
To expose the created service to a route and test it:
Note that the service is not exposed to the outside world by default.
So unless you've used the `quarkus.openshift.route.expose` config property to expose the created service automatically you'll need to expose the service manually.

.Expose The Service - OpenShift CLI Example
[source,bash,subs=attributes+]
----
oc expose svc/greeting <1>
Expand Down Expand Up @@ -195,6 +198,7 @@ All available customization options are available in the link:deploying-to-kuber

Some examples are provided in the sections below:

[[exposing_routes]]
=== Exposing Routes

To expose a `Route` for the Quarkus application:
Expand Down
8 changes: 7 additions & 1 deletion docs/src/main/asciidoc/flyway.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ In your `pom.xml`, add the following dependencies:

* the Flyway extension
* your JDBC driver extension (`quarkus-jdbc-postgresql`, `quarkus-jdbc-h2`, `quarkus-jdbc-mariadb`, ...)

* the SQL Server support is now in a separate dependency, SQL Server users need to add the `flyway-sqlserver` dependency from now on.
[source,xml]
----
<dependencies>
Expand All @@ -34,6 +34,12 @@ In your `pom.xml`, add the following dependencies:
<groupId>io.quarkus</groupId>
<artifactId>quarkus-flyway</artifactId>
</dependency>
<!-- Flyway SQL Server specific dependencies -->
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-sqlserver</artifactId>
</dependency>
<!-- JDBC driver dependencies -->
<dependency>
Expand Down
6 changes: 3 additions & 3 deletions docs/src/main/asciidoc/ide-tooling.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ https://download.jboss.org/jbosstools/intellij/snapshots/intellij-quarkus/[Devel
| https://che.openshift.io/f?url=https://raw.githubusercontent.com/redhat-developer/devfile/master/getting-started/quarkus/devfile.yaml[Start Che Workspace]

|Source
|https://github.com/redhat-developer/vscode-quarkus[Github]
|https://github.com/jbosstools/jbosstools-quarkus[Github]
|https://github.com/redhat-developer/intellij-quarkus[Github]
|https://github.com/redhat-developer/vscode-quarkus[GitHub]
|https://github.com/jbosstools/jbosstools-quarkus[GitHub]
|https://github.com/redhat-developer/intellij-quarkus[GitHub]
|Closed-Source
|

Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/reactive-routes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This approach became very popular in the JavaScript world, with frameworks like
Quarkus also offers the possibility to use reactive routes.
You can implement REST API with routes only or combine them with JAX-RS resources and servlets.

The code presented in this guide is available in this {quickstarts-base-url}[Github repository] under the {quickstarts-tree-url}/reactive-routes-quickstart[`reactive-routes-quickstart` directory]
The code presented in this guide is available in this {quickstarts-base-url}[GitHub repository] under the {quickstarts-tree-url}/reactive-routes-quickstart[`reactive-routes-quickstart` directory]

NOTE: Reactive Routes were initially introduced to provide a reactive execution model for HTTP APIs on top of the xref:quarkus-reactive-architecture.adoc[Quarkus Reactive Architecture].
With the introduction of link:resteasy-reactive[RESTEasy Reactive], you can now implement reactive HTTP APIs and still use JAX-RS annotations.
Expand Down
1 change: 1 addition & 0 deletions docs/src/main/asciidoc/redis-dev-services.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ What that means practically, is that if you have docker running and have not con
Quarkus will automatically start a Redis container when running tests or dev-mode, and automatically configure the connection.

Available properties to customize the Redis DevService.

include::{generated-dir}/config/quarkus-redis-client-config-group-dev-services-config.adoc[opts=optional, leveloffset=+1]

When running the production version of the application, the Redis connection need to be configured as normal,
Expand Down
6 changes: 3 additions & 3 deletions docs/src/main/asciidoc/rest-json.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ and in particular adds the following dependency:
To improve user experience, Quarkus registers the three Jackson https://github.com/FasterXML/jackson-modules-java8[Java 8 modules] so you don't need to do it manually.
====

Quarkus also supports http://json-b.net/[JSON-B] so, if you prefer JSON-B over Jackson, you can create a project relying on the RESTEasy JSON-B extension instead:
Quarkus also supports https://eclipse-ee4j.github.io/jsonb-api/[JSON-B] so, if you prefer JSON-B over Jackson, you can create a project relying on the RESTEasy JSON-B extension instead:

[source,bash,subs=attributes+]
----
Expand All @@ -81,7 +81,7 @@ mvn io.quarkus.platform:quarkus-maven-plugin:{quarkus-version}:create \
cd rest-json-quickstart
----

This command generates a Maven structure importing the RESTEasy/JAX-RS and http://json-b.net/[JSON-B] extensions,
This command generates a Maven structure importing the RESTEasy/JAX-RS and https://eclipse-ee4j.github.io/jsonb-api/[JSON-B] extensions,
and in particular adds the following dependency:

[source,xml]
Expand Down Expand Up @@ -165,7 +165,7 @@ public class FruitResource {

The implementation is pretty straightforward and you just need to define your endpoints using the JAX-RS annotations.

The `Fruit` objects will be automatically serialized/deserialized by http://json-b.net/[JSON-B] or https://github.com/FasterXML/jackson[Jackson],
The `Fruit` objects will be automatically serialized/deserialized by https://eclipse-ee4j.github.io/jsonb-api/[JSON-B] or https://github.com/FasterXML/jackson[Jackson],
depending on the extension you chose when initializing the project.

[NOTE]
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/resteasy-reactive.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ Instead of importing `io.quarkus:quarkus-resteasy-reactive`, you can import eith
|https://github.com/FasterXML/jackson[Jackson support]

|`io.quarkus:quarkus-resteasy-reactive-jsonb`
|http://json-b.net/[JSONB support]
|https://eclipse-ee4j.github.io/jsonb-api/[JSONB support]

|===

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ Additionally a custom `SecurityIdentityAugmentor` can also be used to add the ro
[[token-verification-introspection]]
=== Token Verification And Introspection

Please see link:security-openid-connect#token-verification-introspection for details about how the tokens are verified and introspected.
Please see link:security-openid-connect#token-verification-introspection[Token Verification And Introspection] for details about how the tokens are verified and introspected.

Note that in case of `web-app` applications only `IdToken` is verified by default since the access token is not used by default to access the current Quarkus `web-app` endpoint and instead meant to be propagated to the services expecting this access token, for example, to the OpenId Connect Provider's UserInfo endpoint, etc. However if you expect the access token to contain the roles required to access the current Quarkus endpoint (`quarkus.oidc.roles.source=accesstoken`) then it will also be verified.

Expand All @@ -359,7 +359,7 @@ Note that in case of `web-app` applications only `IdToken` is verified by defaul

Code flow access tokens are not introspected unless they are expected to be the source of roles but will be used to get `UserInfo`. So there will be one or two remote calls with the code flow access token, if the token introspection and/or `UserInfo` are required.

Please see link:security-openid-connect#token-introspection-userinfo-cache for more information about using a default token cache or registering a custom cache implementation.
Please see link:security-openid-connect#token-introspection-userinfo-cache[Token Introspection and UserInfo cache] for more information about using a default token cache or registering a custom cache implementation.

[[jwt-claim-verification]]
=== JSON Web Token Claim Verification
Expand Down
20 changes: 20 additions & 0 deletions docs/src/main/asciidoc/writing-extensions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3116,3 +3116,23 @@ In order to make it easy for extension authors to test their extensions daily ag
the notion of Ecosystem CI. The Ecosystem CI link:https://github.com/quarkusio/quarkus-ecosystem-ci/blob/main/README.adoc[README]
has all the details on how to set up a GitHub Actions job to take advantage of this capability, while this link:https://www.youtube.com/watch?v=VpbRA1n0hHQ[video] provides an overview
of what the process looks like.

== Publish your extension in registry.quarkus.io

Before publishing your extension to the link:https://quarkus.io/guides/tooling[Quarkus tooling], make sure that the following requirements are met:

* The `quarkus-extension.yaml` file (in the extension's `runtime/` module) has the minimum metadata set:
** `name`
** `description` (unless you have it already set in the `runtime/pom.xml`'s `<description>` element, which is the recommended approach)

* Your extension is published in Maven Central

Then you must create a pull request adding a `your-extension.yaml` file in the `extensions/` directory in the link:https://github.com/quarkusio/quarkus-extension-catalog[Quarkus Extension Catalog]. The YAML must have the following structure:

```yaml
group-id: <YOUR_EXTENSION_RUNTIME_GROUP_ID>
artifact-id: <YOUR_EXTENSION_RUNTIME_ARTIFACT_ID>
```

That's all. Once the pull request is merged, a scheduled job will check Maven Central for new versions and update the link:extension-registry-user.adoc[Quarkus Extension Registry].

Original file line number Diff line number Diff line change
Expand Up @@ -51,29 +51,39 @@ public Predicate<String> getCheckConfiguredFunction() {
public static DevServicesDatasourceConfigurationHandlerBuildItem jdbc(String dbKind) {
return new DevServicesDatasourceConfigurationHandlerBuildItem(dbKind,
new BiFunction<String, DevServicesDatasourceProvider.RunningDevServicesDatasource, Map<String, String>>() {

@Override
public Map<String, String> apply(String dsName,
DevServicesDatasourceProvider.RunningDevServicesDatasource runningDevDb) {
if (dsName == null) {
return Collections.singletonMap("quarkus.datasource.jdbc.url", runningDevDb.getUrl());
} else {
return Collections.singletonMap("quarkus.datasource.\"" + dsName + "\".jdbc.url",
runningDevDb.getUrl());
// we use quoted and unquoted versions because depending on whether a user configured other JDBC properties
// one of the URLs may be ignored
// see https://github.com/quarkusio/quarkus/issues/21387
return Map.of(
datasourceURLPropName(dsName), runningDevDb.getUrl(),
datasourceURLPropName("\"" + dsName + "\""), runningDevDb.getUrl());
}
}

}, new Predicate<String>() {
@Override
public boolean test(String dsName) {
if (dsName == null) {
return ConfigUtils.isPropertyPresent("quarkus.datasource.jdbc.url");
} else {
return ConfigUtils.isPropertyPresent("quarkus.datasource.\"" + dsName + "\".jdbc.url") ||
ConfigUtils.isPropertyPresent("quarkus.datasource." + dsName + ".jdbc.url");
return ConfigUtils.isPropertyPresent(datasourceURLPropName(dsName)) ||
ConfigUtils.isPropertyPresent(datasourceURLPropName("\"" + dsName + "\""));
}
}
});
}

private static String datasourceURLPropName(String dsName) {
return String.format("quarkus.datasource.%s.jdbc.url", dsName);
}

public static DevServicesDatasourceConfigurationHandlerBuildItem reactive(String dbKind) {
return new DevServicesDatasourceConfigurationHandlerBuildItem(dbKind,
new BiFunction<String, DevServicesDatasourceProvider.RunningDevServicesDatasource, Map<String, String>>() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
quarkus.datasource.db-kind=h2
quarkus.datasource.jdbc.url=jdbc:h2:mem:default
quarkus.datasource.jdbc.max-size=1

quarkus.datasource.users.db-kind=h2
quarkus.datasource.users.jdbc.url=jdbc:h2:mem:users
quarkus.datasource.users.jdbc.min-size=2

quarkus.datasource.inventory.db-kind=h2
quarkus.datasource.inventory.jdbc.url=jdbc:h2:mem:inventory

quarkus.hibernate-orm.dialect=org.hibernate.dialect.H2Dialect
quarkus.hibernate-orm.database.generation=drop-and-create
Expand Down
Loading

0 comments on commit 2a48003

Please sign in to comment.