1 # lib_dnf.sh - Docker build script dnf library.
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:
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_dnf_imported 2> /dev/null)" ] ; then
21 alias lib_dnf_imported=true
23 export CIMAN_DOCKER_SCRIPTS=${CIMAN_DOCKER_SCRIPTS:-"$(dirname $BASH_SOURCE)"}
24 . $CIMAN_DOCKER_SCRIPTS/lib_common.sh
26 dump_dnf_package_list() {
27 branchname="$(echo $branch | sed -e 's,/,_,')"
28 dnf list installed > \
29 "$DOCKER_BUILD_LOG_DIR/$FDIOTOOLS_IMAGENAME-$branchname-dnf-packages.log"
32 dnf_install_packages() {
36 dnf_install_docker_os_package_dependancies() {
37 dnf_install_packages dnf-utils
40 dnf_install_docker() {
41 # Note: Support for docker has been removed starting with centos-8, so the
42 # only recourse is to pin the latest version by what's in the download dir.
43 # Browse the base URL to see what is available & update accordingly.
45 if [ "$OS_NAME" = "centos-8" ] ; then
46 dnf install -y https://download.docker.com/linux/$OS_ID/$OS_VERSION_ID/$OS_ARCH/stable/Packages/containerd.io-1.3.7-3.1.el8.$OS_ARCH.rpm
47 dnf install -y https://download.docker.com/linux/$OS_ID/$OS_VERSION_ID/$OS_ARCH/stable/Packages/docker-ce-cli-19.03.13-3.el8.$OS_ARCH.rpm
48 dnf install -y https://download.docker.com/linux/$OS_ID/$OS_VERSION_ID/$OS_ARCH/stable/Packages/docker-ce-19.03.13-3.el8.$OS_ARCH.rpm
50 echo_log "WARNING: Docker Image unknown for $OS_NAME!"
54 generate_dnf_dockerfile() {
55 local executor_os_name=$1
57 local executor_image=$3
58 local from_image_os_id="$(echo $from_image | cut -d: -f2)"
60 cat <<EOF >$DOCKERFILE
61 FROM $from_image AS executor-image
62 LABEL Description="FD.io CI executor docker image for $executor_os_name/$OS_ARCH"
64 LABEL Version="$DOCKER_TAG"
66 # Build Environment Variables
67 ENV FDIOTOOLS_IMAGE=$executor_image
69 ENV CIMAN_ROOT="$DOCKER_CIMAN_ROOT"
70 ENV PATH=$PATH:$DOCKER_CIMAN_ROOT/docker/scripts
72 # Copy-in build tree containing
73 # ci-management, vpp, & csit git repos
74 WORKDIR $DOCKER_BUILD_DIR
77 # Install baseline packages (minimum build & utils).
79 # ci-management global-jjb requirements:
85 # from global-jjb/packer/provision/baseline.sh:
97 # TODO: Fix broken project requirement install targets
99 # graphviz for 'make bootstrap-doxygen' (VPP)
100 # doxygen for 'make doxygen' (VPP)
101 # enchant for 'make docs' (VPP)
102 # libffi-devel for python cffi install (Ubuntu20.04/VPP/aarch64)
103 # libpcap-devel for python pypcap install (CSIT)
104 # lapack-devel for python numpy/scipy (CSIT/aarch64)
105 # openblas-devel for python numpy/scipy (CSIT/aarch64)
107 RUN export LC_ALL=C.UTF8 \\
112 && dnf config-manager --set-enabled \$(dnf repolist all 2> /dev/null | grep -i powertools | cut -d' ' -f1) --set-enabled epel \\
113 && dnf repolist all \\
115 RUN export LC_ALL=C.UTF8 \\
127 java-1.8.0-openjdk \\
128 java-1.8.0-openjdk-devel \\
154 # Install OS packages for project branches
156 RUN dbld_vpp_install_packages.sh \\
157 && dbld_install_docker.sh \\
158 && dbld_csit_install_packages.sh \\
159 && dbld_lfit_requirements.sh \\
162 # CI Runtime Environment
164 ENV VPP_ZOMBIE_NOCHECK=1
165 RUN gem install package_cloud \\
166 && curl -s https://packagecloud.io/install/repositories/fdio/master/script.rpm.sh | sudo bash
169 RUN dbld_dump_build_logs.sh \\