Add stable/2402 branch and remove stable/2306 branch to docker executor image scripts
[ci-management.git] / docker / scripts / lib_apt.sh
index af9da0b..6cf37ae 100644 (file)
@@ -1,7 +1,7 @@
 # lib_apt.sh - Docker build script apt library.
 #              For import only.
 
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2023 Cisco and/or its affiliates.
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at:
@@ -35,25 +35,10 @@ apt_install_packages() {
             --allow-change-held-packages $@
 }
 
-# Used for older OS distro's which are incompatible
-# with modern distro cmake vesrion
-apt_override_cmake_install_with_pip3_version() {
-    local os_cmake="/usr/bin/cmake"
-    local os_cmake_ver="$($os_cmake --version | head -1)"
-    local pip3_cmake="/usr/local/bin/cmake"
-
-    python3 -m pip --disable-pip-version-check install cmake || true
-    local pip3_cmake_ver="$($pip3_cmake --version | head -1)"
-    echo_log "Overriding $OS_NAME '$os_cmake_ver' with '$pip3_cmake_ver'!"
-    apt-get remove -y cmake --autoremove || true
-    update-alternatives --quiet --remove-all cmake || true
-    update-alternatives --quiet --install "$os_cmake" cmake "$pip3_cmake" 100
-    echo_log "Default cmake ($(which cmake)) version: '$(cmake --version | head -1)'!"
-}
-
 generate_apt_dockerfile_common() {
     local executor_class="$1"
     local executor_image="$2"
+    local dpkg_arch="$(dpkg --print-architecture)"
 
     cat <<EOF >>"$DOCKERFILE"
 
@@ -111,31 +96,14 @@ ENV LANG="en_US.UTF-8" LANGUAGE="en_US" LC_ALL="en_US.UTF-8"
 #        build-essential
 #
 # TODO:  Fix broken project requirement install targets
-#        graphviz         for 'make bootstrap-doxygen' (VPP)
-#        doxygen          for 'make doxygen' (VPP)
-#        enchant          for 'make docs' (VPP)
+#        graphviz         for doxygen (HICN)
+#        doxygen          for doxygen (HICN)
 #        libffi-dev       for python cffi install (Ubuntu20.04/VPP/aarch64)
 #        liblapack-dev    for python numpy/scipy (CSIT/aarch64)
 #        libopenblas-dev  for python numpy/scipy (CSIT/aarch64)
 #        libpcap-dev      for python pypcap install (CSIT)
 #        sshpass          for CSIT jobs
 #
-#        From .../csit/resources/tools/presentation/run_report_*.sh:
-#        libxml2
-#        libxml2-dev
-#        libxslt-dev
-#        build-essential
-#        zlib1g-dev
-#        unzip
-#        xvrb
-#        texlive-latex-recommended
-#        texlive-fonts-recommended
-#        texlive-fonts-extra
-#        texlive-latex-extra
-#        latexmk
-#        wkhtmltopdf
-#        inkscape
-#
 RUN apt-get update -qq \\
   && apt-get install -y \\
              apt-transport-https \\
@@ -145,7 +113,6 @@ RUN apt-get update -qq \\
              default-jre \\
              dnsutils \\
              doxygen \\
-             enchant \\
              emacs \\
              facter \\
              gawk \\
@@ -155,21 +122,16 @@ RUN apt-get update -qq \\
              git-review \\
              gnupg-agent \\
              graphviz \\
-             inkscape \\
              iproute2 \\
              iputils-clockdiff \\
              iputils-ping \\
              iputils-tracepath \\
              jq \\
-             latexmk \\
              libffi-dev \\
              liblapack-dev \\
              libopenblas-dev \\
              libpcap-dev \\
-             libxml2 \\
-             libxml2-dev \\
              libxml-xpath-perl \\
-             libxslt-dev \\
              make \\
              python3-pip \\
              python3-venv \\
@@ -177,26 +139,25 @@ RUN apt-get update -qq \\
              ruby-dev \\
              software-properties-common \\
              sshpass \\
+             sysstat \\
              sudo \\
-             texlive-fonts-extra \\
-             texlive-fonts-recommended \\
-             texlive-latex-extra \\
-             texlive-latex-recommended \\
              traceroute \\
              tree \\
-             unzip \\
              vim \\
              wget \\
-             wkhtmltopdf \\
              xmlstarlet \\
-             xvfb \\
              xz-utils \\
-             zlib1g-dev \\
   && curl -L https://packagecloud.io/fdio/master/gpgkey | apt-key add - \\
   && curl -s https://packagecloud.io/install/repositories/fdio/master/script.deb.sh | bash \\
-  && curl -fsSL https://get.docker.com | sh \\
   && rm -r /var/lib/apt/lists/*
 
+# Install terraform for CSIT
+#
+RUN wget https://releases.hashicorp.com/terraform/1.7.3/terraform_1.7.3_linux_$dpkg_arch.zip \\
+  && unzip terraform_1.7.3_linux_$dpkg_arch.zip \\
+  && mv terraform /usr/bin \\
+  && rm -f terraform_1.7.3_linux_$dpkg_arch.zip
+
 # Install packages for all project branches
 #
 RUN apt-get update -qq \\
@@ -211,7 +172,7 @@ generate_apt_dockerfile_clean() {
 
 # Clean up copy-in build tree
 RUN dbld_dump_build_logs.sh \\
-  && rm -rf "/tmp/*" "$DOCKER_BUILD_FILES_DIR"
+  && rm -rf "/tmp/*" "$DOCKER_BUILD_FILES_DIR" "/root/.ccache"
 EOF
 }
 
@@ -222,10 +183,6 @@ builder_generate_apt_dockerfile() {
     local executor_image="$3"
     local vpp_install_skip_sysctl_envvar="";
 
-    if grep -q "debian-9"  <<< "$executor_os_name" ; then
-        # Workaround to VPP package installation failure on debian-9
-        vpp_install_skip_sysctl_envvar="ENV VPP_INSTALL_SKIP_SYSCTL=1"
-    fi
     generate_apt_dockerfile_common $executor_class $executor_image
     csit_builder_generate_docker_build_files
     cat <<EOF >>"$DOCKERFILE"
@@ -250,6 +207,7 @@ WORKDIR /
 $vpp_install_skip_sysctl_envvar
 ENV VPP_ZOMBIE_NOCHECK="1"
 ENV CCACHE_DIR="/scratch/ccache"
+ENV CCACHE_MAXSIZE="10G"
 EOF
     generate_apt_dockerfile_clean
 }