Different options on how to build¶
ci/build.sh [Debug|Release]
uses FetchContent to install
cmocka_extensions
,cmocka_mocks
,safu
&samconf
.if
cmocka_extensions
,cmocka_mocks
,safu
&samconf
are already installed in a path found by cmake that installation is used.
cmake && make|ninja
can be configured to use FetchContent with variables but generally depends on them being installed already.
Build Configurations¶
cmake & make
without any options (default)¶
cmake -B build/ .
make -C build/
Builds everything except for the NoSQL and InfluxDB backend. Everything is build in Debug mode.
make -C build/ install
Installs everything except mock_libelos
.
Can be configured with the options described in section cmake options.
ci/install_deps.py
¶
Intended to easier install the dependencies cmocka_extensions
, cmocka_mocks
, safu
& samconf
ci/install_deps.py
By default it installs from the main branch of the GitHub repositories. The behavior can be modified by specifying one of the following files in this order:
file specified by
ELOS_DEPENDENCY_CONFIG
environment variable
export ELOS_DEPENDENCY_CONFIG=".myconfig/my_dependencies.json"
dependencies.json
in the root of the projectci/dependencies_default.json
in the root of the project
Each resource can be defined by the [url|path][commit|branch|tag][cmake_opts]
options. This could look like:
{
"safu": {
"path": "../safu"
},
"samconf": {
"url": "https://github.com/Elektrobit/samconf.git",
"tag": "samconf-0.49.3"
},
"cmocka_mocks": {
"url": "https://github.com/Elektrobit/cmocka_mocks.git",
"commit": "2206cfbcf315b3c7381f9b9f4aa29238b18c1a6b",
"cmake_opts": ["-D", "UNIT_TESTS=off"]
},
"cmocka_extensions": {
"branch": "main"
}
}
If no URL or path is provided the default is used. A path is used as is without checking the branch, tag or commit and includes local changes that aren’t committed jet.
The url
property supports the evaluation of environment variables like
SOURCES_URI
so it is possible to define template configurations like:
{
"safu": {
"url": "${SOURCES_URI}/safu.git",
"branch": "integration"
},
"samconf": {
"url": "${SOURCES_URI}/samconf.git",
"branch": "integration"
},
"cmocka_mocks": {
"url": "${SOURCES_URI}/cmocka_mocks.git",
"branch": "integration"
},
"cmocka_extensions": {
"url": "${SOURCES_URI}/cmocka_extensions.git",
"branch": "integration"
}
}
and call install_deps.py
like :
SOURCES_URI=https://${GIT_USER_TOKEN}@github.com/Elektrobit/
These dependencies get installed into build/deps/
and if provided with an URL the sources can be found in build/deps/src
.
In addition the install_deps.py
provides the following command line options to tune the install process:
usage: install_deps.py [-h] [-c CONFIG] [-G] [--no-tests] [--no-mocks] [--ci]
[--clean-first]
options:
-h, --help show this help message and exit
-c CONFIG, --config CONFIG
the user config for dependencies (default
/home/runner/work/elos/elos/dependencies.json or
enviroment variable ELOS_DEPENDENCY_CONFIG)
-G, --global install the dependencies globaly
--no-tests don't install cmocka_extensions & cmocka_mocks
--no-mocks don't build & install mock libraries (no cmocka
depenedencies)
--ci run cmake with CI flag
--clean-first clean cmake caches first
To use binaries installed from dependencies add build/deps/bin
to the PATH
environment variable.
ci/build.sh
¶
Intended for easier building of different configurations while developing and in CI.
ci/build.sh [BUILD_TARGET]
Builds everything except for the NoSQL and InfluxDB backend.
By default the BUILD_TARGET is Debug.
The build folder is set to build/BUILD_TARGET/cmake
and everything is also directly installed into build/BUILD_TARGET/dist/
(except for mock_libelos
).
Additional configurations are described in ci/build.sh options.
Output¶
/usr
├── etc/
│ └── elos/
│ └── elos_log4c_demo/
│ └── log4crc
└── local/
├── bin/
│ ├── demo_eloslog
│ ├── demo_eventbuffer
│ ├── demo_libelos_v2
│ ├── demo_scanner_shmem
│ ├── elos-coredump
│ ├── elos_log4c_demo
│ ├── elosc
│ ├── elosd
│ ├── elosMon
│ ├── syslog_example
│ └── tinyElosc
├── include/
│ └── elos/
│ ├── common/
│ │ ├── message.h
│ │ ├── process.h
│ │ └── types.h
│ ├── event/
│ │ ├── event.h
│ │ ├── event_source.h
│ │ └── event_vector.h
│ ├── libelos/
│ │ ├── libelos.h
│ │ └── libeloslog.h
│ └── libelosplugin/
│ └── libelosplugin.h
└── lib/
├── elos/
│ ├── backend/
│ │ ├── backend_dummy.so
│ │ ├── backend_json.so
│ │ └── backend_sql.so
│ └── scanner/
│ ├── scanner_kmsg.so
│ ├── scanner_shmem.so
│ └── scanner_syslog.so
├── libelos.so -> libelos.so.0
├── libelos.so.0 -> libelos.so.0.52.3
├── libelos.so.0.52.3
├── libeloslog4c.so -> libeloslog4c.so.0
├── libeloslog4c.so.0 -> libeloslog4c.so.0.52.3
├── libeloslog4c.so.0.52.3
├── libelosplugin.so -> libelosplugin.so.0
├── libelosplugin.so.0 -> libelosplugin.so.0.52.3
├── libelosplugin.so.0.52.3
└── test/
└── elos unit tests
Dependencies¶
elosd |
libelos |
mock_libelos |
libelosplugin |
scanner |
backend |
Clients |
Demos |
unit tests |
|
---|---|---|---|---|---|---|---|---|---|
safu |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
mock_safu |
✅ |
||||||||
samconf |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
||
mock_samconf |
✅ |
||||||||
cmocka |
✅ |
✅ |
|||||||
cmocka_extensions |
✅ |
✅ |
|||||||
cmocka_mocks |
✅ |
||||||||
asan [1] |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
esmtp |
✅ [5] |
||||||||
jason-c |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
||
libcurl |
✅ [2] |
||||||||
libmnl |
✅ |
✅ |
|||||||
log4c |
✅ [6] |
||||||||
mongoc_shared |
✅ [3] |
||||||||
sqlite3 |
✅ [4] |
Options¶
cmake options¶
CMAKE_BUILD_TYPE: (default “Debug”)
ENABLE_CI: (default OFF) adds
-Werror
to the compile optionsUNIT_TESTS: (default ON) Build the unit tests
INSTALL_UNIT_TESTS: (default ON) install the unit tests
ELOSD_EVENTLOGGING_BACKEND_SQL: (default ON) Build the sqlite3 backend plugin
ELOSD_EVENTLOGGING_BACKEND_NOSQL: (default OFF) Build the NoSQL backend plugin
ELOSD_EVENTLOGGING_BACKEND_INFLUXDB: (default OFF) Build the InfluxDB backend plugin
ci/build.sh options¶
[BUILD_TYPE] (default “Debug”) sets the build type for cmake
--ci
enables-DENABLE_CI
for cmake and implicitly sets--clean --verbose
--clean|-c
deletes the build directory before the build for a fresh start--verbose|-v
adds-v
to the parameters for ninja--package
implicitly sets theBUILD_TYPE
toRelease
and adds-D PACKAGING=true
to cmake. Also implicitly sets--clean
CI-Helper scripts¶
The ci
folder contains a bunch of helper scripts to do different CI task.
Keeping them separated from a specific CI solution enables us to reuse the code
and additionally use them locally during development.
ci/trigger_jenkins_ci.sh¶
This script can be used to trigger and monitor Jenkins pipelines. We use it to trigger Yocto build jobs on a Jenkins instance.
Usage: ./ci/trigger_jenkins_ci.sh
Required environment variables:
JENKINS_URI: base URI to acces the jenikins instance (i.e `https://jenkins.local`)
JENKINS_JOB_USER: the username to use for authorization
JENKINS_JOB_TOKEN: the access token to use for authorization
BRANCH_NAME: the name of the elos branch that shall be build as plain text NOT escaped or urlencoded