This is an automated email from the ASF dual-hosted git repository.
iwasakims pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bigtop.git
The following commit(s) were added to refs/heads/master by this push:
new 2b8203fe BIGTOP-3852: Java 11 to bigtop-toolchain to use it in docker
container during packaging (#1043)
2b8203fe is described below
commit 2b8203fe0f6ee532e6095d8cf0e1db964919a011
Author: Leona Yoda <[email protected]>
AuthorDate: Thu Oct 27 21:04:30 2022 +0900
BIGTOP-3852: Java 11 to bigtop-toolchain to use it in docker container
during packaging (#1043)
---
bigtop-ci/build.sh | 14 ++++++++++-
.../src/common/kafka/do-component-build | 6 +++++
bigtop_toolchain/manifests/installer.pp | 27 ++++++++++++++++++++++
.../manifests/{installer.pp => jdk11.pp} | 27 +++++++++++-----------
packages.gradle | 6 +++++
5 files changed, 65 insertions(+), 15 deletions(-)
diff --git a/bigtop-ci/build.sh b/bigtop-ci/build.sh
index f1d829fc..47dd66b6 100755
--- a/bigtop-ci/build.sh
+++ b/bigtop-ci/build.sh
@@ -17,7 +17,8 @@
BIGTOP_HOME=`cd $(dirname $0)/.. && pwd`
usage() {
- echo "usage build.sh --prefix trunk|1.4.0|1.3.0|... --os
debian-10|centos-7|... --target hadoop|tez|... [--nexus] [--mvn-cache-volume
true|false] [--docker-run-option ...]"
+ echo "usage build.sh --prefix trunk|1.4.0|1.3.0|... --os
debian-10|centos-7|... --target hadoop|tez|..."
+ echo " [--nexus] [--preferred-java-version 8|11] [--mvn-cache-volume
true|false] [--docker-run-option ...]"
exit 1 # unknown option
}
@@ -46,6 +47,10 @@ case $key in
CONFIGURE_NEXUS="configure-nexus"
shift
;;
+ --preferred-java-version)
+ BIGTOP_PREFERRED_JAVA_VERSION="$2"
+ shift
+ ;;
--mvn-cache-volume)
MVN_CACHE_VOLUME="$2"
shift
@@ -79,6 +84,13 @@ if [ "x86_64" != $ARCH ]; then
IMAGE_NAME=$IMAGE_NAME-$ARCH
fi
+if [ -n "${BIGTOP_PREFERRED_JAVA_VERSION}" ]; then
+ if [ "${BIGTOP_PREFERRED_JAVA_VERSION}" == "8" ]; then
+ BIGTOP_PREFERRED_JAVA_VERSION="1.8.0"
+ fi
+ DOCKER_RUN_OPTION="${DOCKER_RUN_OPTION} -e
BIGTOP_PREFERRED_JAVA_VERSION=${BIGTOP_PREFERRED_JAVA_VERSION}"
+fi
+
# Add / Delete named volume for maven cache
MVN_CACHE_VOLUME_NAME="bigtop-mvn-cache-${OS}"
if [ "${MVN_CACHE_VOLUME}" == "true" ]; then
diff --git a/bigtop-packages/src/common/kafka/do-component-build
b/bigtop-packages/src/common/kafka/do-component-build
index 843a7a1b..e8c46187 100644
--- a/bigtop-packages/src/common/kafka/do-component-build
+++ b/bigtop-packages/src/common/kafka/do-component-build
@@ -23,6 +23,12 @@ BUILD_OPTS="-Divy.home=${HOME}/.ivy2
-Dsbt.ivy.home=${HOME}/.ivy2 -Duser.home=${
-Dreactor.repo=file://${HOME}/.m2/repository \
-DskipTests -DrecompileMode=all"
+# if BIGTOP_PREFERRED_JAVA_VERSION is set, switch java version for the build
+if [ -n "${BIGTOP_PREFERRED_JAVA_VERSION}" ]; then
+ export JAVA_HOME="/usr/lib/jvm/java-${BIGTOP_PREFERRED_JAVA_VERSION}"
+ export PATH=$JAVA_HOME/bin:$PATH
+fi
+
## this might be an issue at times
#
http://maven.40175.n5.nabble.com/Not-finding-artifact-in-local-repo-td3727753.html
export MAVEN_OPTS="-Xmx2g -XX:ReservedCodeCacheSize=512m"
diff --git a/bigtop_toolchain/manifests/installer.pp
b/bigtop_toolchain/manifests/installer.pp
index bcf9ee72..0cde02f4 100644
--- a/bigtop_toolchain/manifests/installer.pp
+++ b/bigtop_toolchain/manifests/installer.pp
@@ -14,6 +14,7 @@
# limitations under the License.
class bigtop_toolchain::installer {
+ include bigtop_toolchain::jdk11
include bigtop_toolchain::jdk
include bigtop_toolchain::maven
include bigtop_toolchain::ant
@@ -24,6 +25,32 @@ class bigtop_toolchain::installer {
include bigtop_toolchain::user
include bigtop_toolchain::renv
include bigtop_toolchain::grpc
+ Class['bigtop_toolchain::jdk11']->Class['bigtop_toolchain::jdk']
+
+ case $::operatingsystem {
+ /Debian/: {
+ exec { 'ensure java 8 is set as default':
+ command => "update-java-alternatives --set adoptopenjdk-8*",
+ path => ['/usr/sbin', '/usr/bin', '/bin'],
+ require => Class['bigtop_toolchain::jdk'],
+ }
+ }
+ /Ubuntu/: {
+ exec { 'ensure java 8 is set as default':
+ command => "update-java-alternatives --set java-1.8.0-openjdk-$(dpkg
--print-architecture)",
+ path => ['/usr/sbin', '/usr/bin', '/bin'],
+ require => Class['bigtop_toolchain::jdk'],
+ }
+ }
+ /(CentOS|Fedora|RedHat)/: {
+ exec { 'ensure java 8 is set as default':
+ command => "update-alternatives --set java java-1.8.0-openjdk.$(uname
-m) \
+ && update-alternatives --set javac
java-1.8.0-openjdk.$(uname -m)",
+ path => ['/usr/sbin', '/usr/bin', '/bin'],
+ require => Class['bigtop_toolchain::jdk'],
+ }
+ }
+ }
stage { 'last':
require => Stage['main'],
diff --git a/bigtop_toolchain/manifests/installer.pp
b/bigtop_toolchain/manifests/jdk11.pp
similarity index 62%
copy from bigtop_toolchain/manifests/installer.pp
copy to bigtop_toolchain/manifests/jdk11.pp
index bcf9ee72..2e974cb1 100644
--- a/bigtop_toolchain/manifests/installer.pp
+++ b/bigtop_toolchain/manifests/jdk11.pp
@@ -13,20 +13,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-class bigtop_toolchain::installer {
- include bigtop_toolchain::jdk
- include bigtop_toolchain::maven
- include bigtop_toolchain::ant
- include bigtop_toolchain::gradle
- include bigtop_toolchain::protobuf
- include bigtop_toolchain::packages
- include bigtop_toolchain::env
- include bigtop_toolchain::user
- include bigtop_toolchain::renv
- include bigtop_toolchain::grpc
+class bigtop_toolchain::jdk11 {
+ case $::operatingsystem {
+ /(Debian|Ubuntu)/: {
+ include apt
- stage { 'last':
- require => Stage['main'],
+ package { 'openjdk-11-jdk' :
+ ensure => present,
+ }
+ }
+ /(CentOS|Fedora|RedHat)/: {
+ package { 'java-11-openjdk-devel' :
+ ensure => present
+ }
+ }
}
- class { 'bigtop_toolchain::cleanup': stage => 'last' }
}
diff --git a/packages.gradle b/packages.gradle
index 34ad3a11..b3f4b190 100644
--- a/packages.gradle
+++ b/packages.gradle
@@ -661,6 +661,7 @@ def genTasks = { target ->
"-POS=[centos-7|fedora-35|debian-10|ubuntu-18.04] " +
"-Pprefix=[trunk|1.4.0|1.3.0|1.2.1|...] $target-pkg-ind " +
"-Pnexus=[true|false]" +
+ "[-Ppreferred-java-version=[8|11]]" +
"[-Pmvn-cache-volume=[true|false]]",
group: PACKAGES_GROUP) doLast {
def _prefix = project.hasProperty("prefix") ? prefix : "trunk"
@@ -669,6 +670,7 @@ def genTasks = { target ->
logger.warn(_OS + ' requires privileged mode, pass
`-Pdocker-run-option="--privileged"` to gradle option')
}
def _target_pkg = "$target-pkg"
+ def _preferred_java_version =
project.hasProperty("preferred-java-version") ? this.'preferred-java-version' :
"8"
def _mvn_cache_volume = project.hasProperty("mvn-cache-volume") ?
this.'mvn-cache-volume' : ""
def _docker_run_option = project.hasProperty("docker-run-option") ?
this.'docker-run-option' : ""
def additionalConfigKeys = ['git_repo', 'git_ref', 'git_dir',
'git_commit_hash', 'base_version']
@@ -688,6 +690,10 @@ def genTasks = { target ->
if ( project.hasProperty("nexus") ) {
command.add('--nexus')
}
+ if ( _preferred_java_version.toInteger() > 8 ) {
+ command.add('--preferred-java-version')
+ command.add( _preferred_java_version)
+ }
if ( project.hasProperty("mvn-cache-volume") ) {
command.add('--mvn-cache-volume')
command.add(_mvn_cache_volume)