1 # lib_vpp.sh - Docker build script VPP library.
4 # Copyright (c) 2023 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=yes $target' in $(pwd) ($branch)"
50 echo_log -e " Starting $description..."
51 make UNATTENDED=yes $target 2>&1 | tee -a "$bld_log"
53 echo_log " Completed $description!"
58 local branch=${2:-"master"}
59 local branchname="$(echo $branch | sed -e 's,/,_,')"
60 local bld_log="$DOCKER_BUILD_LOG_DIR"
61 bld_log="${bld_log}/$FDIOTOOLS_IMAGENAME-$branchname"
62 bld_log="${bld_log}-make_vpp_test_${target}-bld.log"
64 makefile_target="^${target}:"
65 if [ -z "$(grep -e $makefile_target test/Makefile)" ] ; then
66 echo "Make test target '$target' does not exist in VPP branch '$branch'!"
70 description="'make -C test $target' in $(pwd) ($branch)"
71 echo_log " Starting $description..."
72 make WS_ROOT="$DOCKER_VPP_DIR" BR="$DOCKER_VPP_DIR/build-root" \
73 TEST_DIR="$DOCKER_VPP_DIR/test" -C test $target 2>&1 | tee -a $bld_log
74 remove_pyc_files_and_pycache_dirs
76 echo_log " Completed $description!"
79 docker_build_setup_vpp() {
80 if vpp_supported_executor_class "$EXECUTOR_CLASS" ; then
81 if [ ! -d "$DOCKER_VPP_DIR" ] ; then
82 echo_log "Cloning VPP into $DOCKER_VPP_DIR..."
83 git clone -q https://gerrit.fd.io/r/vpp $DOCKER_VPP_DIR
85 clean_git_repo $DOCKER_VPP_DIR
89 # Branches must be listed in chronological order -- oldest stable branch
90 # first and master last.
92 # Note: CI Jobs for each architecture are maintained in
93 # .../ci-management/jjb/vpp/vpp.yaml
94 # All OS's and branches are included in the 'os' and 'stream'
95 # definitions respectively, then the exclude list maintained
96 # to create an enumerated set of jobs jobs that match the
98 declare -A VPP_BRANCHES
99 VPP_BRANCHES["debian-11"]="stable/2210 stable/2302 stable/2306 master"
100 VPP_BRANCHES["ubuntu-20.04"]="stable/2210 stable/2302 stable/2306 master"
101 VPP_BRANCHES["ubuntu-22.04"]="stable/2210 stable/2302 stable/2306 master"