Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Sentry support to new CPack packages. #17627

Merged
merged 1 commit into from
May 10, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ endif()

set(NETDATA_VERSION ${FIELD_MAJOR}.${FIELD_MINOR}.${FIELD_PATCH}.${FIELD_TWEAK})

if(FIELD_DESCR STREQUAL "N/A")
set(CPACK_PACKAGE_VERSION ${FIELD_MAJOR}.${FIELD_MINOR}.${FIELD_PATCH})
else()
set(CPACK_PACKAGE_VERSION ${FIELD_MAJOR}.${FIELD_MINOR}.${FIELD_PATCH}-${FIELD_TWEAK}-${FIELD_DESCR})
endif()

#
# project
#
Expand Down
23 changes: 23 additions & 0 deletions packaging/build-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,31 @@ case "${PKG_TYPE}" in
*) echo "Unrecognized package type ${PKG_TYPE}." ; exit 1 ;;
esac

if [ "${ENABLE_SENTRY}" = "true" ]; then
if [ -z "${SENTRY_DSN}" ]; then
echo "ERROR: Sentry enabled but no DSN specified, exiting."
exit 1
fi

add_cmake_option ENABLE_SENTRY On
add_cmake_option NETDATA_SENTRY_ENVIRONMENT "${RELEASE_PIPELINE:-Unknown}"
add_cmake_option NETDATA_SENTRY_DIST "${BUILD_DESTINATION:-Unknown}"
add_cmake_option NETDATA_SENTRY_DSN "${SENTRY_DSN}"

if [ -n "${VERSION}" ]; then
add_cmake_option NETDATA_SENTRY_RELEASE "${VERSION}"
fi
else
add_cmake_option ENABLE_SENTRY Off
fi

# shellcheck disable=SC2086
cmake ${CMAKE_ARGS}
cmake --build "${BUILD_DIR}" --parallel "$(nproc)"

if [ "${ENABLE_SENTRY}" = "true" ] && [ "${UPLOAD_SENTRY}" = "true" ]; then
sentry-cli debug-files upload -o netdata-inc -p netdata-agent --force-foreground --log-level=debug --wait --include-sources build/netdata
fi

cd "${BUILD_DIR}" || exit 1
cpack -V -G "${PKG_TYPE}"
4 changes: 4 additions & 0 deletions packaging/cmake/Modules/NetdataSentry.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ function(netdata_bundle_sentry)
set(SENTRY_BACKEND "breakpad")
set(SENTRY_BUILD_SHARED_LIBS OFF)

if(NOT DEFINED NETDATA_SENTRY_RELEASE)
set(NETDATA_SENTRY_RELEASE "${CPACK_PACKAGE_VERSION}")
endif()

FetchContent_Declare(
sentry
GIT_REPOSITORY https://github.com/getsentry/sentry-native.git
Expand Down
6 changes: 0 additions & 6 deletions packaging/cmake/Modules/Packaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ set(CPACK_DEBIAN_DEBUGINFO_PACKAGE NO)

set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS YES)

if(FIELD_DESCR STREQUAL "N/A")
set(CPACK_PACKAGE_VERSION ${FIELD_MAJOR}.${FIELD_MINOR}.${FIELD_PATCH})
else()
set(CPACK_PACKAGE_VERSION ${FIELD_MAJOR}.${FIELD_MINOR}.${FIELD_PATCH}-${FIELD_TWEAK}-${FIELD_DESCR})
endif()

set(CPACK_PACKAGING_INSTALL_PREFIX "/")

set(CPACK_PACKAGE_VENDOR "Netdata Inc.")
Expand Down