1 # lib_vpp.sh - Docker build script VPP library.
4 # Copyright (c) 2024 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[0]}")"}
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
36 local branch=${1:-"master"}
37 local branchname=${branch/\//_}
38 local hst_dir="./extras/hs-test"
39 local bld_log="$DOCKER_BUILD_LOG_DIR"
40 bld_log="${bld_log}/$FDIOTOOLS_IMAGENAME-$branchname"
41 bld_log="${bld_log}-install_hst_deps_bld.log"
43 if [ -d "$hst_dir" ] ; then
44 make -C "$hst_dir" install-deps 2>&1 | tee -a "$bld_log"
50 local branch=${2:-"master"}
51 local branchname=${branch/\//_}
52 local bld_log="$DOCKER_BUILD_LOG_DIR"
53 bld_log="${bld_log}/$FDIOTOOLS_IMAGENAME-$branchname"
54 bld_log="${bld_log}-make_vpp_${target}-bld.log"
56 makefile_target="^${target}:"
57 if [ -z "$(grep $makefile_target Makefile)" ] ; then
58 echo "Make target '$target' does not exist in VPP branch '$branch'!"
62 description="'make UNATTENDED=yes $target' in $(pwd) ($branch)"
63 echo_log -e " Starting $description..."
64 make UNATTENDED=yes "$target" 2>&1 | tee -a "$bld_log"
66 echo_log " Completed $description!"
71 local branch=${2:-"master"}
72 local branchname=${branch/\//_}
73 local bld_log="$DOCKER_BUILD_LOG_DIR"
74 bld_log="${bld_log}/$FDIOTOOLS_IMAGENAME-$branchname"
75 bld_log="${bld_log}-make_vpp_test_${target}-bld.log"
77 makefile_target="^${target}:"
78 if [ -z "$(grep -e $makefile_target test/Makefile)" ] ; then
79 echo "Make test target '$target' does not exist in VPP branch '$branch'!"
83 description="'make -C test $target' in $(pwd) ($branch)"
84 echo_log " Starting $description..."
85 make WS_ROOT="$DOCKER_VPP_DIR" BR="$DOCKER_VPP_DIR/build-root" \
86 TEST_DIR="$DOCKER_VPP_DIR/test" -C test $target 2>&1 | tee -a $bld_log
87 remove_pyc_files_and_pycache_dirs
89 echo_log " Completed $description!"
92 docker_build_setup_vpp() {
93 if vpp_supported_executor_class "$EXECUTOR_CLASS" ; then
94 if [ ! -d "$DOCKER_VPP_DIR" ] ; then
95 echo_log "Cloning VPP into $DOCKER_VPP_DIR..."
96 git clone -q https://gerrit.fd.io/r/vpp $DOCKER_VPP_DIR
98 clean_git_repo $DOCKER_VPP_DIR
102 # Branches must be listed in chronological order -- oldest stable branch
103 # first and master last.
105 # Note: CI Jobs for each architecture are maintained in
106 # .../ci-management/jjb/vpp/vpp.yaml
107 # All OS's and branches are included in the 'os' and 'stream'
108 # definitions respectively, then the exclude list maintained
109 # to create an enumerated set of jobs jobs that match the
111 declare -A VPP_BRANCHES
112 VPP_BRANCHES["debian-11"]="stable/2310 stable/2402 master"
113 VPP_BRANCHES["ubuntu-20.04"]="stable/2310 stable/2402 master"
114 VPP_BRANCHES["ubuntu-22.04"]="stable/2310 stable/2402 master"