Skip to content

Commit

Permalink
Merge pull request #73 from jfdenise/main
Browse files Browse the repository at this point in the history
Fix for Issue #72, Provisioning to OpenShift fails when using Microprofile GraphQL layer
  • Loading branch information
jfdenise authored May 14, 2024
2 parents d694281 + 607f208 commit 42f8cc2
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,14 @@ static final String generateValidName(String name) {
}
}
}
String ret = validName.toString();
if (ret.length() > 63) {
ret = ret.substring(0, 63);
return truncateValue(validName.toString());
}

private static String truncateValue(String val) {
if (val.length() > 63) {
val = val.substring(0, 63);
}
return ret;
return val;
}

public static void deploy(List<Path> deployments,
Expand Down Expand Up @@ -511,7 +514,7 @@ private static String bytesToHex(byte[] hash) {

private static Map<String, String> createCommonLabels(OpenShiftConfiguration osConfig) throws Exception {
Map<String, String> labels = new HashMap<>();
labels.put(osConfig.getLabelRadical(), "");
labels.put(truncateValue(osConfig.getLabelRadical()), "");
return labels;
}

Expand All @@ -526,10 +529,10 @@ private static Map<String, String> createServerImageLabels(Path target, Path pro
GalleonProvisioningConfig config = provider.newProvisioningBuilder(provisioning).setInstallationHome(dir).build().loadProvisioningConfig(provisioning);
GalleonConfigurationWithLayers cl = config.getDefinedConfig(new ConfigId("standalone", "standalone.xml"));
for (String s : cl.getIncludedLayers()) {
labels.put(osConfig.getLabelRadical() + ".layer." + s, "");
labels.put(truncateValue(osConfig.getLabelRadical() + ".layer." + s), "");
}
for (String s : cl.getExcludedLayers()) {
labels.put(osConfig.getLabelRadical() + ".excluded.layer." + s, "");
labels.put(truncateValue(osConfig.getLabelRadical() + ".excluded.layer." + s), "");
}
for (GalleonFeaturePackConfig gfpc : config.getFeaturePackDeps()) {
if (fps.length() != 0) {
Expand All @@ -542,12 +545,12 @@ private static Map<String, String> createServerImageLabels(Path target, Path pro
producerName = producerName.substring(i + 1);
}
producerName = producerName.replaceAll(":", "-");
labels.put(osConfig.getLabelRadical() + ".feature-pack." + producerName, gfpc.getLocation().getBuild());
labels.put(truncateValue(osConfig.getLabelRadical() + producerName), gfpc.getLocation().getBuild());
}
}

for (Entry<String, String> entry : serverImageBuildLabels.entrySet()) {
labels.put(entry.getKey(), entry.getValue());
labels.put(truncateValue(entry.getKey()), truncateValue(entry.getValue()));
}
labels.putAll(createCommonLabels(osConfig));
return labels;
Expand Down

0 comments on commit 42f8cc2

Please sign in to comment.