Files
osmo-upf/contrib/jenkins.sh
Vadim Yanitskiy 1d422d6283 contrib/jenkins.sh: clone libnftnl and libnftables via git://
From time to time we see sporadic master build failures on Jenkins
because git fails to clone one of the repositories:

```
Cloning into 'nftables'...
error: garbage at end of loose object '0ca03ecd6ab3cfdc94f8f9ef6e3a7c40d1aa7195'
fatal: loose object 0ca03ecd6ab3cfdc94f8f9ef6e3a7c40d1aa7195
(stored in /build/libnftnl/nftables/.git/objects/0c/a03ecd6ab3cfdc94f8f9ef6e3a7c40d1aa7195) is corrupt

Cloning into 'libnftnl'...
fatal: unable to access 'https://git.netfilter.org/libnftnl/':
Failed to connect to git.netfilter.org port 443: Connection timed out
```

Running git with GIT_CURL_VERBOSE=true reveals that the server is using
an old "dumb" git protocol, so the client is sending hundreds of HTTP
requests to the server.  I also noticed that cloning via http[s]://
takes significantly more time than cloning via git://, because of the
old protocol being used.

```
$ time git clone https://git.netfilter.org/nftables
...
real    1m16.848s
user    0m4.867s
sys     0m1.883s

$ time git clone git://git.netfilter.org/nftables
...
real    0m2.453s
user    0m1.180s
sys     0m0.158s
```

According to [1], there is a more modern "smart" protocol, which is
relatively more stable and fast.  However it's not supported by the
remote server, so let's use git:// as a workaround.

[1] https://www.git-scm.com/docs/http-protocol

Change-Id: I8e943c74052cc74eae8dc1d80ab243f792a90156
2023-04-09 18:10:12 +07:00

95 lines
2.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# jenkins build helper script for osmo-upf. This is how we build on jenkins.osmocom.org
#
# environment variables:
# * WITH_MANUALS: build manual PDFs if set to "1"
# * PUBLISH: upload manuals after building if set to "1" (ignored without WITH_MANUALS = "1")
#
if ! [ -x "$(command -v osmo-build-dep.sh)" ]; then
echo "Error: We need to have scripts/osmo-deps.sh from http://git.osmocom.org/osmo-ci/ in PATH !"
exit 2
fi
set -ex
base="$PWD"
deps="$base/deps"
inst="$deps/install"
export deps inst
osmo-clean-workspace.sh
mkdir "$deps" || true
verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]")
export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH"
export LD_LIBRARY_PATH="$inst/lib"
export PATH="$inst/bin:$PATH"
osmo-build-dep.sh libosmocore "" --disable-doxygen
osmo-build-dep.sh libosmo-pfcp
osmo-build-dep.sh libgtpnl
# build libnftnl and libnftables from git.netfilter.org
build_from_netfilter() {
### TODO: enable osmo-build-dep.sh to build from git.netfilter.org URL?
project="$1"
set +x
echo
echo
echo
echo " =============================== $project ==============================="
echo
set -x
if [ -d "./$project" ]; then
rm -rf "./$project"
fi
git clone "git://git.netfilter.org/$project" "$project"
cd "$project"
autoreconf --install --force
./configure \
--prefix="$inst/stow/$project" \
--without-cli \
--disable-man-doc \
--enable-python=no
$MAKE $PARALLEL_MAKE install
STOW_DIR="$inst/stow" stow --restow $project
}
build_from_netfilter libnftnl
build_from_netfilter nftables
# Additional configure options and depends
CONFIG=""
if [ "$WITH_MANUALS" = "1" ]; then
CONFIG="--enable-manuals"
fi
set +x
echo
echo
echo
echo " =============================== osmo-upf ==============================="
echo
set -x
cd "$base"
autoreconf --install --force
./configure --enable-sanitize --enable-external-tests $CONFIG
$MAKE $PARALLEL_MAKE
LD_LIBRARY_PATH="$inst/lib" $MAKE check \
|| cat-testlogs.sh
LD_LIBRARY_PATH="$inst/lib" \
DISTCHECK_CONFIGURE_FLAGS="--enable-vty-tests --enable-external-tests $CONFIG" \
$MAKE $PARALLEL_MAKE distcheck \
|| cat-testlogs.sh
if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then
make -C "$base/doc/manuals" publish
fi
$MAKE $PARALLEL_MAKE maintainer-clean
osmo-clean-workspace.sh