Skip to content

Commit cc7335e

Browse files
0xB10CMacroFake
andcommitted
ci: run USDT interface test in a VM
Our CI tasks are run by CirrusCI in Docker containers in a Google Compute Engine based Kubernetes environment. These containers have limited capabilities - especially CAP_SYS_ADMIN is missing. See bitcoin#23296 (comment) We need elevated privileges to hook into the USDT tracepoints. We use a CirrusCI "compute_engine_instance" (a VM, not a container) where we have the required privileges. The ubunut-mininmal-2204-lts was choosen with debian-11 being an alternative. Both pack an outdated 'bpfcc-tools' package (v0.18.0) from 2020. This version prints warnings to stderr during BPF bytecode compilation, which causes our functional test runner to fail. This is fixed in newer verison. Until debian-12 or a newer Ubuntu release is avaliable as image in GCE (https://cloud.google.com/compute/docs/images/os-details), we use a third-party and untrusted PPA that releases up-to-date versions of the package. The official iovisor (authors of BCC) PPA is outdated too. An alternative would be to compile BCC from source in the CI. Co-authored-by: MacroFake <[email protected]>
1 parent dba6f82 commit cc7335e

File tree

4 files changed

+28
-7
lines changed

4 files changed

+28
-7
lines changed

.cirrus.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,20 @@ task:
259259
MAKEJOBS: "-j4" # Avoid excessive memory use due to MSan
260260

261261
task:
262-
name: '[ASan + LSan + UBSan + integer, no depends] [jammy]'
262+
name: '[ASan + LSan + UBSan + integer, no depends, USDT] [jammy]'
263263
<< : *GLOBAL_TASK_TEMPLATE
264-
container:
265-
image: ubuntu:jammy
264+
# We can't use a 'container' for the USDT interface tests as the CirrusCI
265+
# containers don't have privileges to hook into bitcoind. CirrusCI uses
266+
# Google Compute Engine instances: https://cirrus-ci.org/guide/custom-vms/
267+
# Images can be found here: https://cloud.google.com/compute/docs/images/os-details
268+
compute_engine_instance:
269+
image_project: ubuntu-os-cloud
270+
image: family/ubuntu-2204-lts # when upgrading, check if we can drop "ADD_UNTRUSTED_BPFCC_PPA"
271+
cpu: 4
272+
memory: 12G
266273
env:
267274
<< : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
275+
HOME: /root/ # Only needed for compute_engine_instance
268276
FILE_ENV: "./ci/test/00_setup_env_native_asan.sh"
269277
MAKEJOBS: "-j4" # Avoid excessive memory use
270278

ci/test/00_setup_env_native_asan.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@
66

77
export LC_ALL=C.UTF-8
88

9+
# We install an up-to-date 'bpfcc-tools' package from an untrusted PPA.
10+
# This can be dropped with the next Ubuntu or Debian release that includes up-to-date packages.
11+
# See the if-then in ci/test/04_install.sh too.
12+
export ADD_UNTRUSTED_BPFCC_PPA=true
13+
914
export CONTAINER_NAME=ci_native_asan
10-
export PACKAGES="clang llvm python3-zmq qtbase5-dev qttools5-dev-tools libevent-dev bsdmainutils libboost-dev libdb5.3++-dev libminiupnpc-dev libnatpmp-dev libzmq3-dev libqrencode-dev libsqlite3-dev"
11-
export DOCKER_NAME_TAG=ubuntu:22.04
15+
export PACKAGES="systemtap-sdt-dev bpfcc-tools clang llvm python3-zmq qtbase5-dev qttools5-dev-tools libevent-dev bsdmainutils libboost-dev libdb5.3++-dev libminiupnpc-dev libnatpmp-dev libzmq3-dev libqrencode-dev libsqlite3-dev"
16+
export DOCKER_NAME_TAG=ubuntu:22.04 # May not run in docker unless --enable-usdt is dropped
1217
export NO_DEPENDS=1
1318
export GOAL="install"
14-
export BITCOIN_CONFIG="--enable-c++20 --enable-zmq --with-incompatible-bdb --with-gui=qt5 CPPFLAGS='-DARENA_DEBUG -DDEBUG_LOCKORDER' --with-sanitizers=address,integer,undefined CC=clang CXX=clang++"
19+
export BITCOIN_CONFIG="--enable-usdt --enable-zmq --with-incompatible-bdb --with-gui=qt5 CPPFLAGS='-DARENA_DEBUG -DDEBUG_LOCKORDER' --with-sanitizers=address,integer,undefined CC=clang CXX=clang++"

ci/test/00_setup_env_native_tidy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ export RUN_FUNCTIONAL_TESTS=false
1515
export RUN_FUZZ_TESTS=false
1616
export RUN_TIDY=true
1717
export GOAL="install"
18-
export BITCOIN_CONFIG="CC=clang CXX=clang++ --with-incompatible-bdb --disable-hardening CFLAGS='-O0 -g0' CXXFLAGS='-O0 -g0'"
18+
export BITCOIN_CONFIG="CC=clang CXX=clang++ --enable-c++20 --with-incompatible-bdb --disable-hardening CFLAGS='-O0 -g0' CXXFLAGS='-O0 -g0'"
1919
export CCACHE_SIZE=200M

ci/test/04_install.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ if [[ $DOCKER_NAME_TAG == *centos* ]]; then
6868
${CI_RETRY_EXE} CI_EXEC dnf -y install epel-release
6969
${CI_RETRY_EXE} CI_EXEC dnf -y --allowerasing install "$DOCKER_PACKAGES" "$PACKAGES"
7070
elif [ "$CI_USE_APT_INSTALL" != "no" ]; then
71+
if [[ "${ADD_UNTRUSTED_BPFCC_PPA}" == "true" ]]; then
72+
# Ubuntu 22.04 LTS and Debian 11 both have an outdated bpfcc-tools packages.
73+
# The iovisor PPA is outdated as well. The next Ubuntu and Debian releases will contain updated
74+
# packages. Meanwhile, use an untrusted PPA to install an up-to-date version of the bpfcc-tools
75+
# package.
76+
# TODO: drop this once we can use newer images in GCE
77+
CI_EXEC add-apt-repository ppa:hadret/bpfcc
78+
fi
7179
${CI_RETRY_EXE} CI_EXEC apt-get update
7280
${CI_RETRY_EXE} CI_EXEC apt-get install --no-install-recommends --no-upgrade -y "$PACKAGES" "$DOCKER_PACKAGES"
7381
if [ -n "$PIP_PACKAGES" ]; then

0 commit comments

Comments
 (0)