Skip VPP build for merge jobs with Gerrit ID != git HEAD.
[ci-management.git] / jjb / scripts / setup_executor_env.sh
1 #!/bin/bash
2
3 # Copyright (c) 2020 Cisco and/or its affiliates.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at:
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 echo "---> jjb/scripts/setup_executor_env.sh"
17
18 set -e -o pipefail
19
20 OS_ID=$(grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
21 OS_VERSION_ID=$(grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
22 OS_ARCH=$(uname -m)
23 dockerfile="/scratch/docker-build/Dockerfile"
24 file_delimiter="----- %< -----"
25 long_line="************************************************************************"
26 downloads_cache="/root/Downloads"
27
28 echo "$long_line"
29 echo "Executor OS: $OS_ID-$OS_VERSION_ID"
30 echo "Executor Arch: $OS_ARCH"
31 # TODO: fix this to print nomad server hostname
32 echo "Executor hostname: $(hostname)"
33
34 echo "$long_line"
35 if [ -f "$dockerfile" ] ; then
36     echo -e "Executor Dockerfile: ${dockerfile}\n${file_delimiter}"
37     cat $dockerfile
38     echo "$file_delimiter"
39 else
40     echo "Unknown Executor: '$dockerfile' not found!"
41 fi
42
43 echo "$long_line"
44 echo "Executor package list:"
45 if [ "$OS_ID" == "ubuntu" ] || [ "$OS_ID" = "debian" ] ; then
46     dpkg-query -W -f='${binary:Package}\t${Version}\n' | column -t || true
47 elif [ "$OS_ID" == "centos" ] ; then
48     yum list installed || true
49 fi
50
51 echo "$long_line"
52 echo "Python3 package list:"
53 pip3 list 2>/dev/null | column -t || true
54
55 echo "$long_line"
56 echo "Executor Downloads cache '$downloads_cache':"
57 ls -lh "$downloads_cache" || true
58 echo "$long_line"