From 422a7543d381b0bdf899d70ada981bcdfec3612b Mon Sep 17 00:00:00 2001 From: Oleksandr Krutko <46520164+arsenalzp@users.noreply.github.com> Date: Fri, 30 Aug 2024 09:25:16 +0200 Subject: [PATCH] fix(openshift): retrieve builder pod logs from builds() DSL entrypoint remove unused comments, add improve OpenshiftBuildServiceIntegrationTest tests Signed-off-by: Oleksandr Krutko revert to initial version of file quickstarts/maven/spring-boot/pom.xml Signed-off-by: Oleksandr Krutko --- CHANGELOG.md | 1 + .../kit/config/service/openshift/OpenshiftBuildService.java | 2 +- .../service/openshift/OpenshiftBuildServiceIntegrationTest.java | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd85d6e5aa..3bfa85efa0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ Usage: ``` ### 1.18-SNAPSHOT * Fix #1125: Support WebFlux SpringBoot projects when it comes to generate probes for actuators +* Fix #2844: `oc:build` on openshift use `pods/log` to retrieve logs from build ### 1.17.0 (2024-08-13) * Fix #494: Support for Micronaut Framework Native Images diff --git a/jkube-kit/config/service/src/main/java/org/eclipse/jkube/kit/config/service/openshift/OpenshiftBuildService.java b/jkube-kit/config/service/src/main/java/org/eclipse/jkube/kit/config/service/openshift/OpenshiftBuildService.java index ddc5b9e8a6..ef240889a3 100644 --- a/jkube-kit/config/service/src/main/java/org/eclipse/jkube/kit/config/service/openshift/OpenshiftBuildService.java +++ b/jkube-kit/config/service/src/main/java/org/eclipse/jkube/kit/config/service/openshift/OpenshiftBuildService.java @@ -466,7 +466,7 @@ private void waitForOpenShiftBuildToComplete(OpenShiftClient client, Build build // Don't query for logs directly, Watch over the build pod: waitUntilPodIsReady(buildName + "-build", 120, log); log.info("Waiting for build " + buildName + " to complete..."); - try (LogWatch logWatch = client.pods().inNamespace(applicableOpenShiftNamespace).withName(buildName + "-build").watchLog()) { + try (LogWatch logWatch = client.builds().inNamespace(applicableOpenShiftNamespace).withName(buildName).watchLog()) { KubernetesHelper.printLogsAsync(logWatch, line -> log.info("[[s]]%s", line)) .whenComplete((v, t) -> { if (t != null) { diff --git a/jkube-kit/config/service/src/test/java/org/eclipse/jkube/kit/config/service/openshift/OpenshiftBuildServiceIntegrationTest.java b/jkube-kit/config/service/src/test/java/org/eclipse/jkube/kit/config/service/openshift/OpenshiftBuildServiceIntegrationTest.java index a7ab792aba..eb5023b9bc 100644 --- a/jkube-kit/config/service/src/test/java/org/eclipse/jkube/kit/config/service/openshift/OpenshiftBuildServiceIntegrationTest.java +++ b/jkube-kit/config/service/src/test/java/org/eclipse/jkube/kit/config/service/openshift/OpenshiftBuildServiceIntegrationTest.java @@ -592,6 +592,7 @@ private WebServerEventCollector prepareMockServer( if (!imageStreamExists) { mockServer.expect().get().withPath("/apis/image.openshift.io/v1/namespaces/ns1/imagestreams/" + resourceName).andReturn(404, "").once(); } + mockServer.expect().get().withPath("/api/v1/namespaces/ns1/pods?labelSelector=openshift.io%2Fbuild.name").andReply(collector.record("build-config-check").andReturn(200, bc)).always(); mockServer.expect().get().withPath("/apis/image.openshift.io/v1/namespaces/ns1/imagestreams/" + resourceName).andReturn(200, imageStream).always(); mockServer.expect().post().withPath("/apis/image.openshift.io/v1/namespaces/ns1/imagestreams").andReturn(201, imageStream).once();