diff mbox series

[ovs-dev,dpdk-latest,1/2] ci: Cache DPDK installed libraries only.

Message ID 20231122121612.861939-1-david.marchand@redhat.com
State Accepted
Delegated to: Simon Horman
Headers show
Series [ovs-dev,dpdk-latest,1/2] ci: Cache DPDK installed libraries only. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

David Marchand Nov. 22, 2023, 12:16 p.m. UTC
Rather than save the whole DPDK sources and build artefacts, checkout
sources in a separate directory and build DPDK there.
Only the installed artefacts are then going to the cache.
Example sources in the share/dpdk installed directory can be pruned too.

This makes a (v23.11-rc3) DPDK cache entry size go from ~120MB to ~7MB.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 .ci/dpdk-build.sh  | 25 +++++++++++++++----------
 .ci/linux-build.sh |  9 +++++----
 2 files changed, 20 insertions(+), 14 deletions(-)

Comments

Simon Horman Nov. 23, 2023, 10:33 a.m. UTC | #1
On Wed, Nov 22, 2023 at 01:16:11PM +0100, David Marchand wrote:
> Rather than save the whole DPDK sources and build artefacts, checkout
> sources in a separate directory and build DPDK there.
> Only the installed artefacts are then going to the cache.
> Example sources in the share/dpdk installed directory can be pruned too.
> 
> This makes a (v23.11-rc3) DPDK cache entry size go from ~120MB to ~7MB.

Very nice.

> Signed-off-by: David Marchand <david.marchand@redhat.com>

Acked-by: Simon Horman <horms@ovn.org>
Simon Horman Nov. 24, 2023, 11:25 a.m. UTC | #2
On Wed, Nov 22, 2023 at 01:16:11PM +0100, David Marchand wrote:
> Rather than save the whole DPDK sources and build artefacts, checkout
> sources in a separate directory and build DPDK there.
> Only the installed artefacts are then going to the cache.
> Example sources in the share/dpdk installed directory can be pruned too.
> 
> This makes a (v23.11-rc3) DPDK cache entry size go from ~120MB to ~7MB.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Thanks David,

series applied to dpdk-latest

- ci: Reduce optional libraries in DPDK.
  https://github.com/openvswitch/ovs/commit/0e7a78472aa0
- ci: Cache DPDK installed libraries only.
  https://github.com/openvswitch/ovs/commit/9c988b276d64
diff mbox series

Patch

diff --git a/.ci/dpdk-build.sh b/.ci/dpdk-build.sh
index aa83e44643..8380c48637 100755
--- a/.ci/dpdk-build.sh
+++ b/.ci/dpdk-build.sh
@@ -5,25 +5,27 @@  set -x
 
 function build_dpdk()
 {
-    local VERSION_FILE="dpdk-dir/cached-version"
     local DPDK_VER=$1
     local DPDK_OPTS=""
+    local DPDK_INSTALL_DIR="$(pwd)/dpdk-dir"
+    local VERSION_FILE="$DPDK_INSTALL_DIR/cached-version"
 
-    rm -rf dpdk-dir
+    rm -rf dpdk-src
+    rm -rf $DPDK_INSTALL_DIR
 
     if [ "${DPDK_VER##refs/*/}" != "${DPDK_VER}" ]; then
-        git clone --single-branch $DPDK_GIT dpdk-dir -b "${DPDK_VER##refs/*/}"
-        pushd dpdk-dir
+        git clone --single-branch $DPDK_GIT dpdk-src -b "${DPDK_VER##refs/*/}"
+        pushd dpdk-src
         git log -1 --oneline
     else
         wget https://fast.dpdk.org/rel/dpdk-$1.tar.xz
         tar xvf dpdk-$1.tar.xz > /dev/null
         DIR_NAME=$(tar -tf dpdk-$1.tar.xz | head -1 | cut -f1 -d"/")
-        mv ${DIR_NAME} dpdk-dir
-        pushd dpdk-dir
+        mv ${DIR_NAME} dpdk-src
+        pushd dpdk-src
     fi
 
-    # Switching to 'default' machine to make dpdk-dir cache usable on
+    # Switching to 'default' machine to make the dpdk cache usable on
     # different CPUs. We can't be sure that all CI machines are exactly same.
     DPDK_OPTS="$DPDK_OPTS -Dmachine=default"
 
@@ -42,14 +44,17 @@  function build_dpdk()
     DPDK_OPTS="$DPDK_OPTS -Denable_drivers=$enable_drivers"
 
     # Install DPDK using prefix.
-    DPDK_OPTS="$DPDK_OPTS --prefix=$(pwd)/build"
+    DPDK_OPTS="$DPDK_OPTS --prefix=$DPDK_INSTALL_DIR"
 
     meson $DPDK_OPTS build
     ninja -C build
     ninja -C build install
-
-    echo "Installed DPDK in $(pwd)"
     popd
+
+    # Remove examples sources.
+    rm -rf $DPDK_INSTALL_DIR/share/dpdk/examples
+
+    echo "Installed DPDK in $DPDK_INSTALL_DIR"
     echo "${DPDK_VER}" > ${VERSION_FILE}
 }
 
diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index 170f4730f3..ea1e6599f4 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -12,8 +12,9 @@  EXTRA_OPTS="--enable-Werror"
 
 function install_dpdk()
 {
-    local VERSION_FILE="dpdk-dir/cached-version"
-    local DPDK_LIB=$(pwd)/dpdk-dir/build/lib/x86_64-linux-gnu
+    local DPDK_INSTALL_DIR="$(pwd)/dpdk-dir"
+    local VERSION_FILE="${DPDK_INSTALL_DIR}/cached-version"
+    local DPDK_LIB=${DPDK_INSTALL_DIR}/lib/x86_64-linux-gnu
 
     if [ "$DPDK_SHARED" ]; then
         EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=shared"
@@ -29,13 +30,13 @@  function install_dpdk()
     export PATH=$(pwd)/dpdk-dir/build/bin:$PATH
 
     if [ ! -f "${VERSION_FILE}" ]; then
-        echo "Could not find DPDK in $(pwd)/dpdk-dir"
+        echo "Could not find DPDK in $DPDK_INSTALL_DIR"
         return 1
     fi
 
     # Update the library paths.
     sudo ldconfig
-    echo "Found cached DPDK $(cat ${VERSION_FILE}) build in $(pwd)/dpdk-dir"
+    echo "Found cached DPDK $(cat ${VERSION_FILE}) build in $DPDK_INSTALL_DIR"
 }
 
 function configure_ovs()