Skip to content

Commit d0409ef

Browse files
committed
Fix Platform overriding of codestart dockerfile data
We need the Platform to override the values in the codestart data, and for that, they need to be prefixed by the codestart name. TBH, my first inclination was to always override properties in the codestarts with what comes from the data... but it breaks a test so let's not go there for now. Also fix the native-micro entry as it was missing a `.from`. And make sure the data coming from previous platforms is properly fixed when extracted. Fixes #48102 (cherry picked from commit e03dd1e)
1 parent c3fbd76 commit d0409ef

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

devtools/bom-descriptor-json/src/main/resources/catalog-overrides.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@
146146
"project": {
147147
"default-codestart": "rest",
148148
"codestart-data": {
149-
"dockerfile.jvm.from-template": "registry.access.redhat.com/ubi9/openjdk-{java.version}:1.21",
150-
"dockerfile.jvm.from": "registry.access.redhat.com/ubi9/openjdk-${recommended-java-version}:1.21",
151-
"dockerfile.native.from": "registry.access.redhat.com/ubi9/ubi-minimal:9.5",
152-
"dockerfile.native-micro": "quay.io/quarkus/ubi9-quarkus-micro-image:2.0"
149+
"tooling-dockerfiles.dockerfile.jvm.from-template": "registry.access.redhat.com/ubi9/openjdk-{java.version}:1.21",
150+
"tooling-dockerfiles.dockerfile.jvm.from": "registry.access.redhat.com/ubi9/openjdk-${recommended-java-version}:1.21",
151+
"tooling-dockerfiles.dockerfile.native.from": "registry.access.redhat.com/ubi9/ubi-minimal:9.5",
152+
"tooling-dockerfiles.dockerfile.native-micro.from": "quay.io/quarkus/ubi9-quarkus-micro-image:2.0"
153153
},
154154
"properties": {
155155
"doc-root": "https://quarkus.io",

independent-projects/tools/devtools-common/src/main/java/io/quarkus/platform/tools/ToolsUtils.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
import java.util.HashMap;
99
import java.util.List;
1010
import java.util.Map;
11+
import java.util.Map.Entry;
1112
import java.util.Properties;
13+
import java.util.stream.Collectors;
1214

1315
import org.apache.commons.lang3.StringUtils;
1416
import org.eclipse.aether.artifact.Artifact;
@@ -235,7 +237,25 @@ public static Properties readQuarkusProperties(ExtensionCatalog catalog) {
235237
@SuppressWarnings("unchecked")
236238
public static Map<String, Object> readProjectData(ExtensionCatalog catalog) {
237239
Map<Object, Object> map = (Map<Object, Object>) catalog.getMetadata().getOrDefault("project", Map.of());
238-
return (Map<String, Object>) map.getOrDefault("codestart-data", Map.of());
240+
Map<String, Object> projectData = (Map<String, Object>) map.getOrDefault("codestart-data", Map.of());
241+
242+
// fix the dockerfile entries for Platform < 3.23.1
243+
projectData = projectData.entrySet().stream()
244+
.collect(Collectors.toMap(
245+
e -> {
246+
if (!e.getKey().startsWith("dockerfile.")) {
247+
return e.getKey();
248+
}
249+
String key = e.getKey();
250+
if ("dockerfile.native-micro".equals(key)) {
251+
key += ".from";
252+
}
253+
254+
return "tooling-dockerfiles." + key;
255+
},
256+
Entry::getValue));
257+
258+
return projectData;
239259
}
240260

241261
public static String requireProperty(Properties props, String name) {

0 commit comments

Comments
 (0)