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

granthenke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/master by this push:
     new 92b20a0  [docker] Add support for openSUSE in the Docker build
92b20a0 is described below

commit 92b20a0f9bffa3a729795d130b338eaef995aa52
Author: Grant Henke <[email protected]>
AuthorDate: Wed Dec 16 14:13:50 2020 -0600

    [docker] Add support for openSUSE in the Docker build
    
    This patch adds support for openSUSE/leap:15 as a base image in the
    Docker build. This is useful for testing and validating Kudu usage on
    openSUSE/SLES.
    
    I fixed the logic in `get_os_tag` to handle the illegal `/` character
    in the resulting tag. This results in a cleaner tag such as
    `apache/kudu:latest-leap15`.
    
    Change-Id: I9c1ce282fda67db5043445a139c888bc74c44680
    Reviewed-on: http://gerrit.cloudera.org:8080/16885
    Tested-by: Kudu Jenkins
    Reviewed-by: Alexey Serbin <[email protected]>
---
 docker/bootstrap-dev-env.sh     | 54 +++++++++++++++++++++++++++++++++++++++++
 docker/bootstrap-java-env.sh    | 11 +++++++++
 docker/bootstrap-python-env.sh  | 16 ++++++++++++
 docker/bootstrap-runtime-env.sh | 23 ++++++++++++++++++
 docker/docker-build.py          | 12 ++++++---
 5 files changed, 113 insertions(+), 3 deletions(-)

diff --git a/docker/bootstrap-dev-env.sh b/docker/bootstrap-dev-env.sh
index aa725af..3fb7a1e 100755
--- a/docker/bootstrap-dev-env.sh
+++ b/docker/bootstrap-dev-env.sh
@@ -179,6 +179,60 @@ elif [[ -f "/usr/bin/apt-get" ]]; then
   rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
 
   unset DEBIAN_FRONTEND
+  # OpenSUSE/SLES
+elif [[ -f "/usr/bin/zypper" ]]; then
+  # Update the repo.
+  zypper update -y
+
+  zypper install -y \
+    autoconf \
+    automake \
+    chrony \
+    chrpath \
+    cyrus-sasl-devel \
+    cyrus-sasl-gssapi \
+    cyrus-sasl-plain \
+    curl \
+    flex \
+    gcc \
+    gcc-c++ \
+    gdb \
+    git \
+    gzip \
+    hostname \
+    krb5-devel \
+    krb5-server \
+    libtool \
+    lsb-release \
+    lsof \
+    make \
+    openssl-devel \
+    patch \
+    pkg-config \
+    python \
+    rsync \
+    sudo \
+    unzip \
+    vim \
+    which \
+    wget
+
+  # Install extra impala packages for the impala images. They are nominal in 
size.
+  # TODO(ghenke): tzdata equivalent package. This is not an issue given we 
currently
+  # only build the Impala images with in CentOS 7.
+  zypper install -y \
+    libffi-devel \
+    liblzo2-2
+
+  # Install libraries often used for Kudu development and build performance.
+  zypper install -y \
+    ccache \
+    cmake \
+    ninja
+
+  # Reduce the image size by cleaning up after the install.
+  zypper clean --all
+  rm -rf /var/lib/zypp/* /tmp/* /var/tmp/*
 else
   echo "Unsupported OS"
   exit 1
diff --git a/docker/bootstrap-java-env.sh b/docker/bootstrap-java-env.sh
index f05442d..6f236bb 100755
--- a/docker/bootstrap-java-env.sh
+++ b/docker/bootstrap-java-env.sh
@@ -70,6 +70,17 @@ elif [[ -f "/usr/bin/apt-get" ]]; then
   rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
 
   unset DEBIAN_FRONTEND
+# OpenSUSE/SLES
+elif [[ -f "/usr/bin/zypper" ]]; then
+  # Update the repo.
+  zypper update -y
+
+  # Install OpenJDK 8.
+  zypper install -y java-1_8_0-openjdk-devel
+
+  # Reduce the image size by cleaning up after the install.
+  zypper clean --all
+  rm -rf /var/lib/zypp/* /tmp/* /var/tmp/*
 else
   echo "Unsupported OS"
   exit 1
diff --git a/docker/bootstrap-python-env.sh b/docker/bootstrap-python-env.sh
index 09a4e92..f4b91a0 100755
--- a/docker/bootstrap-python-env.sh
+++ b/docker/bootstrap-python-env.sh
@@ -100,6 +100,22 @@ elif [[ -f "/usr/bin/apt-get" ]]; then
   rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
 
   unset DEBIAN_FRONTEND
+# OpenSUSE/SLES
+elif [[ -f "/usr/bin/zypper" ]]; then
+  # Update the repo.
+  zypper update -y
+
+  # Install curl, used when installing pip.
+  zypper install -y ca-certificates curl
+
+  # Install python development packages.
+  # g++ is required to check for int128 support in setup.py.
+  zypper install -y gcc gcc-c++ python-devel python-xml
+  install_python_packages
+
+  # Reduce the image size by cleaning up after the install.
+  zypper clean --all
+  rm -rf /var/lib/zypp/* /tmp/* /var/tmp/*
 else
   echo "Unsupported OS"
   exit 1
diff --git a/docker/bootstrap-runtime-env.sh b/docker/bootstrap-runtime-env.sh
index 259e2bf..d384907 100755
--- a/docker/bootstrap-runtime-env.sh
+++ b/docker/bootstrap-runtime-env.sh
@@ -82,6 +82,29 @@ elif [[ -f "/usr/bin/apt-get" ]]; then
   rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
 
   unset DEBIAN_FRONTEND
+# OpenSUSE/SLES
+elif [[ -f "/usr/bin/zypper" ]]; then
+  # Update the repo.
+  zypper update -y
+
+  zypper install -y \
+    cyrus-sasl-gssapi \
+    cyrus-sasl-plain \
+    krb5-devel \
+    krb5-server \
+    openssl
+
+  # Install extra impala runtime packages used by the impala-runtime image. 
They are nominal in size.
+  # TODO(ghenke): tzdata equivalent package. This is not an issue given we 
currently
+  # only build the Impala images with in CentOS 7.
+  zypper install -y \
+    cyrus-sasl-devel \
+    liblzo2-2 \
+    which
+
+  # Reduce the image size by cleaning up after the install.
+  zypper clean --all
+  rm -rf /var/lib/zypp/* /tmp/* /var/tmp/*
 else
   echo "Unsupported OS"
   exit 1
diff --git a/docker/docker-build.py b/docker/docker-build.py
index 6febac8..bcefc6e 100755
--- a/docker/docker-build.py
+++ b/docker/docker-build.py
@@ -83,7 +83,8 @@ def parse_args():
   parser.add_argument('--bases', nargs='+', default=DEFAULT_OS, choices=[
                       'centos:6', 'centos:7', 'centos:8',
                       'debian:jessie', 'debian:stretch',
-                      'ubuntu:trusty', 'ubuntu:xenial', 'ubuntu:bionic'],
+                      'ubuntu:trusty', 'ubuntu:xenial', 'ubuntu:bionic',
+                      'opensuse/leap:15'],
                       help='The base operating systems to build with')
   # These targets are defined in the Dockerfile. Dependent targets of a passed 
image will be built,
   # but not tagged. Note that if a target is not tagged it is subject removal 
by Dockers system
@@ -161,8 +162,13 @@ def get_os_tag(base):
       The operating system is described with the version name.
       If the operating system version is numeric, the version will also be 
appended.
   """
-  os_name = base.split(':')[0]
-  os_version = base.split(':')[1]
+  # If the base contains a "/" remove the prefix. ex: `opensuse/leap:15`
+  if "/" in base:
+    short_base = base.split('/')[1]
+  else:
+    short_base = base
+  os_name = short_base.split(':')[0]
+  os_version = short_base.split(':')[1]
   os_tag = os_name
   if os_version.isdigit():
     os_tag += os_version

Reply via email to