Skip to content

Commit

Permalink
Merge pull request #33232 from gsmet/3.0.3-backports-1
Browse files Browse the repository at this point in the history
3.0.3 backports 1
  • Loading branch information
gsmet authored May 10, 2023
2 parents c3d4907 + 9556f0d commit 9a8da80
Show file tree
Hide file tree
Showing 65 changed files with 687 additions and 233 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ nb-configuration.xml
/lsp/
.envrc
.jekyll-cache
.mvn/.gradle-enterprise/
2 changes: 1 addition & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
<rest-assured.version>5.3.0</rest-assured.version>
<junit.jupiter.version>5.9.2</junit.jupiter.version>
<junit-pioneer.version>1.5.0</junit-pioneer.version>
<infinispan.version>14.0.8.Final</infinispan.version>
<infinispan.version>14.0.9.Final</infinispan.version>
<infinispan.protostream.version>4.6.2.Final</infinispan.protostream.version>
<caffeine.version>3.1.5</caffeine.version>
<netty.version>4.1.90.Final</netty.version>
Expand Down
2 changes: 1 addition & 1 deletion build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<!-- These 2 properties are used by CreateProjectMojo to add the Maven Wrapper -->
<proposed-maven-version>3.8.8</proposed-maven-version>
<maven-wrapper.version>3.2.0</maven-wrapper.version>
<gradle-wrapper.version>8.1</gradle-wrapper.version>
<gradle-wrapper.version>8.1.1</gradle-wrapper.version>
<quarkus-gradle-plugin.version>${project.version}</quarkus-gradle-plugin.version>
<quarkus-maven-plugin.version>${project.version}</quarkus-maven-plugin.version>
<maven-plugin-plugin.version>3.8.1</maven-plugin-plugin.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ public boolean isContainer() {

@Override
public void setup(boolean processInheritIODisabled) {
if (containerRuntime == ContainerRuntimeUtil.ContainerRuntime.DOCKER
|| containerRuntime == ContainerRuntimeUtil.ContainerRuntime.PODMAN) {
if (containerRuntime != ContainerRuntimeUtil.ContainerRuntime.UNAVAILABLE) {
log.infof("Using %s to run the native image builder", containerRuntime.getExecutableName());
// we pull the docker image in order to give users an indication of which step the process is at
// it's not strictly necessary we do this, however if we don't the subsequent version command
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package io.quarkus.deployment.pkg.steps;

import static io.quarkus.deployment.pkg.steps.LinuxIDUtil.getLinuxID;
import static io.quarkus.runtime.util.ContainerRuntimeUtil.ContainerRuntime.DOCKER;
import static io.quarkus.runtime.util.ContainerRuntimeUtil.ContainerRuntime.PODMAN;

import java.nio.file.Path;
import java.util.ArrayList;
Expand All @@ -21,14 +19,14 @@ public NativeImageBuildLocalContainerRunner(NativeConfig nativeConfig) {
super(nativeConfig);
if (SystemUtils.IS_OS_LINUX) {
final ArrayList<String> containerRuntimeArgs = new ArrayList<>(Arrays.asList(baseContainerRuntimeArgs));
if (containerRuntime == DOCKER && containerRuntime.isRootless()) {
if (containerRuntime.isDocker() && containerRuntime.isRootless()) {
Collections.addAll(containerRuntimeArgs, "--user", String.valueOf(0));
} else {
String uid = getLinuxID("-ur");
String gid = getLinuxID("-gr");
if (uid != null && gid != null && !uid.isEmpty() && !gid.isEmpty()) {
Collections.addAll(containerRuntimeArgs, "--user", uid + ":" + gid);
if (containerRuntime == PODMAN && containerRuntime.isRootless()) {
if (containerRuntime.isPodman() && containerRuntime.isRootless()) {
// Needed to avoid AccessDeniedExceptions
containerRuntimeArgs.add("--userns=keep-id");
}
Expand All @@ -47,7 +45,7 @@ protected List<String> getContainerRuntimeBuildArgs(Path outputDir) {
}

final String selinuxBindOption;
if (SystemUtils.IS_OS_MAC && containerRuntime == PODMAN) {
if (SystemUtils.IS_OS_MAC && containerRuntime.isPodman()) {
selinuxBindOption = "";
} else {
selinuxBindOption = ":z";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ private boolean runUpxInContainer(NativeImageBuildItem nativeImage, NativeConfig
String gid = getLinuxID("-gr");
if (uid != null && gid != null && !uid.isEmpty() && !gid.isEmpty()) {
Collections.addAll(commandLine, "--user", uid + ":" + gid);
if (containerRuntime == ContainerRuntimeUtil.ContainerRuntime.PODMAN
&& containerRuntime.isRootless()) {
if (containerRuntime.isPodman() && containerRuntime.isRootless()) {
// Needed to avoid AccessDeniedExceptions
commandLine.add("--userns=keep-id");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ private List<ConfigDocItem> recursivelyFindConfigItems(Element element, String r
}

for (Element enclosedElement : element.getEnclosedElements()) {
shouldProcessElement(enclosedElement);

if (!shouldProcessElement(enclosedElement)) {
continue;
}
Expand Down Expand Up @@ -332,6 +330,10 @@ private List<ConfigDocItem> recursivelyFindConfigItems(Element element, String r
acceptedValues = extractEnumValues(realTypeMirror, useHyphenateEnumValue,
clazz.getQualifiedName().toString());
configDocKey.setEnum(true);
} else {
if (!defaultValueDoc.isBlank()) {
defaultValue = defaultValueDoc;
}
}
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,77 +31,96 @@ private ContainerRuntimeUtil() {
}

/**
* @return {@link ContainerRuntime#DOCKER} if it's available, or {@link ContainerRuntime#PODMAN}
* if the podman
* executable exists in the environment or if the docker executable is an alias to podman,
* or {@link ContainerRuntime#UNAVAILABLE} if no container runtime is available and the required arg is false.
* @return a fully resolved {@link ContainerRuntime} indicating if Docker or Podman is available and in rootless mode or not
* @throws IllegalStateException if no container runtime was found to build the image
*/
public static ContainerRuntime detectContainerRuntime() {
return detectContainerRuntime(true);
}

public static ContainerRuntime detectContainerRuntime(boolean required) {
final ContainerRuntime containerRuntime = loadContainerRuntimeFromSystemProperty();
ContainerRuntime containerRuntime = loadContainerRuntimeFromSystemProperty();
if (containerRuntime != null) {
return containerRuntime;
} else {
// Docker version 19.03.14, build 5eb3275d40
String dockerVersionOutput;
boolean dockerAvailable;
// Check if Podman is installed
// podman version 2.1.1
String podmanVersionOutput;
boolean podmanAvailable;
if (CONTAINER_EXECUTABLE != null) {
if (CONTAINER_EXECUTABLE.trim().equalsIgnoreCase("docker")) {
dockerVersionOutput = getVersionOutputFor(ContainerRuntime.DOCKER);
dockerAvailable = dockerVersionOutput.contains("Docker version");
if (dockerAvailable) {
storeContainerRuntimeInSystemProperty(ContainerRuntime.DOCKER);
return ContainerRuntime.DOCKER;
}
}
if (CONTAINER_EXECUTABLE.trim().equalsIgnoreCase("podman")) {
podmanVersionOutput = getVersionOutputFor(ContainerRuntime.PODMAN);
podmanAvailable = podmanVersionOutput.startsWith("podman version");
if (podmanAvailable) {
storeContainerRuntimeInSystemProperty(ContainerRuntime.PODMAN);
return ContainerRuntime.PODMAN;
}
}

ContainerRuntime containerRuntimeEnvironment = getContainerRuntimeEnvironment();
if (containerRuntimeEnvironment == ContainerRuntime.UNAVAILABLE) {
storeContainerRuntimeInSystemProperty(ContainerRuntime.UNAVAILABLE);

if (required) {
throw new IllegalStateException("No container runtime was found. "
+ "Make sure you have either Docker or Podman installed in your environment.");
}

return ContainerRuntime.UNAVAILABLE;
}

// we have a working container environment, let's resolve it fully
containerRuntime = fullyResolveContainerRuntime(containerRuntimeEnvironment);

storeContainerRuntimeInSystemProperty(containerRuntime);

return containerRuntime;
}

private static ContainerRuntime getContainerRuntimeEnvironment() {
// Docker version 19.03.14, build 5eb3275d40
String dockerVersionOutput;
boolean dockerAvailable;
// Check if Podman is installed
// podman version 2.1.1
String podmanVersionOutput;
boolean podmanAvailable;

if (CONTAINER_EXECUTABLE != null) {
if (CONTAINER_EXECUTABLE.trim().equalsIgnoreCase("docker")) {
dockerVersionOutput = getVersionOutputFor(ContainerRuntime.DOCKER);
dockerAvailable = dockerVersionOutput.contains("Docker version");
if (dockerAvailable) {
return ContainerRuntime.DOCKER;
}
log.warn("quarkus.native.container-runtime config property must be set to either podman or docker " +
"and the executable must be available. Ignoring it.");
}
dockerVersionOutput = getVersionOutputFor(ContainerRuntime.DOCKER);
dockerAvailable = dockerVersionOutput.contains("Docker version");
if (dockerAvailable) {
// Check if "docker" is an alias to "podman"
if (dockerVersionOutput.startsWith("podman version") ||
dockerVersionOutput.startsWith("podman.exe version")) {
storeContainerRuntimeInSystemProperty(ContainerRuntime.PODMAN);
if (CONTAINER_EXECUTABLE.trim().equalsIgnoreCase("podman")) {
podmanVersionOutput = getVersionOutputFor(ContainerRuntime.PODMAN);
podmanAvailable = podmanVersionOutput.startsWith("podman version");
if (podmanAvailable) {
return ContainerRuntime.PODMAN;
}
storeContainerRuntimeInSystemProperty(ContainerRuntime.DOCKER);
return ContainerRuntime.DOCKER;
}
podmanVersionOutput = getVersionOutputFor(ContainerRuntime.PODMAN);
podmanAvailable = podmanVersionOutput.startsWith("podman version") ||
podmanVersionOutput.startsWith("podman.exe version");
if (podmanAvailable) {
storeContainerRuntimeInSystemProperty(ContainerRuntime.PODMAN);
log.warn("quarkus.native.container-runtime config property must be set to either podman or docker " +
"and the executable must be available. Ignoring it.");
}

dockerVersionOutput = getVersionOutputFor(ContainerRuntime.DOCKER);
dockerAvailable = dockerVersionOutput.contains("Docker version");
if (dockerAvailable) {
// Check if "docker" is an alias to "podman"
if (dockerVersionOutput.startsWith("podman version") ||
dockerVersionOutput.startsWith("podman.exe version")) {
return ContainerRuntime.PODMAN;
}
return ContainerRuntime.DOCKER;
}
podmanVersionOutput = getVersionOutputFor(ContainerRuntime.PODMAN);
podmanAvailable = podmanVersionOutput.startsWith("podman version") ||
podmanVersionOutput.startsWith("podman.exe version");
if (podmanAvailable) {
return ContainerRuntime.PODMAN;
}

storeContainerRuntimeInSystemProperty(ContainerRuntime.UNAVAILABLE);
return ContainerRuntime.UNAVAILABLE;
}

if (required) {
throw new IllegalStateException("No container runtime was found. "
+ "Make sure you have either Docker or Podman installed in your environment.");
}
private static ContainerRuntime fullyResolveContainerRuntime(ContainerRuntime containerRuntimeEnvironment) {
boolean rootless = getRootlessStateFor(containerRuntimeEnvironment);

return ContainerRuntime.UNAVAILABLE;
if (!rootless) {
return containerRuntimeEnvironment;
}

return containerRuntimeEnvironment == ContainerRuntime.DOCKER ? ContainerRuntime.DOCKER_ROOTLESS
: ContainerRuntime.PODMAN_ROOTLESS;
}

private static ContainerRuntime loadContainerRuntimeFromSystemProperty() {
Expand Down Expand Up @@ -195,16 +214,19 @@ private static boolean getRootlessStateFor(ContainerRuntime containerRuntime) {
* Supported Container runtimes
*/
public enum ContainerRuntime {
DOCKER("docker" + (OS.current() == OS.WINDOWS ? ".exe" : "")),
PODMAN("podman" + (OS.current() == OS.WINDOWS ? ".exe" : "")),
UNAVAILABLE(null);
DOCKER("docker", false),
DOCKER_ROOTLESS("docker", true),
PODMAN("podman", false),
PODMAN_ROOTLESS("podman", true),
UNAVAILABLE(null, false);

private Boolean rootless;
private final String executableName;

private String executableName;
private final boolean rootless;

ContainerRuntime(String executableName) {
this.executableName = executableName;
ContainerRuntime(String executableName, boolean rootless) {
this.executableName = executableName + (OS.current() == OS.WINDOWS ? ".exe" : "");
this.rootless = rootless;
}

public String getExecutableName() {
Expand All @@ -215,17 +237,15 @@ public String getExecutableName() {
return executableName;
}

public boolean isDocker() {
return this == DOCKER || this == DOCKER_ROOTLESS;
}

public boolean isPodman() {
return this == PODMAN || this == PODMAN_ROOTLESS;
}

public boolean isRootless() {
if (rootless != null) {
return rootless;
} else {
if (this != ContainerRuntime.UNAVAILABLE) {
rootless = getRootlessStateFor(this);
} else {
throw new IllegalStateException("No container runtime was found. "
+ "Make sure you have either Docker or Podman installed in your environment.");
}
}
return rootless;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public void logUpdates() {
}

final UpdateProject invoker = new UpdateProject(quarkusProject);
invoker.latestCatalog(targetCatalog);
invoker.targetCatalog(targetCatalog);
if (rewriteUpdateRecipesVersion != null) {
invoker.rewriteUpdateRecipesVersion(rewriteUpdateRecipesVersion);
}
Expand Down
4 changes: 2 additions & 2 deletions devtools/gradle/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
# https://gradle.org/release-checksums/
distributionSha256Sum=2cbafcd2c47a101cb2165f636b4677fac0b954949c9429c1c988da399defe6a9
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-all.zip
distributionSha256Sum=5625a0ae20fe000d9225d000b36909c7a0e0e8dda61c19b12da769add847c975
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ protected void processProjectState(QuarkusProject quarkusProject) throws MojoExe
"Failed to resolve the recommended Quarkus extension catalog from the configured extension registries", e);
}
final UpdateProject invoker = new UpdateProject(quarkusProject);
invoker.latestCatalog(targetCatalog);
invoker.targetCatalog(targetCatalog);
invoker.targetPlatformVersion(platformVersion);
invoker.perModule(perModule);
invoker.appModel(resolveApplicationModel());
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/getting-started-reactive.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ It interacts with the database without blocking the thread.
In addition, this reactive `PanacheEntity` proposes a reactive API.
We will use this API to implement the REST endpoint.

Before going further, open the `src/main/resource/application.properties` file and add:
Before going further, open the `src/main/resources/application.properties` file and add:

[source, properties]
----
Expand Down
6 changes: 3 additions & 3 deletions docs/src/main/asciidoc/qute-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1215,16 +1215,16 @@ An interesting use case would be a fragment that can be used multiple-times insi
<h1>My page</h1>
<p>This document
{#include [strong] val='contains' /} <2>
{#include $strong val='contains' /} <2>
a lot of
{#include [strong] val='information' /} <3>
{#include $strong val='information' /} <3>
!</p>
----
<1> Defines a hidden fragment with identifier `strong`.
In this particular case, we use the `false` boolean literal as the value of the `rendered` parameter.
However, it's possible to use any expression there.
<2> Include the fragment `strong` and pass the value.
Note the syntax `[strong]` which is translated to include the fragment `strong` from the current template.
Note the syntax `$strong` which is translated to include the fragment `strong` from the current template.
<3> Include the fragment `strong` and pass the value.

The snippet above renders something like:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ To detect less severe issues, adjust the value of `failBuildOnCVSS` to suppress
Suppress the false positive CPE for Smallrye Mutiny to mutiny:mutiny
]]>
</notes>
<gav regex="true">^io\.smallrye.reactive:mutiny.*:.*$</gav>
<gav regex="true">^io\.smallrye\.reactive:mutiny.*:.*$</gav>
<cpe>cpe:/a:mutiny:mutiny</cpe>
</suppress>
<suppress>
Expand All @@ -102,7 +102,7 @@ To detect less severe issues, adjust the value of `failBuildOnCVSS` to suppress
Suppress the false positive CPE for Smallrye Mutiny to mutiny:mutiny
]]>
</notes>
<gav regex="true">^io\.smallrye.reactive:smallrye-mutiny.*:.*$</gav>
<gav regex="true">^io\.smallrye\.reactive:smallrye-mutiny.*:.*$</gav>
<cpe>cpe:/a:mutiny:mutiny</cpe>
</suppress>
<suppress>
Expand All @@ -111,7 +111,7 @@ To detect less severe issues, adjust the value of `failBuildOnCVSS` to suppress
Suppress the false positive CPE for Smallrye Mutiny to mutiny:mutiny
]]>
</notes>
<gav regex="true">^io\.smallrye.reactive:vertx-mutiny.*:.*$</gav>
<gav regex="true">^io\.smallrye\.reactive:vertx-mutiny.*:.*$</gav>
<cpe>cpe:/a:mutiny:mutiny</cpe>
</suppress>
<suppress>
Expand All @@ -120,7 +120,7 @@ To detect less severe issues, adjust the value of `failBuildOnCVSS` to suppress
Suppress the false positive CPE for graal-sdk to GraalVM (the JVM distribution)
]]>
</notes>
<gav regex="true">^org\.graalvm\.sdk:g like this
<gav regex="true">^org\.graalvm\.sdk:graal-sdk.*:.*$</gav>
</suppress>
</suppressions>
----
Expand Down
Loading

0 comments on commit 9a8da80

Please sign in to comment.