forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow
mandrel
and graalvm
as values of `quarkus.native.builder-im…
…age` This change makes it easier for developers to choose the variant of the builder image they want to use without having to worry about which version is the currently supported one. Quarkus will figure that out on their behalf. Closes quarkusio#18129
- Loading branch information
Showing
7 changed files
with
114 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
core/deployment/src/test/java/io/quarkus/deployment/pkg/NativeConfigTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package io.quarkus.deployment.pkg; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
class NativeConfigTest { | ||
|
||
@Test | ||
public void testBuilderImageProperlyDetected() { | ||
NativeConfig nativeConfig = new NativeConfig(); | ||
nativeConfig.builderImage = "graalvm"; | ||
assertThat(nativeConfig.getEffectiveBuilderImage().contains("ubi-quarkus-native-image")).isTrue(); | ||
nativeConfig.builderImage = "GraalVM"; | ||
assertThat(nativeConfig.getEffectiveBuilderImage().contains("ubi-quarkus-native-image")).isTrue(); | ||
nativeConfig.builderImage = "GRAALVM"; | ||
assertThat(nativeConfig.getEffectiveBuilderImage().contains("ubi-quarkus-native-image")).isTrue(); | ||
nativeConfig.builderImage = "mandrel"; | ||
assertThat(nativeConfig.getEffectiveBuilderImage().contains("ubi-quarkus-mandrel")).isTrue(); | ||
nativeConfig.builderImage = "Mandrel"; | ||
assertThat(nativeConfig.getEffectiveBuilderImage().contains("ubi-quarkus-mandrel")).isTrue(); | ||
nativeConfig.builderImage = "MANDREL"; | ||
assertThat(nativeConfig.getEffectiveBuilderImage().contains("ubi-quarkus-mandrel")).isTrue(); | ||
nativeConfig.builderImage = "aRandomString"; | ||
assertThat(nativeConfig.getEffectiveBuilderImage().contains("aRandomString")).isTrue(); | ||
nativeConfig.builderImage = "aRandomStr32ng"; | ||
assertThat(nativeConfig.getEffectiveBuilderImage().contains("aRandomString")).isFalse(); | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
...nt/src/test/java/io/quarkus/deployment/pkg/steps/NativeImageBuildContainerRunnerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package io.quarkus.deployment.pkg.steps; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.nio.file.Path; | ||
import java.util.Collections; | ||
import java.util.Optional; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.deployment.pkg.NativeConfig; | ||
|
||
class NativeImageBuildContainerRunnerTest { | ||
|
||
@Test | ||
void testBuilderImageBeingPickedUp() { | ||
NativeConfig nativeConfig = new NativeConfig(); | ||
nativeConfig.containerRuntime = Optional.empty(); | ||
boolean found; | ||
NativeImageBuildLocalContainerRunner localRunner; | ||
String[] command; | ||
|
||
nativeConfig.builderImage = "graalvm"; | ||
localRunner = new NativeImageBuildLocalContainerRunner(nativeConfig, Path.of("/tmp")); | ||
command = localRunner.buildCommand("docker", Collections.emptyList(), Collections.emptyList()); | ||
found = false; | ||
for (String part : command) { | ||
if (part.contains("ubi-quarkus-native-image")) { | ||
found = true; | ||
} | ||
} | ||
assertThat(found).isTrue(); | ||
|
||
nativeConfig.builderImage = "mandrel"; | ||
localRunner = new NativeImageBuildLocalContainerRunner(nativeConfig, Path.of("/tmp")); | ||
command = localRunner.buildCommand("docker", Collections.emptyList(), Collections.emptyList()); | ||
found = false; | ||
for (String part : command) { | ||
if (part.contains("ubi-quarkus-mandrel")) { | ||
found = true; | ||
} | ||
} | ||
assertThat(found).isTrue(); | ||
|
||
nativeConfig.builderImage = "RandomString"; | ||
localRunner = new NativeImageBuildLocalContainerRunner(nativeConfig, Path.of("/tmp")); | ||
command = localRunner.buildCommand("docker", Collections.emptyList(), Collections.emptyList()); | ||
found = false; | ||
for (String part : command) { | ||
if (part.equals("RandomString")) { | ||
found = true; | ||
} | ||
} | ||
assertThat(found).isTrue(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters