X-Git-Url: https://gerrit.nordix.org/gitweb?a=blobdiff_plain;f=jjb%2Fgeode-native%2Fapache-geode-native-slave%2Fslave_setup.sh;h=4b216c1bc6a658248e0414c7bb899c67a5809ee0;hb=d643ea7acf4cd3e57ba89f092d39e0874b8b111c;hp=b08fa3faa4426e1b3b8cacd2036403f22d48c67f;hpb=e791f67871fa7cf88823961d77ccfbeb26690988;p=infra%2Fcicd.git diff --git a/jjb/geode-native/apache-geode-native-slave/slave_setup.sh b/jjb/geode-native/apache-geode-native-slave/slave_setup.sh index b08fa3fa..4b216c1b 100755 --- a/jjb/geode-native/apache-geode-native-slave/slave_setup.sh +++ b/jjb/geode-native/apache-geode-native-slave/slave_setup.sh @@ -23,7 +23,7 @@ set -o pipefail # Set build tools versions base on the: # https://github.com/apache/geode-native/blob/develop/docker/Dockerfile -CLANG_VERSION="6.0" +CLANG_VERSION="6.0.1" GEODE_VERSION="1.10.0" RAT_VERSION="0.13" CMAKE_VERSION="3.12.2" @@ -47,19 +47,19 @@ install_dev_packages() { echo "Info: Upgrade SLES and install all available patches" echo "-------------------------------------------------------------" - sudo zypper --gpg-auto-import-keys refresh ; sudo zypper -q update -y + sudo zypper --gpg-auto-import-keys refresh ; sudo zypper update -y sudo zypper -q patches echo "Info: Install clang development environment" echo "-------------------------------------------------------------" - sudo zypper -q install -y \ + sudo zypper install -y \ libc++-devel \ libc++abi-devel \ libopenssl-devel \ zlib-devel \ - clang${CLANG_VERSION%.*} \ - clang${CLANG_VERSION%.*}-checker \ - clang${CLANG_VERSION%.*}-devel \ + clang${CLANG_VERSION:0:1} \ + clang${CLANG_VERSION:0:1}-checker \ + clang${CLANG_VERSION:0:1}-devel \ gcc \ make \ patch \ @@ -69,10 +69,21 @@ install_dev_packages() { 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 + if [[ ! -L /etc/alternatives/clang ]] ; then + sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${CLANG_VERSION} 999 + fi + if [[ ! -L /etc/alternatives/clang++ ]] ; then + sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${CLANG_VERSION} 999 + fi + if [[ ! -L /etc/alternatives/clang-tidy ]] ; then + sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-${CLANG_VERSION} 999 + fi + if [[ ! -L /etc/alternatives/cc ]] ; then + sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-${CLANG_VERSION} 999 + fi + if [[ ! -L /etc/alternatives/cc++ ]] ; then + sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-${CLANG_VERSION} 999 + fi } configure_geode_build() { @@ -112,8 +123,22 @@ configure_geode_build() { 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} + # Update hosts file with ip6-localhost required by geode-native Integration tests + sudo sed -i '/ipv6-loopback$/s/$/ ip6-localhost/' /etc/hosts +} + +get_geode_build_docker_image() { + echo "Info: Start and enable docker on system" + echo "-------------------------------------------------------------" + sudo systemctl enable docker + sudo systemctl start docker + echo "Info: Remove all previous stopped docker containers and images" + echo "-------------------------------------------------------------" + sudo docker container prune -f + sudo docker image prune -f + echo "Info: Get the latest geode-native build docker image" + echo "-------------------------------------------------------------" + docker pull ${GEODE_NATIVE_DOCKER_IMAGE:-apachegeode/geode-native-build} } # Make sure the build server is SLES15 based @@ -126,10 +151,27 @@ case ${ID,,} in else install_dev_packages configure_geode_build + get_geode_build_docker_image fi ;; + ubuntu) + DPKG_LOCK="/var/lib/dpkg/lock-frontend" + # Wait for other apt process to finish by checking the dpkg lock file. + try=0 + while sudo lsof ${DPKG_LOCK} > /dev/null 2>&1 ; do + echo "DPKG file locked: ${DPKG_LOCK}." + echo " Waiting for another pkg installation process to finish ..." + sleep 10 + if [[ ${try} -gt 60 ]] ; then + echo "ERROR: Max number of re-tries reached, exiting..." + exit 1 + fi + try=$((try + 1)) + done + get_geode_build_docker_image + ;; *) - echo "ERROR: Only SLES15 can be use as a build server for this build" + echo "ERROR: Only SLES15 and Ubuntu OS can be use as a build server geode-native" exit 2 ;; esac