1 # lib_vpp.sh - Docker build script VPP library.
4 # Copyright (c) 2021 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:
9 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 # Don't import more than once.
18 if [ -n "$(alias lib_vpp_imported 2> /dev/null)" ] ; then
21 alias lib_vpp_imported=true
23 export CIMAN_DOCKER_SCRIPTS=${CIMAN_DOCKER_SCRIPTS:-"$(dirname $BASH_SOURCE)"}
24 . $CIMAN_DOCKER_SCRIPTS/lib_common.sh
27 VPP_SUPPORTED_EXECUTOR_CLASSES="builder"
28 vpp_supported_executor_class() {
29 if ! grep -q "${1:-}" <<< $VPP_SUPPORTED_EXECUTOR_CLASSES ; then
37 local branch=${2:-"master"}
38 local branchname="$(echo $branch | sed -e 's,/,_,')"
39 local bld_log="$DOCKER_BUILD_LOG_DIR"
40 bld_log="${bld_log}/$FDIOTOOLS_IMAGENAME-$branchname"
41 bld_log="${bld_log}-make_vpp_${target}-bld.log"
43 makefile_target="^${target}:"
44 if [ -z "$(grep $makefile_target Makefile)" ] ; then
45 echo "Make target '$target' does not exist in VPP branch '$branch'!"
49 description="'make UNATTENDED=y $target' in $(pwd) ($branch)"
50 echo_log -e " Starting $description..."
51 local force_opts="--allow-downgrades --allow-remove-essential"
52 force_opts="$force_opts --allow-change-held-packages"
53 make UNATTENDED=y CONFIRM="-y" FORCE="$force_opts" \
54 $target 2>&1 | tee -a "$bld_log"
56 echo_log " Completed $description!"
61 local branch=${2:-"master"}
62 local branchname="$(echo $branch | sed -e 's,/,_,')"
63 local bld_log="$DOCKER_BUILD_LOG_DIR"
64 bld_log="${bld_log}/$FDIOTOOLS_IMAGENAME-$branchname"
65 bld_log="${bld_log}-make_vpp_test_${target}-bld.log"
67 makefile_target="^${target}:"
68 if [ -z "$(grep -e $makefile_target test/Makefile)" ] ; then
69 echo "Make test target '$target' does not exist in VPP branch '$branch'!"
73 description="'make -C test $target' in $(pwd) ($branch)"
74 echo_log " Starting $description..."
75 make WS_ROOT="$DOCKER_VPP_DIR" BR="$DOCKER_VPP_DIR/build-root" \
76 TEST_DIR="$DOCKER_VPP_DIR/test" -C test $target 2>&1 | tee -a $bld_log
77 remove_pyc_files_and_pycache_dirs
79 echo_log " Completed $description!"
82 docker_build_setup_vpp() {
83 if vpp_supported_executor_class "$EXECUTOR_CLASS" ; then
84 if [ ! -d "$DOCKER_VPP_DIR" ] ; then
85 echo_log "Cloning VPP into $DOCKER_VPP_DIR..."
86 git clone -q https://gerrit.fd.io/r/vpp $DOCKER_VPP_DIR
88 clean_git_repo $DOCKER_VPP_DIR
92 # Branches must be listed in chronological order -- oldest stable branch
93 # first and master last.
95 # Note: CI Jobs for each architecture are maintained in
96 # .../ci-management/jjb/vpp/vpp.yaml
97 # All OS's and branches are included in the 'os' and 'stream'
98 # definitions respectively, then the exclude list maintained
99 # to create an enumerated set of jobs jobs that match the
101 declare -A VPP_BRANCHES
102 VPP_BRANCHES["centos-8"]="stable/2101 stable/2106 stable/2110 master"
103 VPP_BRANCHES["debian-10"]="stable/2101 stable/2106 stable/2110 master"
104 VPP_BRANCHES["ubuntu-18.04"]="stable/2101 stable/2106 stable/2110 master"
105 VPP_BRANCHES["ubuntu-20.04"]="stable/2101 stable/2106 stable/2110 master"