From 7e1a599f628db0c22fa193143b128439db4b15f3 Mon Sep 17 00:00:00 2001 From: Laszlo Bodor Date: Mon, 12 Jun 2023 14:42:28 +0200 Subject: [PATCH] TEZ-4496: Tez precommit fails while building yetus image - no alternatives for some executables --- build-tools/docker/Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build-tools/docker/Dockerfile b/build-tools/docker/Dockerfile index 3c0f1c1274..5b681067ae 100644 --- a/build-tools/docker/Dockerfile +++ b/build-tools/docker/Dockerfile @@ -181,8 +181,11 @@ RUN apt-get -q update && apt-get -q install --no-install-recommends -y openjdk-8 RUN apt-get -q update && apt-get -q install --no-install-recommends -y default-jre-headless openjdk-11-jdk-headless \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* \ - && update-java-alternatives -s java-1.8.0-openjdk-amd64 \ - && rm -f /usr/lib/jvm/default-java \ + && update-java-alternatives -s java-1.8.0-openjdk-amd64 || : +# since update alternatives might fail on executables that we don't really need (e.g. appletviewer) +# and return with exit code <0 (actually: 2), we can simply do a sanity check if the version is +# as expected for "java" executable after the update and go on +RUN java -version 2>&1 | grep "1.8.0" && rm -f /usr/lib/jvm/default-java \ && ln -s java-8-openjdk-amd64 /usr/lib/jvm/default-java ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64