Skip to content

Commit

Permalink
Pickup Java version from .properties in OpenSearch gradle check (#2462)
Browse files Browse the repository at this point in the history
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
  • Loading branch information
reta authored Aug 16, 2022
1 parent 0720e05 commit 85668d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
10 changes: 3 additions & 7 deletions tests/jenkins/jobs/RunGradleCheck_Jenkinsfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,12 @@

echo "Get Major Version"
OS_VERSION=`cat buildSrc/version.properties | grep opensearch | cut -d= -f2 | grep -oE '[0-9.]+'`
JDK_MAJOR_VERSION=`cat buildSrc/version.properties | grep "bundled_jdk" | cut -d= -f2 | grep -oE '[0-9]+' | head -n 1`
OS_MAJOR_VERSION=`echo $OS_VERSION | grep -oE '[0-9]+' | head -n 1`
echo "Version: $OS_VERSION, Major Version: $OS_MAJOR_VERSION"

if [ "$OS_MAJOR_VERSION" -lt 2 ]; then
echo "Using JAVA 11"
export JAVA_HOME=$JAVA11_HOME
else
echo "Using JAVA 17"
export JAVA_HOME=$JAVA17_HOME
fi
echo "Using JAVA $JDK_MAJOR_VERSION"
eval export JAVA_HOME='$JAVA'$JDK_MAJOR_VERSION'_HOME'

env | grep JAVA | grep HOME

Expand Down
10 changes: 3 additions & 7 deletions vars/runGradleCheck.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,12 @@ void call(Map args = [:]) {
echo "Get Major Version"
OS_VERSION=`cat buildSrc/version.properties | grep opensearch | cut -d= -f2 | grep -oE '[0-9.]+'`
JDK_MAJOR_VERSION=`cat buildSrc/version.properties | grep "bundled_jdk" | cut -d= -f2 | grep -oE '[0-9]+' | head -n 1`
OS_MAJOR_VERSION=`echo \$OS_VERSION | grep -oE '[0-9]+' | head -n 1`
echo "Version: \$OS_VERSION, Major Version: \$OS_MAJOR_VERSION"
if [ "\$OS_MAJOR_VERSION" -lt 2 ]; then
echo "Using JAVA 11"
export JAVA_HOME=\$JAVA11_HOME
else
echo "Using JAVA 17"
export JAVA_HOME=\$JAVA17_HOME
fi
echo "Using JAVA \$JDK_MAJOR_VERSION"
eval export JAVA_HOME='\$JAVA'\$JDK_MAJOR_VERSION'_HOME'
env | grep JAVA | grep HOME
Expand Down

0 comments on commit 85668d6

Please sign in to comment.