Merge "vpp-hst: add VPP HostStack Test framework jobs"
[ci-management.git] / docker / scripts / dbld_vpp_install_packages.sh
1 #! /bin/bash
2
3 # Copyright (c) 2024 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 set -euxo pipefail
17
18 export CIMAN_DOCKER_SCRIPTS=${CIMAN_DOCKER_SCRIPTS:-"$(dirname "${BASH_SOURCE[0]}")"}
19 . "$CIMAN_DOCKER_SCRIPTS/lib_vpp.sh"
20 . "$CIMAN_DOCKER_SCRIPTS/lib_apt.sh"
21
22 must_be_run_in_docker_build
23
24 echo_log
25 if ! vpp_supported_executor_class "$FDIOTOOLS_EXECUTOR_CLASS" ; then
26     echo_log "VPP is not supported on executor class '$FDIOTOOLS_EXECUTOR_CLASS'. Skipping $(basename "$0")..."
27     exit 0
28 else
29     echo_log "Starting  $(basename "$0")"
30 fi
31
32 do_git_config vpp
33 for branch in ${VPP_BRANCHES[$OS_NAME]} ; do
34     do_git_branch "$branch"
35
36     # Install hs-test depndencies
37     if [ "$OS_NAME" = "ubuntu-22.04" ] && [ "$branch" = "master" ] ; then
38         install_hst_deps "$branch"
39     fi
40
41     # Install OS packages
42     make_vpp "install-deps" "$branch"
43
44     # Download, build, and cache external deps packages
45     make_vpp "install-ext-deps" "$branch"
46     vpp_ext_dir="$DOCKER_VPP_DIR/build/external"
47     rsync -ac $vpp_ext_dir/downloads/. $DOCKER_DOWNLOADS_DIR || true
48     if which apt >/dev/null ; then
49         vpp_ext_deps_pkg=$vpp_ext_dir/$(dpkg -l vpp-ext-deps 2>/dev/null | mawk '/vpp-ext-deps/{print $2"_"$3"_"$4".deb"}')
50     else
51         echo "ERROR: Package Manager not installed!"
52         exit 1
53     fi
54     if [ -f "$vpp_ext_deps_pkg" ] ; then
55         cp -f "$vpp_ext_deps_pkg" $DOCKER_DOWNLOADS_DIR
56     else
57         echo "ERROR: Missing VPP external deps package: '$vpp_ext_deps_pkg'"
58         exit 1
59     fi
60     # TODO: remove this after all supported VPP branches have removed
61     # python3-virtualenv & virtualenv from install-deps which are no longer
62     # used in vpp repo.  These packages can mess up csit virtualenv
63     # installation which uses pip3
64     sudo apt remove -y --purge --autoremove python3-virtualenv virtualenv || true
65
66     # Install/cache python packages
67     make_vpp_test "test-dep" "$branch"
68     if [ "$OS_ID" = "ubuntu" ] ; then
69         make_vpp test-wipe "$branch"
70     fi
71     # Clean up virtual environment
72     git checkout -q -- .
73     git clean -qfdx
74
75     # Dump packages installed
76     case "$DOCKERFILE_FROM" in
77         *ubuntu*)
78             dump_apt_package_list "$branch" ;;
79         *debian*)
80             dump_apt_package_list "$branch" ;;
81     esac
82 done
83
84 echo_log -e "Completed $(basename "$0")!\n\n=========="