Skip to content

Commit

Permalink
Properly handle non-http service in s2i
Browse files Browse the repository at this point in the history
Fixes: #8481
  • Loading branch information
geoand committed Apr 9, 2020
1 parent ffc1c5b commit 50cc839
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,22 @@ public void s2iBuildFromJar(S2iConfig s2iConfig, ContainerImageConfig containerI
return;
}

Optional<GeneratedFileSystemResourceBuildItem> openshiftYml = generatedResources
.stream()
.filter(r -> r.getName().endsWith("kubernetes/openshift.yml"))
.findFirst();

if (!openshiftYml.isPresent()) {
LOG.warn("No Openshift manifests were generated (most likely due to the fact that the service is not an HTTP service) so no s2i process will be taking place");
return;
}

String namespace = Optional.ofNullable(kubernetesClient.getClient().getNamespace()).orElse("default");
LOG.info("Performing s2i binary build with jar on server: " + kubernetesClient.getClient().getMasterUrl()
+ " in namespace:" + namespace + ".");
String image = containerImage.getImage();

GeneratedFileSystemResourceBuildItem openshiftYml = generatedResources
.stream()
.filter(r -> r.getName().endsWith("kubernetes/openshift.yml"))
.findFirst().orElseThrow(() -> new IllegalStateException("Could not find kubernetes/openshift.yml"));

createContainerImage(kubernetesClient, openshiftYml, s2iConfig, out.getOutputDirectory(), jar.getPath(),
createContainerImage(kubernetesClient, openshiftYml.get(), s2iConfig, out.getOutputDirectory(), jar.getPath(),
out.getOutputDirectory().resolve("lib"));
artifactResultProducer.produce(new ArtifactResultBuildItem(null, "jar-container", Collections.emptyMap()));
containerImageResultProducer.produce(
Expand Down

0 comments on commit 50cc839

Please sign in to comment.