Merge "Nexus retirement CI job clean up"
[ci-management.git] / jjb / scripts / post_build_executor_info.sh
1 #!/bin/bash
2
3 # Copyright (c) 2021 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/post_build_executor_info.sh"
17
18 # Output executor runtime attributes [again] in case the job fails prior to
19 # running setup_executor_env.sh
20 long_line="************************************************************************"
21 OS_ID=$(grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
22 OS_VERSION_ID=$(grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
23 OS_ARCH=$(uname -m)
24 echo "$long_line"
25 echo "Executor Runtime Attributes:"
26 echo "OS: $OS_ID-$OS_VERSION_ID"
27 echo "    $(uname -a)"
28 echo "Number CPUs: $(nproc)"
29 echo "Arch: $OS_ARCH"
30 echo "Nomad Hostname: $(grep search /etc/resolv.conf | cut -d' ' -f2 | head -1)"
31 echo "Container ID: $(hostname)"
32 echo "$long_line"
33 echo -e "lscpu:\n$(lscpu)"
34 echo "$long_line"
35 echo -e "df -h:\n$(df -h)"
36 echo "$long_line"
37 echo -e "free -m:\n$(free -m)"
38
39 if [ -n "$(which ccache)" ] ; then
40     echo "$long_line"
41     echo "ccache statistics:"
42     [ -n "${CCACHE_DISABLE:-}" ] && echo "CCACHE_DISABLE = '$CCACHE_DISABLE'"
43     [ -n "${CCACHE_DIR:-}" ] && echo "CCACHE_DIR = '$CCACHE_DIR'"
44     ccache -s
45 fi
46
47 echo "$long_line"