Skip to content

Commit

Permalink
Centreon 22.10 (Jira release #19723#)
Browse files Browse the repository at this point in the history
  • Loading branch information
paloth committed Mar 6, 2024
2 parents 9f29fe9 + 9646c4f commit 0fcbb59
Show file tree
Hide file tree
Showing 34 changed files with 1,411 additions and 957 deletions.
18 changes: 14 additions & 4 deletions .github/actions/release/action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
name: "tag version"
description: "Tag package"
inputs:
jira_token:
jira_api_token:
description: "Token to authenticate to Jira"
required: true
jira_user_email:
description: "Email linked to token"
required: true
jira_project_id:
description: "Jira project id to create release"
required: true
jira_base_url:
description: "Jira base url"
required: true

runs:
using: "composite"
steps:
Expand Down Expand Up @@ -44,11 +54,11 @@ runs:
TYPE=Release
fi
VERSION_DATA="{\"archived\":false,\"releaseDate\":\"$(date +%Y-%m-%d)\",\"name\":\"centreon-collect-$NEW_VERSION\",\"description\":\"$TYPE:$RELEASE_ID\",\"projectId\":11789,\"released\":false}"
VERSION_DATA="{\"archived\":false,\"releaseDate\":\"$(date +%Y-%m-%d)\",\"name\":\"centreon-collect-$NEW_VERSION\",\"description\":\"$TYPE:$RELEASE_ID\",\"projectId\":${{ inputs.jira_project_id }},\"released\":false}"
curl --fail --request POST \
--url 'https://centreon.atlassian.net/rest/api/3/version' \
--header 'Authorization: Basic ${{ inputs.jira_token }}' \
--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' \
--data ''$VERSION_DATA''
Expand Down
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ updates:
- package-ecosystem: github-actions
directory: '/'
schedule:
interval: weekly
interval: monthly
open-pull-requests-limit: 10
labels:
- 'dependencies'
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/release-collect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ on:
- "[2-9][0-9].[0-9][0-9].x"
paths:
- "centreon-collect/**"
- "!centreon-collect/ci/**"
- "!centreon-collect/tests/**"
workflow_dispatch:

env:
Expand All @@ -29,4 +31,7 @@ jobs:
id: release
uses: ./.github/actions/release
with:
jira_token: ${{ secrets.JIRA_TOKEN }}
jira_user_email: ${{ secrets.XRAY_JIRA_USER_EMAIL }}
jira_api_token: ${{ secrets.XRAY_JIRA_TOKEN }}
jira_project_id: ${{ secrets.JIRA_PROJECT_ID }}
jira_base_url: ${{ secrets.JIRA_BASE_URL }}
31 changes: 18 additions & 13 deletions .github/workflows/veracode-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@ jobs:
- name: Set routing mode
id: routing-mode
run: |
CHECK_BRANCH=`echo "${{ github.ref_name }}" | cut -d'/' -f2`
if [[ $CHECK_BRANCH != "merge" && '${{ github.event_name }}' != 'pull_request' ]]; then
DEVELOPMENT_STAGE="Release"
else
DEVELOPMENT_STAGE="Development"
fi
DEVELOPMENT_STAGE="Development"
ALLOWED_BRANCHES=(develop master dev-${{ inputs.major_version }}.x ${{ inputs.major_version }}.x)
for BRANCH in "${ALLOWED_BRANCHES[@]}"; do
if [[ "${{ github.ref_name }}" == "$BRANCH" ]] && [[ '${{ github.event_name }}' != 'pull_request' ]]; then
DEVELOPMENT_STAGE="Release"
fi
done
echo "development_stage=$DEVELOPMENT_STAGE" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
Expand All @@ -66,10 +69,10 @@ jobs:
mkdir build
cd build
sudo pip3 install conan==1.57.0 --prefix=/usr --upgrade
sudo conan install .. -s compiler.cppstd=14 -s compiler.libcxx=libstdc++11 --build=missing
pip3 install conan==1.62.0 --prefix=/usr --upgrade
conan install .. -s compiler.cppstd=14 -s compiler.libcxx=libstdc++11 --build=missing
sudo cmake \
cmake \
-G "Ninja" \
-DCMAKE_CXX_FLAGS="-gdwarf-2 -g3 -O0 -fno-builtin" \
-DWITH_TESTING=OFF \
Expand All @@ -88,7 +91,7 @@ jobs:
-DWITH_CONFIG_FILES=ON \
..
sudo ninja
ninja
echo "[DEBUG] - Find compiled files"
find ./ -name "*.so"
Expand Down Expand Up @@ -134,21 +137,23 @@ jobs:
path: "${{ inputs.module_name }}-${{ github.sha }}-${{ github.run_id }}-veracode-binary.tar.gz"
key: "${{ inputs.module_name }}-${{ github.sha }}-${{ github.run_id }}-veracode-binary"

sandbox-scan:
policy-scan:
name: Sandbox scan
needs: [build]
needs: [routing, build]
if: needs.routing.outputs.development_stage != 'Development'
runs-on: ubuntu-latest

steps:
- name: Promote latest scan
# only develop will be promoted to policy scan
if: github.ref_name == 'develop'
env:
VERACODE_API_ID: "${{ secrets.veracode_api_id }}"
VERACODE_API_SECRET: "${{ secrets.veracode_api_key }}"

# Action forked as API calls hardcoded '.com' route
uses: sc979/veracode-sandboxes-helper@cf67241c27cbe6405ad8705111121ece9a48c4ff # v0.2
# Promote should not fail if sandbox was not found.
# Promote should not fail to trigger following sandbox scan.
continue-on-error: true
with:
activity: "promote-latest-scan"
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ endif()
# Version.
set(COLLECT_MAJOR 22)
set(COLLECT_MINOR 10)
set(COLLECT_PATCH 8)
set(COLLECT_PATCH 9)
set(COLLECT_VERSION "${COLLECT_MAJOR}.${COLLECT_MINOR}.${COLLECT_PATCH}")
add_definitions(-DCENTREON_CONNECTOR_VERSION=\"${COLLECT_VERSION}\")

Expand Down
39 changes: 39 additions & 0 deletions broker/bam/inc/com/centreon/broker/bam/internal.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copyright 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 : contact@centreon.com
*/

#ifndef CCB_BAM_INTERNAL_HH
#define CCB_BAM_INTERNAL_HH

#include "broker.pb.h"
#include "com/centreon/broker/io/events.hh"
#include "com/centreon/broker/io/protobuf.hh"
#include "com/centreon/broker/namespace.hh"

CCB_BEGIN()

/* We have to declare the pb_ba_info also here because we don't control the
* order things are created. If the bam stream is created before brokerrpc, its
* muxer will be declared with known events (so without pb_ba_info) and if we
* want pb_ba_info to be known, thenwe have to force its declaration. */
namespace extcmd {
using pb_ba_info =
io::protobuf<BaInfo, make_type(io::extcmd, extcmd::de_ba_info)>;
} // namespace extcmd

CCB_END()
#endif /* !CCB_BAM_INTERNAL_HH */
11 changes: 2 additions & 9 deletions broker/bam/inc/com/centreon/broker/bam/monitoring_stream.hh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/**
* Copyright 2014-2023 Centreon
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -21,18 +21,11 @@

#include <absl/hash/hash.h>
#include "com/centreon/broker/bam/configuration/applier/state.hh"
#include "com/centreon/broker/database/mysql_stmt.hh"
#include "com/centreon/broker/database_config.hh"
#include "com/centreon/broker/io/stream.hh"
#include "com/centreon/broker/bam/internal.hh"
#include "com/centreon/broker/mysql.hh"
#include "com/centreon/broker/namespace.hh"

CCB_BEGIN()

namespace extcmd {
using pb_ba_info =
io::protobuf<BaInfo, make_type(io::extcmd, extcmd::de_ba_info)>;
}
namespace bam {
/**
* @class monitoring_stream monitoring_stream.hh
Expand Down
37 changes: 18 additions & 19 deletions broker/bam/src/main.cc
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/*
** Copyright 2011-2015, 2020-2021 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 : contact@centreon.com
*/
/**
* Copyright 2011-2015, 2020-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 : contact@centreon.com
*/
#include "bbdo/bam/ba_duration_event.hh"
#include "bbdo/bam/ba_event.hh"
#include "bbdo/bam/ba_status.hh"
Expand All @@ -31,17 +31,16 @@
#include "bbdo/bam/kpi_event.hh"
#include "bbdo/bam/kpi_status.hh"
#include "bbdo/bam/rebuild.hh"
#include "bbdo/events.hh"
#include "bbdo/storage/index_mapping.hh"
#include "bbdo/storage/metric.hh"
#include "bbdo/storage/metric_mapping.hh"
#include "bbdo/storage/status.hh"
#include "com/centreon/broker/bam/factory.hh"
#include "com/centreon/broker/bam/internal.hh"
#include "com/centreon/broker/broker_impl.hh"
#include "com/centreon/broker/io/events.hh"
#include "com/centreon/broker/io/protocols.hh"
#include "com/centreon/broker/log_v2.hh"
#include "com/centreon/exceptions/msg_fmt.hh"

using namespace com::centreon::exceptions;
using namespace com::centreon::broker;
Expand Down
9 changes: 1 addition & 8 deletions broker/bam/src/monitoring_stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,16 @@
#include "bbdo/bam/ba_status.hh"
#include "bbdo/bam/kpi_status.hh"
#include "bbdo/bam/rebuild.hh"
#include "bbdo/events.hh"
#include "com/centreon/broker/bam/configuration/reader_v2.hh"
#include "com/centreon/broker/bam/configuration/state.hh"
#include "com/centreon/broker/bam/event_cache_visitor.hh"
#include "com/centreon/broker/config/applier/state.hh"
#include "com/centreon/broker/exceptions/shutdown.hh"
#include "com/centreon/broker/io/events.hh"
#include "com/centreon/broker/log_v2.hh"
#include "com/centreon/broker/misc/fifo_client.hh"
#include "com/centreon/broker/multiplexing/publisher.hh"
#include "com/centreon/broker/neb/acknowledgement.hh"
#include "com/centreon/broker/neb/downtime.hh"
#include "com/centreon/broker/neb/internal.hh"
#include "com/centreon/broker/neb/service.hh"
#include "com/centreon/broker/neb/service_status.hh"
#include "com/centreon/broker/pool.hh"
#include "com/centreon/broker/timestamp.hh"
#include "com/centreon/exceptions/msg_fmt.hh"

using namespace com::centreon::exceptions;
using namespace com::centreon::broker;
Expand Down Expand Up @@ -367,6 +359,7 @@ int monitoring_stream::write(std::shared_ptr<io::data> const& data) {
_write_external_command(cmd);
} break;
case extcmd::pb_ba_info::static_type(): {
log_v2::bam()->info("BAM: dump BA");
extcmd::pb_ba_info const& e =
*std::static_pointer_cast<const extcmd::pb_ba_info>(data);
auto& obj = e.obj();
Expand Down
48 changes: 27 additions & 21 deletions broker/bam/src/timeperiod_map.cc
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
/*
** Copyright 2014 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 : contact@centreon.com
*/
/**
* Copyright 2014, 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 : contact@centreon.com
*/

#include "com/centreon/broker/bam/timeperiod_map.hh"

#include "com/centreon/broker/log_v2.hh"
#include "com/centreon/exceptions/msg_fmt.hh"

using namespace com::centreon::exceptions;
Expand Down Expand Up @@ -137,10 +139,14 @@ timeperiod_map::get_timeperiods_by_ba_id(uint32_t ba_id) const {
uint32_t tp_id = found.first->second.first;
bool is_default = found.first->second.second;
time::timeperiod::ptr tp = get_timeperiod(tp_id);
if (!tp)
throw msg_fmt("BAM-BI: could not find the timeperiod {} in cache.",
tp_id);
res.push_back(std::make_pair(tp, is_default));
if (!tp) {
SPDLOG_LOGGER_ERROR(log_v2::bam(),
"BAM-BI: could not find the timeperiod {} in cache "
"for ba {}, check timeperiod table in conf db",
tp_id, ba_id);
} else {
res.push_back(std::make_pair(tp, is_default));
}
}

return (res);
Expand Down
Loading

0 comments on commit 0fcbb59

Please sign in to comment.