Skip to content

Commit

Permalink
MON-111634 Centreon next 24.04 (Jira release #19891#) (#1428)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkippes authored Jun 17, 2024
2 parents 7283139 + 450a20f commit cfbfde0
Show file tree
Hide file tree
Showing 777 changed files with 34,677 additions and 21,492 deletions.
13 changes: 8 additions & 5 deletions .github/actions/release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ runs:
declare -a PREVIOUS_STABLE_TAGS=()
SCOPE_VERSION="COLLECT"
MINOR_VERSION_FILE_PATH=".version"
RELEASE_CLOUD=0
RELEASE_CLOUD=0 # (0 = not a release cloud, 1 = release cloud)
MAJOR_VERSION=""
MINOR_VERSION=""
CURRENT_STABLE_BRANCH_MAJOR_VERSION=""
# Get current stable branch name
# If MASTER, use root .version
Expand Down Expand Up @@ -138,9 +141,9 @@ runs:
fi
# Rebuild NEW_STABLE_TAGS as an array
for i in ${NEW_STABLE_TAGS[@]}; do
NEW_RELEASE_TAGS+=("$i")
done
# for i in ${NEW_STABLE_TAGS[@]}; do
# NEW_RELEASE_TAGS+=("$i")
# done
# Create GITHUB release for each release components
# Abort if no tags
Expand Down Expand Up @@ -200,7 +203,7 @@ runs:
# Send to JIRA API release
echo "Sending to JIRA API release: $JIRA_RELEASE_DATA"
curl --fail --request POST \
--url 'https://${{ inputs.jira_base_url }}/rest/api/3/version' \
--url "${{ inputs.jira_base_url }}/rest/api/3/version" \
--user '${{ inputs.jira_user_email }}:${{ inputs.jira_api_token }}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
Expand Down
2 changes: 1 addition & 1 deletion .github/docker/Dockerfile.centreon-collect-alma9-test
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dnf clean all
echo "install robot and dependencies"

pip3 install -U robotframework robotframework-databaselibrary robotframework-httpctrl robotframework-examples pymysql python-dateutil psutil
pip3 install grpcio grpcio_tools py-cpuinfo cython unqlite gitpython boto3
pip3 install grpcio grpcio_tools py-cpuinfo cython unqlite gitpython boto3 robotframework-requests

cd /tmp/collect

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ apt-get clean
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8

pip3 install --break-system-packages -U robotframework robotframework-databaselibrary robotframework-httpctrl robotframework-examples pymysql python-dateutil psutil
pip3 install --break-system-packages grpcio grpcio_tools py-cpuinfo cython unqlite gitpython boto3
pip3 install --break-system-packages grpcio grpcio_tools py-cpuinfo cython unqlite gitpython boto3 robotframework-requests

cd /tmp/collect

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ apt-get clean
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8

pip3 install -U robotframework robotframework-databaselibrary robotframework-httpctrl robotframework-examples pymysql python-dateutil psutil
pip3 install grpcio grpcio_tools py-cpuinfo cython unqlite gitpython boto3
pip3 install grpcio grpcio_tools py-cpuinfo cython unqlite gitpython boto3 robotframework-requests

cd /tmp/collect

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dnf clean all
echo "install robot and dependencies"

pip3 install -U robotframework robotframework-databaselibrary robotframework-httpctrl robotframework-examples pymysql python-dateutil psutil
pip3 install grpcio grpcio_tools py-cpuinfo cython unqlite gitpython boto3
pip3 install grpcio grpcio_tools py-cpuinfo cython unqlite gitpython boto3 robotframework-requests

cd /tmp/collect

Expand Down
3 changes: 3 additions & 0 deletions .github/scripts/collect-test-robot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ echo '/tmp/core.%p' > /proc/sys/kernel/core_pattern
#remove git dubious ownership
/usr/bin/git config --global --add safe.directory $PWD

echo "###### git clone opentelemetry-proto #######"
git clone --depth=1 --single-branch https://github.com/open-telemetry/opentelemetry-proto.git opentelemetry-proto

echo "##### Starting tests #####"
cd tests
./init-proto.sh
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/get-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ jobs:
echo "release_cloud=$GITHUB_RELEASE_CLOUD" >> $GITHUB_OUTPUT
echo "release_type=$GITHUB_RELEASE_TYPE" >> $GITHUB_OUTPUT
;;
develop)
echo "release=`date +%s`.`echo ${{ github.sha }} | cut -c -7`" >> $GITHUB_OUTPUT
echo "release_cloud=1" >> $GITHUB_OUTPUT
echo "release_type=$GITHUB_RELEASE_TYPE" >> $GITHUB_OUTPUT
;;
release* | hotfix*)
# Handle workflow_dispatch run triggers and run a dispatch ONLY for cloud release
GITHUB_RELEASE_BRANCH_BASE_REF_NAME="$(gh pr view $BRANCHNAME -q .baseRefName --json headRefName,baseRefName,state)"
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/veracode-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ on:
jobs:
routing:
name: Check before analysis
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
outputs:
development_stage: ${{ steps.routing-mode.outputs.development_stage }}

Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
password: ${{ secrets.docker_registry_passwd }}

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4

- name: Compiling Cpp sources
run: |
Expand Down Expand Up @@ -142,7 +142,7 @@ jobs:
name: Sandbox scan
needs: [routing, build]
if: needs.routing.outputs.development_stage != 'Development'
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- name: Promote latest scan
Expand All @@ -163,13 +163,13 @@ jobs:
delete-on-promote: false

- name: Get build binary
uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: "${{ inputs.module_name }}-${{ github.sha }}-${{ github.run_id }}-veracode-binary.tar.gz"
key: "${{ inputs.module_name }}-${{ github.sha }}-${{ github.run_id }}-veracode-binary"

- name: Sandbox scan
uses: veracode/[email protected]
uses: veracode/veracode-uploadandscan-action@f7e1fbf02c5c899fba9f12e3f537b62f2f1230e1 # master using 0.2.6
continue-on-error: ${{ vars.VERACODE_CONTINUE_ON_ERROR == 'true' }}
with:
appname: "${{ inputs.module_name }}"
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,6 @@ test/python/*.crt
test/python/*.key
tests/logs/*
tests/bench.unqlite
tests/resources/process_stat_pb2.py
tests/resources/process_stat_pb2_grpc.py
tests/resources/*_pb2.py
tests/resources/*_pb2_grpc.py
tests/resources/grpc_stream.proto
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
MAJOR=24.04
MINOR=1
MINOR=2
23 changes: 20 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ endif()
# Version.
set(COLLECT_MAJOR 24)
set(COLLECT_MINOR 04)
set(COLLECT_PATCH 1)
set(COLLECT_PATCH 2)
set(COLLECT_VERSION "${COLLECT_MAJOR}.${COLLECT_MINOR}.${COLLECT_PATCH}")
add_definitions(-DCENTREON_CONNECTOR_VERSION=\"${COLLECT_VERSION}\")

Expand All @@ -152,10 +152,9 @@ find_package(spdlog CONFIG REQUIRED)
find_package(gRPC CONFIG REQUIRED)
find_package(Protobuf REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
find_package(opentelemetry-cpp REQUIRED)
find_package(GTest CONFIG REQUIRED)
find_package(CURL REQUIRED)
find_package(Boost REQUIRED)
find_package(Boost REQUIRED COMPONENTS url)
find_package(ryml CONFIG REQUIRED)
add_definitions("-DSPDLOG_FMT_EXTERNAL")

Expand All @@ -178,6 +177,24 @@ set(OTLP_LIB_DIR ${opentelemetry-cpp_DIR}/../../lib)
set(VCPKG_INCLUDE_DIR ${Protobuf_INCLUDE_DIR})
include(GNUInstallDirs)

#import opentelemetry-proto
add_custom_command(
OUTPUT ${CMAKE_SOURCE_DIR}/opentelemetry-proto/opentelemetry/proto/collector/metrics/v1/metrics_service.proto
${CMAKE_SOURCE_DIR}/opentelemetry-proto/opentelemetry/proto/metrics/v1/metrics.proto
${CMAKE_SOURCE_DIR}/opentelemetry-proto/opentelemetry/proto/common/v1/common.proto
${CMAKE_SOURCE_DIR}/opentelemetry-proto/opentelemetry/proto/resource/v1/resource.proto
COMMENT "get opentelemetry proto files from git repository"
COMMAND /bin/rm -rf ${CMAKE_SOURCE_DIR}/opentelemetry-proto
COMMAND git ARGS clone --depth=1 --single-branch https://github.com/open-telemetry/opentelemetry-proto.git ${CMAKE_SOURCE_DIR}/opentelemetry-proto
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

add_custom_target(opentelemetry-proto-files DEPENDS ${CMAKE_SOURCE_DIR}/opentelemetry-proto/opentelemetry/proto/collector/metrics/v1/metrics_service.proto
${CMAKE_SOURCE_DIR}/opentelemetry-proto/opentelemetry/proto/metrics/v1/metrics.proto
${CMAKE_SOURCE_DIR}/opentelemetry-proto/opentelemetry/proto/common/v1/common.proto
${CMAKE_SOURCE_DIR}/opentelemetry-proto/opentelemetry/proto/resource/v1/resource.proto
)

# var directories.
set(BROKER_VAR_LOG_DIR
"${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/log/centreon-broker")
Expand Down
32 changes: 32 additions & 0 deletions bbdo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,38 @@ add_dependencies(pb_remove_graph_message_lib target_remove_graph_message
set_target_properties(pb_remove_graph_message_lib
PROPERTIES POSITION_INDEPENDENT_CODE ON)

set(otl_protobuf_files
opentelemetry/proto/collector/metrics/v1/metrics_service
opentelemetry/proto/metrics/v1/metrics
opentelemetry/proto/common/v1/common
opentelemetry/proto/resource/v1/resource
)
foreach(name IN LISTS otl_protobuf_files)
set(proto_file "${name}.proto")
add_custom_command(
OUTPUT "${CMAKE_SOURCE_DIR}/bbdo/${name}.pb.cc"
COMMENT "Generating interface files of the otl file ${proto_file}"
#DEPENDS ${CMAKE_BINARY_DIR}/opentelemetry-proto/${proto_file}
DEPENDS opentelemetry-proto-files
COMMAND
${Protobuf_PROTOC_EXECUTABLE} ARGS --cpp_out=${CMAKE_SOURCE_DIR}/bbdo
--proto_path=${CMAKE_SOURCE_DIR}/opentelemetry-proto ${proto_file}
VERBATIM)
endforeach()

add_library(pb_open_telemetry_lib STATIC
${CMAKE_SOURCE_DIR}/bbdo/opentelemetry/proto/collector/metrics/v1/metrics_service.pb.cc
${CMAKE_SOURCE_DIR}/bbdo/opentelemetry/proto/metrics/v1/metrics.pb.cc
${CMAKE_SOURCE_DIR}/bbdo/opentelemetry/proto/common/v1/common.pb.cc
${CMAKE_SOURCE_DIR}/bbdo/opentelemetry/proto/resource/v1/resource.pb.cc
)

target_include_directories(pb_open_telemetry_lib BEFORE PRIVATE ${CMAKE_SOURCE_DIR}/bbdo)


set_target_properties(pb_open_telemetry_lib
PROPERTIES POSITION_INDEPENDENT_CODE ON)

macro(get_protobuf_files name)
set_source_files_properties("${CMAKE_SOURCE_DIR}/bbdo/${name}.pb.cc"
PROPERTIES GENERATED TRUE)
Expand Down
3 changes: 2 additions & 1 deletion bbdo/bbdo.proto
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ message Ack {

/*io::bbdo, bbdo::de_pb_stop*/
message Stop {
}
uint64 poller_id = 1;
}
24 changes: 17 additions & 7 deletions bbdo/events.hh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
#include <cstdint>
#include <cstring>

namespace com {
namespace centreon {
namespace broker {
namespace com::centreon::broker {
namespace io {
enum data_category {
none = 0,
Expand All @@ -35,7 +33,8 @@ enum data_category {
bam = 6,
extcmd = 7,
generator = 8,
max_data_category = 9,
local = 9,
max_data_category = 10,
internal = 65535
};
constexpr uint16_t category_id(const char* name) {
Expand All @@ -55,6 +54,8 @@ constexpr uint16_t category_id(const char* name) {
return dumper;
if (std::string_view("generator", 9) == name)
return generator;
if (std::string_view("local", 5) == name)
return local;
return none;
}
constexpr const char* category_name(data_category cat) {
Expand All @@ -75,6 +76,8 @@ constexpr const char* category_name(data_category cat) {
return "generator";
case internal:
return "internal";
case local:
return "local";
default:
return "unknown category";
}
Expand Down Expand Up @@ -166,6 +169,9 @@ enum data_element {
de_pb_status = 10,
de_pb_index_mapping = 11,
de_pb_metric_mapping = 12,
de_pb_otl_metrics =
13 // contain an
// ::opentelemetry::proto::collector::metrics::v1::ExportMetricsServiceRequest
};
}
namespace bam {
Expand Down Expand Up @@ -208,6 +214,12 @@ namespace extcmd {
enum data_element { de_pb_bench = 1, de_ba_info = 2 };
}

namespace local {
enum data_element {
de_pb_stop = 1,
};
}

constexpr uint32_t make_type(io::data_category cat, uint32_t elem) {
return (cat << 16) | elem;
}
Expand All @@ -217,8 +229,6 @@ constexpr uint16_t category_of_type(uint32_t type) {
constexpr uint16_t element_of_type(uint32_t type) {
return static_cast<uint16_t>(type);
}
} // namespace broker
} // namespace centreon
} // namespace com
} // namespace com::centreon::broker

#endif /* !CC_BROKER_EVENTS_HH */
34 changes: 17 additions & 17 deletions bbdo/neb.proto
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/*
** Copyright 2022 Centreon
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
**
** For more information : [email protected]
*/
/**
* Copyright 2022-2024 Centreon
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : [email protected]
*/

syntax = "proto3";

Expand Down
Loading

0 comments on commit cfbfde0

Please sign in to comment.