From 742dbadc02af5eb256c2a350cb4a157db8e7acce Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Wed, 23 Aug 2023 12:36:37 +0200 Subject: [PATCH] Allow scan-build runs for collector --- collector/Dockerfile | 8 +++++++- collector/Makefile | 3 ++- falco-libs/Makefile | 2 +- falco-libs/compile-falco.sh | 4 ++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/collector/Dockerfile b/collector/Dockerfile index 65de137..d986b5a 100644 --- a/collector/Dockerfile +++ b/collector/Dockerfile @@ -1,4 +1,10 @@ FROM quay.io/stackrox-io/collector-builder:cache -RUN dnf install -y clang-tools-extra && \ +RUN dnf install -y \ + clang-tools-extra \ + clang-analyzer \ + podman-docker && \ dnf clean all + +# scan-view default port +EXPOSE 8181 diff --git a/collector/Makefile b/collector/Makefile index f4d01e3..82ef15f 100644 --- a/collector/Makefile +++ b/collector/Makefile @@ -23,7 +23,7 @@ docker-teardown: .PHONY: docker-deploy docker-deploy: build docker-teardown - docker run -id --privileged --name collector-builder \ + docker run -idP --privileged --name collector-builder \ --entrypoint /bin/bash \ -e CMAKE_EXPORT_COMPILE_COMMANDS="ON" \ -e DISABLE_PROFILING="true" \ @@ -34,5 +34,6 @@ docker-deploy: build docker-teardown -v /sys:/host/sys \ -v /etc:/host/etc \ -v /usr/lib:/host/usr/lib \ + -v /var/run/docker.sock:/var/run/docker.sock \ -w ${HOME}/go/src/github.com/stackrox/collector \ $(BUILDER_IMAGE) diff --git a/falco-libs/Makefile b/falco-libs/Makefile index 13eadbf..fa45bab 100644 --- a/falco-libs/Makefile +++ b/falco-libs/Makefile @@ -34,11 +34,11 @@ docker-deploy: build docker-teardown -v ${HOME}/go/src/github.com/falcosecurity/libs:${HOME}/go/src/github.com/falcosecurity/libs \ -v /usr/src:/usr/src \ -v /lib/modules:/lib/modules \ - -v /usr/include/bpf:/usr/include/bpf \ -v /dev:/host/dev \ -v /proc:/host/proc \ -v /sys:/host/sys \ -v /etc:/host/etc \ -v /usr/lib:/host/usr/lib \ -v /var/run/docker.sock:/var/run/docker.sock \ + -v /run/podman/podman.sock:/run/podman/podman.sock \ quay.io/mmoltras/devcontainers:falco-libs-$(FALCO_BUILDER_FLAVOR) diff --git a/falco-libs/compile-falco.sh b/falco-libs/compile-falco.sh index 2dda03b..56c432f 100755 --- a/falco-libs/compile-falco.sh +++ b/falco-libs/compile-falco.sh @@ -16,10 +16,13 @@ function clean () { function configure () { # sanitizers="-fsanitize=address -fsanitize=undefined" use_bundled_libbpf="OFF" + build_shared_libs="OFF" if [[ "${FALCO_BUILDER_FLAVOR:-fedora}" != "fedora" ]] ; then # Platform dependent adjustments use_bundled_libbpf="ON" + else + build_shared_libs="ON" fi mkdir -p "${FALCO_DIR}/build" @@ -33,6 +36,7 @@ function configure () { -DUSE_BUNDLED_ZLIB=ON \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ -DCREATE_TEST_TARGETS=ON \ + -DBUILD_SHARED_LIBS="${build_shared_libs}" \ -S "${FALCO_DIR}" \ -B "${FALCO_DIR}/build" }