From bc9f7743947f81e7c8a85840db92809edc9693c4 Mon Sep 17 00:00:00 2001 From: ruhan Date: Tue, 17 Dec 2024 10:11:07 +0800 Subject: [PATCH 1/2] Save and copy build.log --- .../container/build/preprocessor/AbstractPreprocessor.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/java-components/build-request-processor/src/main/java/com/redhat/hacbs/container/build/preprocessor/AbstractPreprocessor.java b/java-components/build-request-processor/src/main/java/com/redhat/hacbs/container/build/preprocessor/AbstractPreprocessor.java index 9a3076f9a..ad5b50404 100644 --- a/java-components/build-request-processor/src/main/java/com/redhat/hacbs/container/build/preprocessor/AbstractPreprocessor.java +++ b/java-components/build-request-processor/src/main/java/com/redhat/hacbs/container/build/preprocessor/AbstractPreprocessor.java @@ -189,7 +189,7 @@ private String getContainerFile() { ENV PROXY_URL=$PROXY_URL COPY .jbs/run-build.sh /var/workdir COPY . /var/workdir/workspace/source/ - RUN /var/workdir/run-build.sh + RUN /var/workdir/run-build.sh | tee /var/workdir/build.log """.formatted(recipeImage); if (type == ToolType.ANT) { @@ -203,12 +203,14 @@ private String getContainerFile() { RUN /opt/jboss/container/java/run/run-java.sh copy-artifacts --source-path=/var/workdir/workspace/source --deploy-path=/var/workdir/workspace/artifacts FROM scratch COPY --from=1 /var/workdir/workspace/artifacts /deployment/ + COPY --from=0 /var/workdir/build.log /log/ """.formatted(buildRequestProcessorImage); } else { containerFile += """ FROM scratch COPY --from=0 /var/workdir/workspace/artifacts /deployment/ + COPY --from=0 /var/workdir/build.log /log/ """; } From 95c1f1c6984ffe7c1e6229eacf30499da3386173 Mon Sep 17 00:00:00 2001 From: ruhan Date: Tue, 17 Dec 2024 17:15:10 +0800 Subject: [PATCH 2/2] Capture stderr in build.log --- .../container/build/preprocessor/AbstractPreprocessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-components/build-request-processor/src/main/java/com/redhat/hacbs/container/build/preprocessor/AbstractPreprocessor.java b/java-components/build-request-processor/src/main/java/com/redhat/hacbs/container/build/preprocessor/AbstractPreprocessor.java index ad5b50404..050d1a30c 100644 --- a/java-components/build-request-processor/src/main/java/com/redhat/hacbs/container/build/preprocessor/AbstractPreprocessor.java +++ b/java-components/build-request-processor/src/main/java/com/redhat/hacbs/container/build/preprocessor/AbstractPreprocessor.java @@ -189,7 +189,7 @@ private String getContainerFile() { ENV PROXY_URL=$PROXY_URL COPY .jbs/run-build.sh /var/workdir COPY . /var/workdir/workspace/source/ - RUN /var/workdir/run-build.sh | tee /var/workdir/build.log + RUN /var/workdir/run-build.sh 2>&1 | tee /var/workdir/build.log """.formatted(recipeImage); if (type == ToolType.ANT) {