GEODE: Nordix CI pipeline for geode-native client
Change-Id: I612726a1bc1f789161e1e13bd0c7b4da34b5a7f4
diff --git a/jjb/geode-native/apache-geode-native-slave/apache-geode-native-slave-setup.yaml b/jjb/geode-native/apache-geode-native-slave/apache-geode-native-slave-setup.yaml
new file mode 100644
index 0000000..98611a4
--- /dev/null
+++ b/jjb/geode-native/apache-geode-native-slave/apache-geode-native-slave-setup.yaml
@@ -0,0 +1,37 @@
+---
+#
+# ============LICENSE_START=======================================================
+# Copyright (C) 2018-2019 Nordix Foundation.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+- job:
+ name: 'apache-geode-native-SlaveSetup'
+
+ node: geode-sles15
+ disabled: false
+ concurrent: true
+
+ properties:
+ - logrotate
+
+ parameters:
+ - string:
+ name: GEODE_NATIVE_DOCKER_IMAGE
+ default: 'apachegeode/geode-native-build'
+ description: JJB configured name of the geode-native build docker image based on Ubuntu 18.04
+
+ builders:
+ - 'apache-geode-native-setup-slave-macro'
diff --git a/jjb/geode-native/apache-geode-native-slave/slave_setup.sh b/jjb/geode-native/apache-geode-native-slave/slave_setup.sh
new file mode 100755
index 0000000..b08fa3f
--- /dev/null
+++ b/jjb/geode-native/apache-geode-native-slave/slave_setup.sh
@@ -0,0 +1,135 @@
+#!/usr/bin/env bash
+# ============LICENSE_START=======================================================
+# Copyright (C) 2018-2019 Nordix Foundation.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+set -o nounset
+set -o errexit
+set -o pipefail
+#set -o xtrace
+
+# Set build tools versions base on the:
+# https://github.com/apache/geode-native/blob/develop/docker/Dockerfile
+CLANG_VERSION="6.0"
+GEODE_VERSION="1.10.0"
+RAT_VERSION="0.13"
+CMAKE_VERSION="3.12.2"
+
+# Additional repositories and build 3PPs
+CLANG_SLES_REPO="https://download.opensuse.org/repositories/devel:/languages:/swift/SLE_15/"
+GAMES_SLES_REPO="https://download.opensuse.org/repositories/games/SLE_15_SP1/"
+GEODE_LOCATION="https://www.apache.org/dyn/closer.cgi?action=download&filename=geode/${GEODE_VERSION}/apache-geode-${GEODE_VERSION}.tgz"
+RAT_LOCATION="https://www.apache.org/dyn/closer.cgi?action=download&filename=creadur/apache-rat-${RAT_VERSION}/apache-rat-${RAT_VERSION}-bin.tar.gz"
+CMAKE_LOCATION="https://cmake.org/files/v${CMAKE_VERSION%.*}/cmake-${CMAKE_VERSION}-Linux-x86_64.sh"
+
+install_dev_packages() {
+ # Add Swift repository with clang6 compiler.
+ if ! zypper lr -n | egrep Swift-Programming-Language > /dev/null ; then
+ sudo zypper addrepo ${CLANG_SLES_REPO} "Swift-Programming-Language(SLES_15)"
+ fi
+ # Add Games repository with libjsoncpp library.
+ if ! zypper lr -n | egrep Games > /dev/null ; then
+ sudo zypper addrepo ${GAMES_SLES_REPO} "Games(SLE_15_SP1)"
+ fi
+
+ echo "Info: Upgrade SLES and install all available patches"
+ echo "-------------------------------------------------------------"
+ sudo zypper --gpg-auto-import-keys refresh ; sudo zypper -q update -y
+ sudo zypper -q patches
+
+ echo "Info: Install clang development environment"
+ echo "-------------------------------------------------------------"
+ sudo zypper -q install -y \
+ libc++-devel \
+ libc++abi-devel \
+ libopenssl-devel \
+ zlib-devel \
+ clang${CLANG_VERSION%.*} \
+ clang${CLANG_VERSION%.*}-checker \
+ clang${CLANG_VERSION%.*}-devel \
+ gcc \
+ make \
+ patch \
+ doxygen \
+ git \
+ graphviz \
+ java-1_8_0-openjdk-devel \
+ wget
+
+ sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${CLANG_VERSION} 999
+ sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${CLANG_VERSION} 999
+ sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-${CLANG_VERSION} 999
+ sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-${CLANG_VERSION} 999
+}
+
+configure_geode_build() {
+ echo "Info: Install 3PPs required to build geode-native"
+ echo "-------------------------------------------------------------"
+ # The Geode is required on build server to compile geode-native
+ if [[ ! -d /opt/apache-geode-${GEODE_VERSION} ]] ; then
+ wget ${GEODE_LOCATION} -O - | sudo tar xzvf - -C /opt
+ else
+ echo "The Geode ${GEODE_VERSION} already installed."
+ fi
+ echo "-------------------------------------------------------------"
+
+ # The Rat (Apache Release Audit Tool) is required to compile geode-native
+ if [[ ! -d /opt/apache-rat-${RAT_VERSION} ]] ; then
+ wget ${RAT_LOCATION} -O - | sudo tar xzvf - -C /opt
+ else
+ echo "The Apache RAT ${RAT_VERSION} already installed."
+ fi
+ echo "-------------------------------------------------------------"
+
+ # cmake is required to generate a build system for geode-native
+ if [[ ! -f /usr/local/bin/cmake ]] ; then
+ wget ${CMAKE_LOCATION} -O /tmp/cmake
+ sudo bash /tmp/cmake --skip-license --prefix=/usr/local
+ rm -rf /tmp/cmake
+ elif ! /usr/local/bin/cmake -version | grep -q ${CMAKE_VERSION} ; then
+ echo "ERROR: Incorrect cmake version installed"
+ exit 3
+ else
+ echo "The CMAKE ${CMAKE_VERSION} already installed."
+ fi
+
+ # Export 3PPs location for geode-native build
+ export JAVA_HOME="/usr/lib64/jvm/java-openjdk"
+ export GEODE_HOME="/opt/apache-geode-${GEODE_VERSION}"
+ export RAT_HOME="/opt/apache-rat-${RAT_VERSION}"
+ export PATH="$PATH:$GEODE_HOME/bin"
+
+ # Get the latest geode-native build docker image
+ docker pull ${GEODE_NATIVE_DOCKER_IMAGE}
+}
+
+# Make sure the build server is SLES15 based
+source /etc/os-release
+case ${ID,,} in
+ sles)
+ if [[ "${VERSION}" != "15" ]] ; then
+ echo "ERROR: Incorrect version on SLES on the build server: ${VERSION}"
+ exit 1
+ else
+ install_dev_packages
+ configure_geode_build
+ fi
+ ;;
+ *)
+ echo "ERROR: Only SLES15 can be use as a build server for this build"
+ exit 2
+ ;;
+esac