Skip to content

Commit

Permalink
ci: Cache DPDK installed libraries only.
Browse files Browse the repository at this point in the history
Rather than save the whole DPDK sources and build artefacts, checkout
sources in a separate directory. 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 DPDK cache entry size go from ~80MB to ~4MB.

Signed-off-by: David Marchand <[email protected]>
  • Loading branch information
david-marchand committed Oct 16, 2023
1 parent e60ab41 commit f19e7a2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
25 changes: 15 additions & 10 deletions .ci/dpdk-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -40,14 +42,17 @@ function build_dpdk()
DPDK_OPTS="$DPDK_OPTS -Ddisable_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}
}

Expand Down
9 changes: 5 additions & 4 deletions .ci/linux-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -26,13 +27,13 @@ function install_dpdk()
export PKG_CONFIG_PATH=$DPDK_LIB/pkgconfig/:$PKG_CONFIG_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()
Expand Down

0 comments on commit f19e7a2

Please sign in to comment.