Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
- add back json array format for collector entrypoint
- specify full include path for collector/Version.h
- auto-detect platform arch
- specify arch in builder image name and cmake-dir
  • Loading branch information
robbycochran committed Sep 4, 2024
1 parent 21f8685 commit c7ab8ae
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ falcosecurity-libs/cmake-build-rhel
kernel-modules/kobuild-tmp
utilities/PerformanceTesting/TestResults
cmake-build/
cmake-build-*/

# Mac OS hidden file
.DS_Store
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ image: collector unittest

image-dev: collector unittest container-dockerfile-dev
make -C collector txt-files
docker build --build-arg collector_version="$(COLLECTOR_TAG)" \
docker buildx build --load --platform ${PLATFORM} \
--build-arg COLLECTOR_VERSION="$(COLLECTOR_TAG)" \
--build-arg BUILD_TYPE=devel \
-f collector/container/Dockerfile.dev \
-t quay.io/stackrox-io/collector:$(COLLECTOR_TAG) \
Expand Down Expand Up @@ -99,8 +100,9 @@ teardown-builder:

.PHONY: clean
clean:
rm -rf cmake-build/
rm -rf cmake-build*
make -C collector clean
make -C integration-tests docker-clean

.PHONY: shfmt-check
shfmt-check:
Expand Down
20 changes: 11 additions & 9 deletions Makefile-constants.mk
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@

ifeq ($(COLLECTOR_BUILDER_TAG),)
COLLECTOR_BUILDER_TAG=master
endif

ifeq ($(COLLECTOR_TAG),)
ifeq ($(CIRCLE_TAG),)
COLLECTOR_TAG=$(shell git describe --tags --abbrev=10 --dirty)
else
COLLECTOR_TAG := $(CIRCLE_TAG)
endif

DOCKER_CLI := $(shell command -v docker 2>/dev/null)

ifeq ($(DOCKER_CLI),)
$(error "docker is required for building")
endif

HOST_ARCH := $(shell docker system info --format '{{.Architecture}}')
PLATFORM ?= "linux/$(HOST_ARCH)"

USE_VALGRIND ?= false
ADDRESS_SANITIZER ?= false
CMAKE_BUILD_TYPE ?= Release
PLATFORM ?= linux/amd64
CMAKE_BUILD_TYPE ?= release
CMAKE_BASE_DIR = cmake-build-$(CMAKE_BUILD_TYPE)-$(HOST_ARCH)
TRACE_SINSP_EVENTS ?= false
DISABLE_PROFILING ?= false
BPF_DEBUG_MODE ?= false

COLLECTOR_BUILD_CONTEXT = collector/
COLLECTOR_BUILDER_NAME ?= collector_builder

export COLLECTOR_PRE_ARGUMENTS
COLLECTOR_BUILDER_NAME ?= collector_builder_$(HOST_ARCH)
15 changes: 3 additions & 12 deletions collector/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ COLLECTOR_BIN_DIR = $(CMAKE_DIR)/collector
LIBSINSP_BIN_DIR = $(CMAKE_DIR)/collector/EXCLUDE_FROM_DEFAULT_BUILD/libsinsp
SRC_MOUNT_DIR = /tmp/collector

HDRS := $(wildcard lib/*.h) $(shell find falcosecurity-libs/userspace -name '*.h')
HDRS := $(wildcard lib/*.h) $(shell find $(BASE_PATH)/falcosecurity-libs/userspace -name '*.h')

SRCS := $(wildcard lib/*.cpp) collector.cpp

COLLECTOR_BUILD_DEPS := $(HDRS) $(SRCS) $(shell find falcosecurity-libs -name '*.h' -o -name '*.cpp' -o -name '*.c')
COLLECTOR_BUILD_DEPS := $(HDRS) $(SRCS) $(shell find $(BASE_PATH)/falcosecurity-libs -name '*.h' -o -name '*.cpp' -o -name '*.c')

.SUFFIXES:

Expand Down Expand Up @@ -65,17 +65,8 @@ txt-files:

.PHONY: clean
clean:
docker rm -fv build_collector || true
docker rm -fv container-stats benchmark collector grpc-server || true
rm -rf falcosecurity-libs/cmake-build
rm -rf falcosecurity-libs/falcosecurity-libs-build
rm -rf container/LICENSE-kernel-modules.txt
rm -rf container/bin
rm -rf container/driver
rm -rf container/libs
rm -rf container/rhel/scripts
rm -rf container/rhel/bundle.tar.gz
rm -rf container/devel/scripts
rm -rf container/devel/bundle.tar.gz
rm -rf container/THIRD_PARTY_NOTICES
rm -f container/Dockerfile.dev

Expand Down
8 changes: 4 additions & 4 deletions collector/Version.h.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef _VERSION_H_
#define _VERSION_H_
#ifndef _COLLECTOR_VERSION_H_
#define _COLLECTOR_VERSION_H_

#define COLLECTOR_VERSION "${COLLECTOR_VERSION}"
#define COLLECTOR_VERSION "@COLLECTOR_VERSION@"

inline const char* GetCollectorVersion() {
return COLLECTOR_VERSION;
}

#endif // _VERSION_H_
#endif // _COLLECTOR_VERSION_H_
2 changes: 1 addition & 1 deletion collector/collector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ extern "C" {
#include "LogLevel.h"
#include "Logging.h"
#include "Utility.h"
#include "Version.h"
#include "collector/Version.h"

static const int MAX_GRPC_CONNECTION_POLLS = 30;

Expand Down
2 changes: 1 addition & 1 deletion collector/container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ HEALTHCHECK \
# the command uses /ready API
CMD /usr/local/bin/status-check.sh

ENTRYPOINT collector
ENTRYPOINT ["collector"]
2 changes: 1 addition & 1 deletion collector/container/konflux.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ COPY --from=builder ${CMAKE_BUILD_DIR}/collector/self-checks /usr/local/bin/

EXPOSE 8080 9090

ENTRYPOINT collector
ENTRYPOINT ["collector"]

LABEL \
com.redhat.component="rhacs-collector-container" \
Expand Down

0 comments on commit c7ab8ae

Please sign in to comment.