3a114b265409ffe4ae075634a94ea04b938e4b0d
[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 DPKG_LOCK="/var/lib/dpkg/lock-frontend"
23
24 # Wait for other apt process to finish by checking the dpkg lock file.
25 try=0
26 while sudo lsof ${DPKG_LOCK}  > /dev/null 2>&1 ; do
27   echo "DPKG file locked: ${DPKG_LOCK}."
28   echo "   Waiting for another pkg instalaltion process to finish ..."
29   sleep 10
30   if [[ ${try} -gt 60 ]] ; then
31     echo "ERROR: Max number of re-tries reached, exiting..."
32     exit 1
33   fi
34   try=$((try + 1))
35 done
36
37 sudo apt-get update
38 sudo apt-get install -y --no-install-recommends \
39   apt-transport-https \
40   lsb-release
41
42 curl -sSL https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
43 sudo add-apt-repository "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main"
44 sudo apt-get update
45 set +e && sudo apt-get purge -y google-cloud-sdk lxc-docker && set -e
46 sudo apt-get install -y --no-install-recommends \
47     aptitude \
48     ca-certificates \
49     cgroupfs-mount \
50     docker-compose \
51     docker-ce \
52     git \
53     google-chrome-stable \
54     htop \
55     jq \
56     less \
57     lsof \
58     net-tools \
59     python3 \
60     python3-pip \
61     rsync \
62     tmux \
63     unzip \
64     vim
65
66 sudo cp -R /etc/alternatives /etc/keep-alternatives
67 sudo apt-get update
68 sudo apt-get install -y --no-install-recommends \
69     openjdk-8-jdk \
70     openjdk-11-jdk \
71     openjdk-17-jdk
72 sudo rm -rf /etc/alternatives
73 sudo mv /etc/keep-alternatives /etc/alternatives
74
75 docker pull ${GEODE_DOCKER_IMAGE}
76 sudo curl -Lo /usr/local/bin/dunit-progress https://github.com/jdeppe-pivotal/progress-util/releases/download/0.2/progress.linux
77 sudo chmod +x /usr/local/bin/dunit-progress
78 wget --no-verbose -O /tmp/chromedriver_linux64.zip https://chromedriver.storage.googleapis.com/${CHROME_DRIVER_VERSION}/chromedriver_linux64.zip
79 sudo sudo rm -rf /opt/selenium/chromedriver
80 sudo unzip /tmp/chromedriver_linux64.zip -d /opt/selenium
81 rm /tmp/chromedriver_linux64.zip
82 sudo mv /opt/selenium/chromedriver /opt/selenium/chromedriver-${CHROME_DRIVER_VERSION}
83 sudo chmod 755 /opt/selenium/chromedriver-${CHROME_DRIVER_VERSION}
84 sudo ln -fs /opt/selenium/chromedriver-${CHROME_DRIVER_VERSION} /usr/bin/chromedriver
85
86 sudo apt-get clean
87 sudo rm -rf /var/lib/apt/lists/*