Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,14 @@ pkg_check_modules(CZMQ REQUIRED libczmq)
pkg_check_modules(JSONC REQUIRED json-c)

if(WITH_MONGODB)
pkg_check_modules(MONGOC REQUIRED libmongoc-1.0)
find_package(mongoc NAMES mongoc mongoc-1.0 REQUIRED)
list(APPEND SENSOR_SOURCES src/storage_mongodb.c)
add_compile_definitions(HAVE_MONGODB)
if(mongoc_VERSION VERSION_GREATER_EQUAL "2.0.0")
set(MONGOC_LIBRARIES mongoc::shared)
else()
set(MONGOC_LIBRARIES mongo::mongoc_shared)
endif()
endif()

if(DEFINED ENV{GIT_TAG} AND DEFINED ENV{GIT_REV})
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# sensor builder image (build tools + development dependencies):
FROM ubuntu:24.04 as sensor-builder
FROM ubuntu:26.04@sha256:f3d28607ddd78734bb7f71f117f3c6706c666b8b76cbff7c9ff6e5718d46ff64 AS sensor-builder
ENV DEBIAN_FRONTEND=noninteractive
ARG BUILD_TYPE=Debug
ARG MONGODB_SUPPORT=ON
Expand All @@ -14,15 +14,15 @@ RUN cd /usr/src/hwpc-sensor && \
cmake --build build --parallel $(getconf _NPROCESSORS_ONLN)

# sensor runner image (only runtime depedencies):
FROM ubuntu:24.04 as sensor-runner
FROM ubuntu:26.04@sha256:f3d28607ddd78734bb7f71f117f3c6706c666b8b76cbff7c9ff6e5718d46ff64 AS sensor-runner
ENV DEBIAN_FRONTEND=noninteractive
ARG BUILD_TYPE=Debug
ARG MONGODB_SUPPORT=ON
ARG FILE_CAPABILITY=CAP_SYS_ADMIN
RUN useradd -d /opt/powerapi -m powerapi && \
apt update && \
apt install -y libczmq4 libpfm4 libjson-c5 libcap2-bin && \
echo "${MONGODB_SUPPORT}" |grep -iq "on" && apt install -y libmongoc-1.0-0 || true && \
echo "${MONGODB_SUPPORT}" |grep -iq "on" && apt install -y libmongoc2-2 || true && \
echo "${BUILD_TYPE}" |grep -iq "debug" && apt install -y libasan8 libubsan1 || true && \
rm -rf /var/lib/apt/lists/*
COPY --from=sensor-builder /usr/src/hwpc-sensor/build/hwpc-sensor /usr/bin/hwpc-sensor
Expand Down
2 changes: 2 additions & 0 deletions src/config_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ static int
setup_storage_null_parameters(struct config *config __attribute__((unused)), json_object *storage_obj)
{
json_object_object_foreach(storage_obj, key, value) {
(void) value;

if (!strcasecmp(key, "type")) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/storage_mongodb.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <mongoc.h>
#include <mongoc/mongoc.h>

#include "report.h"
#include "storage_mongodb.h"
Expand Down
2 changes: 1 addition & 1 deletion src/storage_mongodb.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#ifndef STORAGE_MONGODB_H
#define STORAGE_MONGODB_H

#include <mongoc.h>
#include <mongoc/mongoc.h>

#include "storage.h"
#include "config.h"
Expand Down
Loading