Merge "Fix: safer behaviour handling java variables"
authorAndrew Grimberg <agrimberg@linuxfoundation.org>
Fri, 19 Aug 2022 17:12:06 +0000 (17:12 +0000)
committerGerrit Code Review <gerrit@linuxfoundation.org>
Fri, 19 Aug 2022 17:12:06 +0000 (17:12 +0000)
releasenotes/notes/safer-java-variable-handling-04c92b7148ac4cac.yaml [new file with mode: 0644]
shell/maven-sonar.sh
shell/update-java-alternatives.sh

diff --git a/releasenotes/notes/safer-java-variable-handling-04c92b7148ac4cac.yaml b/releasenotes/notes/safer-java-variable-handling-04c92b7148ac4cac.yaml
new file mode 100644 (file)
index 0000000..8a0fd0f
--- /dev/null
@@ -0,0 +1,8 @@
+---
+issues:
+  - |
+    Addresses problems found while troubleshooting IT-24352
+fixes:
+  - |
+    Added support for debian in update-java-alternatives.sh (addresses potential Ubuntu detection bug)
+    Safer handling of unset/null SONARCLOUD_JAVA_VERSION variable preventing java runtime issues
index 9d13003..9c82633 100644 (file)
@@ -48,7 +48,7 @@ if [ "$SONAR_HOST_URL" = "https://sonarcloud.io" ]; then
     fi
 fi
 
-if [ "$SET_JDK_VERSION" != "$SONARCLOUD_JAVA_VERSION" ]; then
+if [ -n "$SONARCLOUD_JAVA_VERSION" ] && [ "$SET_JDK_VERSION" != "$SONARCLOUD_JAVA_VERSION" ]; then
     export SET_JDK_VERSION="$SONARCLOUD_JAVA_VERSION"
     bash <(curl -s https://raw.githubusercontent.com/lfit/releng-global-jjb/master/shell/update-java-alternatives.sh)
     source /tmp/java.env
index 0bed1ec..58a83fc 100644 (file)
@@ -52,8 +52,8 @@ case "${OS}" in
         echo "---> RedHat type system detected"
         update-java-redhat
     ;;
-    ubuntu)
-        echo "---> Ubuntu system detected"
+    ubuntu|debian)
+        echo "---> Ubuntu/Debian system detected"
         update-java-ubuntu
     ;;
 esac