This is an automated email from the ASF dual-hosted git repository.

chengpan pushed a commit to branch branch-1.8
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/branch-1.8 by this push:
     new 689becc26 [KYUUBI #5308] Ensure release using Java 8
689becc26 is described below

commit 689becc264c6294fd24318c305ab6f4c93a391f7
Author: wforget <[email protected]>
AuthorDate: Tue Sep 19 06:43:04 2023 +0000

    [KYUUBI #5308] Ensure release using Java 8
    
    ### _Why are the changes needed?_
    
    Avoid releasing new version with incorrect java version.
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including 
negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [ ] [Run 
test](https://kyuubi.readthedocs.io/en/master/contributing/code/testing.html#running-tests)
 locally before make a pull request
    
    ### _Was this patch authored or co-authored using generative AI tooling?_
    
    No.
    
    Closes #5308 from wForget/release_check_java_version.
    
    Closes #5308
    
    8bf3c13ba [Cheng Pan] Update build/release/release.sh
    90ddd145d [wforget] comment
    b6ab1a480 [wforget] Check java version for release script
    
    Lead-authored-by: wforget <[email protected]>
    Co-authored-by: Cheng Pan <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
    (cherry picked from commit 2abceeaf50d792b616d5ed4cb2608e30f9ace863)
    Signed-off-by: Cheng Pan <[email protected]>
---
 build/release/release.sh | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/build/release/release.sh b/build/release/release.sh
index fefcce6a9..bb15fb402 100755
--- a/build/release/release.sh
+++ b/build/release/release.sh
@@ -52,6 +52,21 @@ if [[ ${RELEASE_VERSION} =~ .*-SNAPSHOT ]]; then
   exit 1
 fi
 
+if [ -n "${JAVA_HOME}" ]; then
+  JAVA="${JAVA_HOME}/bin/java"
+elif [ "$(command -v java)" ]; then
+  JAVA="java"
+else
+  echo "JAVA_HOME is not set" >&2
+  exit 1
+fi
+
+JAVA_VERSION=$($JAVA -version 2>&1 | awk -F '"' '/version/ {print $2}')
+if [[ $JAVA_VERSION != 1.8.* ]]; then
+  echo "Unexpected Java version: $JAVA_VERSION. Java 8 is required for 
release."
+  exit 1
+fi
+
 RELEASE_TAG="v${RELEASE_VERSION}-rc${RELEASE_RC_NO}"
 
 SVN_STAGING_REPO="https://dist.apache.org/repos/dist/dev/kyuubi";

Reply via email to