Fix package_cloud push of vpp-ext-deps
[ci-management.git] / jjb / scripts / vpp / build.sh
1 #!/bin/bash
2 # basic build script example
3
4 # Copyright (c) 2020 Cisco and/or its affiliates.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at:
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 echo "---> jjb/scripts/vpp/build.sh"
18
19 set -xe -o pipefail
20
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
25 echo "sha1sum of this script: ${0}"
26 sha1sum $0
27
28 # TODO: Mount ccache volume into docker container, then enable this.
29 #
30 #export CCACHE_DIR=/scratch/docker-build/ccache
31 #if [ -d $CCACHE_DIR ];then
32 #    echo "ccache size:"
33 #    du -sh $CCACHE_DIR
34 #else
35 #    echo $CCACHE_DIR does not exist.
36 #fi
37
38 if [ "x${MAKE_PARALLEL_FLAGS}" != "x" ]
39 then
40   echo "Building VPP. Number of cores for build set with" \
41        "MAKE_PARALLEL_FLAGS='${MAKE_PARALLEL_FLAGS}'."
42 elif [ "x${MAKE_PARALLEL_JOBS}" != "x" ]
43 then
44   echo "Building VPP. Number of cores for build set with" \
45        "MAKE_PARALLEL_JOBS='${MAKE_PARALLEL_JOBS}'."
46 else
47   echo "Building VPP. Number of cores not set, " \
48        "using build default ($(grep -c ^processor /proc/cpuinfo))."
49 fi
50
51 echo "CC=${CC}"
52 echo "IS_CSIT_VPP_JOB=${IS_CSIT_VPP_JOB}"
53
54 # If we are not a CSIT job just building packages, then use make verify,
55 # else use make pkg-verify.
56 if [ "x${IS_CSIT_VPP_JOB}" != "xTrue" ]
57 then
58     if [ "x${MAKE_PARALLEL_JOBS}" != "x" ]
59     then
60         export TEST_JOBS="${MAKE_PARALLEL_JOBS}"
61         echo "Testing VPP with ${TEST_JOBS} cores."
62     else
63         export TEST_JOBS="auto"
64         echo "Testing VPP with automatically calculated number of cores. " \
65              "See test logs for the exact number."
66     fi
67     echo "Building using \"make verify\""
68     [ "x${DRYRUN}" == "xTrue" ] || make UNATTENDED=yes verify
69 else
70     echo "Building using \"make pkg-verify\""
71     [ "x${DRYRUN}" == "xTrue" ] || make UNATTENDED=yes pkg-verify
72 fi
73
74 echo "*******************************************************************"
75 echo "* VPP ${OS_ID^^}-${OS_VERSION_ID}-${OS_ARCH^^} BUILD SUCCESSFULLY COMPLETED"
76 echo "*******************************************************************"