Geode: Updates for AcceptanceTest
[infra/cicd.git] / jjb / geode / apache-geode-slave / slave_setup.sh
1 #!/usr/bin/env bash
2 # Licensed to the Apache Software Foundation (ASF) under one
3 # or more contributor license agreements.  See the NOTICE file
4 # distributed with this work for additional information
5 # regarding copyright ownership.  The ASF licenses this file
6 # to you under the Apache License, Version 2.0 (the
7 # "License"); you may not use this file except in compliance
8 # with the License.  You may obtain a copy of the License at
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17
18 set -o nounset
19 set -o errexit
20 set -o pipefail
21 set -o xtrace
22
23 # Global variables
24 DPKG_LOCK="/var/lib/dpkg/lock-frontend"
25 DOCKER_VERSION="5:20.10.20~3-0~ubuntu-bionic"
26 DOCKER_COMPOSE_URL="https://github.com/docker/compose/releases/download"
27 DOCKER_COMPOSE_VERSION="1.29.2"
28
29 # Wait for other apt process to finish by checking the dpkg lock file.
30 try=0
31 while sudo lsof ${DPKG_LOCK}  > /dev/null 2>&1 ; do
32   echo "DPKG file locked: ${DPKG_LOCK}."
33   echo "   Waiting for another pkg instalaltion process to finish ..."
34   sleep 10
35   if [[ ${try} -gt 60 ]] ; then
36     echo "ERROR: Max number of re-tries reached, exiting..."
37     exit 1
38   fi
39   try=$((try + 1))
40 done
41
42 sudo apt-get update
43 sudo apt-get install -y --no-install-recommends \
44   apt-transport-https \
45   lsb-release
46
47 curl -sSL https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
48 sudo add-apt-repository "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main"
49 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
50 sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
51 sudo apt-get update
52 set +e && sudo apt-get purge -y google-cloud-sdk lxc-docker && set -e
53 sudo apt-get install -y --no-install-recommends \
54     aptitude \
55     ca-certificates \
56     cgroupfs-mount \
57     docker-ce=${DOCKER_VERSION} \
58     docker-ce-cli=${DOCKER_VERSION} \
59     git \
60     google-chrome-stable \
61     htop \
62     jq \
63     less \
64     lsof \
65     net-tools \
66     python3 \
67     python3-pip \
68     rsync \
69     tmux \
70     unzip \
71     vim
72
73 # Get correct docker-compose version required for geode-AcceptanceTest
74 sudo curl -L "${DOCKER_COMPOSE_URL}/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" \
75           -o /usr/local/bin/docker-compose
76 sudo chmod +x /usr/local/bin/docker-compose
77
78 sudo cp -R /etc/alternatives /etc/keep-alternatives
79 sudo apt-get update
80 sudo apt-get install -y --no-install-recommends \
81     openjdk-8-jdk \
82     openjdk-11-jdk \
83     openjdk-17-jdk
84 sudo rm -rf /etc/alternatives
85 sudo mv /etc/keep-alternatives /etc/alternatives
86
87 docker pull ${GEODE_DOCKER_IMAGE}
88 sudo curl -Lo /usr/local/bin/dunit-progress https://github.com/jdeppe-pivotal/progress-util/releases/download/0.2/progress.linux
89 sudo chmod +x /usr/local/bin/dunit-progress
90 wget --no-verbose -O /tmp/chromedriver_linux64.zip https://chromedriver.storage.googleapis.com/${CHROME_DRIVER_VERSION}/chromedriver_linux64.zip
91 sudo sudo rm -rf /opt/selenium/chromedriver
92 sudo unzip /tmp/chromedriver_linux64.zip -d /opt/selenium
93 rm /tmp/chromedriver_linux64.zip
94 sudo mv /opt/selenium/chromedriver /opt/selenium/chromedriver-${CHROME_DRIVER_VERSION}
95 sudo chmod 755 /opt/selenium/chromedriver-${CHROME_DRIVER_VERSION}
96 sudo ln -fs /opt/selenium/chromedriver-${CHROME_DRIVER_VERSION} /usr/bin/chromedriver
97
98 sudo apt-get clean
99 sudo rm -rf /var/lib/apt/lists/*