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

MON-70026 Centreon next 23.04 (Jira release #19852#) #1328

Merged
merged 10 commits into from
May 27, 2024
Merged
75 changes: 47 additions & 28 deletions .github/actions/delivery/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ inputs:
description: "The distribution used for packaging"
required: true
version:
description: "Centreon packaged version"
description: "Centreon packaged major version"
required: true
cache_key:
description: "The cached package key"
Expand Down Expand Up @@ -37,7 +37,7 @@ runs:

- name: Build name for DEB
shell: bash
if: ${{ inputs.distrib == 'bullseye' }}
if: ${{ contains(fromJSON('["bullseye", "bookworm", "jammy"]'), inputs.distrib) }}
run: |
echo "extfile=deb" >> $GITHUB_ENV

Expand All @@ -59,25 +59,19 @@ runs:

FILES="*.${{ env.extfile }}"

echo "[DEBUG] - Version: ${{ inputs.version }}"
echo "[DEBUG] - Distrib: ${{ inputs.distrib }}"

if [ -z "${{ inputs.module_name }}" ]; then
echo "module name is required"
exit 1
fi

if [ -z "${{ inputs.distrib }}" ]; then
echo "distrib is required"
exit 1
fi

# DEBUG
echo "[DEBUG] - Version: ${{ inputs.version }}"
echo "[DEBUG] - Distrib: ${{ inputs.distrib }}"
echo "[DEBUG] - module_name: ${{ inputs.module_name }}"
echo "[DEBUG] - release_cloud: ${{ inputs.release_cloud }}"
echo "[DEBUG] - release_type: ${{ inputs.release_type }}"
echo "[DEBUG] - stability: ${{ inputs.stability }}"

# Make sure all required inputs are NOT empty
if [[ -z "${{ inputs.module_name }}" || -z "${{ inputs.distrib }}" || -z ${{ inputs.stability }} || -z ${{ inputs.version }} || -z ${{ inputs.release_cloud }} || -z ${{ inputs.release_type }} ]]; then
echo "Some mandatory inputs are empty, please check the logs."
exit 1
fi

# Create ARCH dirs
mkdir noarch x86_64
Expand All @@ -94,18 +88,31 @@ runs:
done

# Build upload target path based on release_cloud and release_type values
# if cloud, deliver to testing-<release_type>
# if non-cloud, delivery to testing as usual
# if cloud + hotfix or cloud + release, deliver to internal testing-<release_type>
# if cloud + develop, delivery to internal unstable
# if non-cloud, delivery to onprem testing or unstable

# CLOUD + HOTFIX + REPO STANDARD INTERNAL OR CLOUD + RELEASE + REPO STANDARD INTERNAL
if [[ ${{ inputs.release_cloud }} -eq 1 && ${{ inputs.release_type }} == "hotfix" ]] || [[ ${{ inputs.release_cloud }} -eq 1 && ${{ inputs.release_type }} == "release" ]]; then
if [[ ${{ inputs.release_cloud }} -eq 1 && ( ${{ inputs.release_type }} == "hotfix" || ${{ inputs.release_type }} == "release" ) ]]; then
echo "[DEBUG] : Release cloud + ${{ inputs.release_type }}, using rpm-standard-internal."
ROOT_REPO_PATHS="rpm-standard-internal"
UPLOAD_REPO_PATH="${{ inputs.version }}/${{ inputs.distrib }}/${{ inputs.stability }}-${{ inputs.release_type }}/$ARCH/${{ inputs.module_name }}/"

# CLOUD + NOT HOTFIX OR CLOUD + NOT RELEASE + REPO STANDARD INTERNAL
elif [[ ${{ inputs.release_cloud }} -eq 1 && ( ${{ inputs.release_type }} != "hotfix" && ${{ inputs.release_type }} != "release" ) ]]; then
echo "[DEBUG] : Release cloud + NOT ${{ inputs.release_type }}, using rpm-standard-internal."
ROOT_REPO_PATHS="rpm-standard-internal"
UPLOAD_REPO_PATH="${{ inputs.version }}/${{ inputs.distrib }}/${{ inputs.stability }}-${{ inputs.release_type }}/$ARCH/RPMS/${{ inputs.module_name }}/"
UPLOAD_REPO_PATH="${{ inputs.version }}/${{ inputs.distrib }}/${{ inputs.stability }}-${{ inputs.release_type }}/$ARCH/${{ inputs.module_name }}/"

# NON-CLOUD + (HOTFIX OR RELEASE) + REPO STANDARD
elif [[ ${{ inputs.release_cloud }} -eq 0 ]]; then
echo "[DEBUG] : NOT Release cloud + ${{ inputs.release_type }}, using rpm-standard."
ROOT_REPO_PATHS="rpm-standard"
UPLOAD_REPO_PATH="${{ inputs.version }}/${{ inputs.distrib }}/${{ inputs.stability }}/$ARCH/${{ inputs.module_name }}/"

# NOT VALID, DO NOT DELIVER
else
echo "Invalid combination of release_type and release_cloud"
echo "::error:: Invalid combination of release_type [${{ inputs.release_type }}] and release_cloud [${{ inputs.release_cloud }}]"
exit 1
fi

Expand All @@ -115,8 +122,10 @@ runs:
if [ "$(ls -A $ARCH)" ]; then
if [ "${{ inputs.stability }}" == "stable" ]; then
echo "[DEBUG] - Stability is ${{ inputs.stability }}, not delivering."
else
elif [ "${{ inputs.stability }}" == "testing" ]; then
jf rt upload "$ARCH/*.rpm" "$ROOT_REPO_PATH/$UPLOAD_REPO_PATH" --sync-deletes="$ROOT_REPO_PATH/$UPLOAD_REPO_PATH" --flat
else
jf rt upload "$ARCH/*.rpm" "$ROOT_REPO_PATH/${{ inputs.version }}/${{ inputs.distrib }}/${{ inputs.stability }}/$ARCH/${{ inputs.module_name }}/" --sync-deletes="$ROOT_REPO_PATH/${{ inputs.version }}/${{ inputs.distrib }}/${{ inputs.stability }}/$ARCH/${{ inputs.module_name }}/" --flat
fi
fi
done
Expand All @@ -128,13 +137,17 @@ runs:
run: |
FILES="*.${{ env.extfile }}"

if [ -z "${{ inputs.module_name }}" ]; then
echo "module name is required"
exit 1
fi
# DEBUG
echo "[DEBUG] - Version: ${{ inputs.version }}"
echo "[DEBUG] - Distrib: ${{ inputs.distrib }}"
echo "[DEBUG] - module_name: ${{ inputs.module_name }}"
echo "[DEBUG] - release_cloud: ${{ inputs.release_cloud }}"
echo "[DEBUG] - release_type: ${{ inputs.release_type }}"
echo "[DEBUG] - stability: ${{ inputs.stability }}"

if [ -z "${{ inputs.distrib }}" ]; then
echo "distrib is required"
# Make sure all required inputs are NOT empty
if [[ -z "${{ inputs.module_name }}" || -z "${{ inputs.distrib }}" || -z ${{ inputs.stability }} || -z ${{ inputs.version }} || -z ${{ inputs.release_cloud }} || -z ${{ inputs.release_type }} ]]; then
echo "Some mandatory inputs are empty, please check the logs."
exit 1
fi

Expand All @@ -147,6 +160,12 @@ runs:

echo "[DEBUG] - Version: $VERSION"

jf rt upload "$FILE" "apt-standard-${{ inputs.version }}-${{ inputs.stability }}/pool/${{ inputs.module_name }}/" --deb "${{ inputs.distrib }}/main/$ARCH"
if [[ "${{ inputs.distrib }}" == "jammy" ]]; then
ROOT_REPO_PATH="ubuntu-standard-${{ inputs.version }}-${{ inputs.stability }}"
else
ROOT_REPO_PATH="apt-standard-${{ inputs.version }}-${{ inputs.stability }}"
fi

jf rt upload "$FILE" "$ROOT_REPO_PATH/pool/${{ inputs.module_name }}/" --deb "${{ inputs.distrib }}/main/$ARCH"
done
shell: bash
22 changes: 12 additions & 10 deletions .github/actions/promote-to-stable/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ inputs:
stability:
description: "The package stability (stable, testing, unstable)"
required: true
repository_name:
description: "The repository name"
required: true
github_ref_name:
description: "Release base ref name for push event"
required: true
Expand Down Expand Up @@ -54,7 +51,7 @@ runs:

# Cloud specific promote
# delivery by default to onprem, override to internal if base branch is master
if [[ ${{ inputs.github_base_ref }} == "master" ]]; then
if [[ ${{ inputs.github_ref_name }} == "master" ]]; then
ROOT_REPO_PATH="rpm-standard-internal"
else
ROOT_REPO_PATH="rpm-standard"
Expand Down Expand Up @@ -94,8 +91,6 @@ runs:
# Download candidates for promote
echo "[DEBUG] - Promoting $ARCH testing artifacts to stable."
for ARTIFACT in ${SRC_PATHS[@]}; do
echo "[DEBUG] - Promoting $ARTIFACT to stable on artifactory."
jf rt cp $ARTIFACT $TARGET_PATH --flat=true
echo "[DEBUG] - Downloading $ARTIFACT from TESTING."
jf rt download $ARTIFACT --flat
done
Expand All @@ -113,14 +108,21 @@ runs:
shell: bash

- name: Promote DEB packages to stable
if: ${{ startsWith(inputs.distrib, 'bullseye') }}
if: ${{ contains(fromJSON('["bullseye", "bookworm"]'), inputs.distrib) }}
run: |
set -eux

echo "[DEBUG] - Major version: ${{ inputs.major_version }}"
echo "[DEBUG] - Minor version: ${{ inputs.minor_version }}"
echo "[DEBUG] - Distrib: ${{ inputs.distrib }}"

# Define ROOT_REPO_PATH for debian
# There is no cloud ROOT_REPO_PATH for debian, only onprem
# Should there be a need to deploy debian to cloud repositories, please use the same condition as RPM promotion
ROOT_REPO_PATH="apt-standard-${{ inputs.major_version }}"

echo "[DEBUG] - Get path of testing DEB packages to promote to stable."
SRC_PATHS=$(jf rt s --include-dirs apt-standard-${{ inputs.major_version }}-testing/pool/${{ inputs.module_name }}/*.deb | jq -r '.[].path')
SRC_PATHS=$(jf rt search --include-dirs "$ROOT_REPO_PATH-testing/pool/${{ inputs.module_name }}/*${{ inputs.distrib }}*.deb | jq -r '.[].path')

if [[ ${SRC_PATHS[@]} ]]; then
for SRC_PATH in ${SRC_PATHS[@]}; do
Expand All @@ -132,7 +134,7 @@ runs:
fi

echo "[DEBUG] - Build target path."
TARGET_PATH="apt-standard-${{ inputs.major_version }}-${{ inputs.stability }}/pool/${{ inputs.module_name }}/"
TARGET_PATH="$ROOT_REPO_PATH-${{ inputs.stability }}/pool/${{ inputs.module_name }}/"
echo "[DEBUG] - Target path: $TARGET_PATH"

echo "[DEBUG] - Promoting DEB testing artifacts to stable."
Expand All @@ -141,7 +143,7 @@ runs:
jf rt download $ARTIFACT --flat
done

for ARTIFACT_DL in $(dir|grep -E "*.deb"); do
for ARTIFACT_DL in $(dir -1|grep -E ".+${{ inputs.distrib }}.+\.deb"); do
ARCH=$(echo $ARTIFACT_DL | cut -d '_' -f3 | cut -d '.' -f1)
echo "[DEBUG] - Promoting (upload) $ARTIFACT_DL to stable $TARGET_PATH."
jf rt upload "$ARTIFACT_DL" "$TARGET_PATH" --deb "${{ inputs.distrib }}/main/$ARCH" --flat
Expand Down
16 changes: 10 additions & 6 deletions .github/actions/release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,17 @@ runs:
declare -a PREVIOUS_STABLE_TAGS=()
SCOPE_VERSION="COLLECT"
MINOR_VERSION_FILE_PATH=".version"
RELEASE_CLOUD=0

# Get current stable branch name
# If MASTER, use root .version
# Else use branch name
if [[ "${{ inputs.github_ref_name }}" == "master" ]]; then
CURRENT_STABLE_BRANCH_MAJOR_VERSION=$(grep -E "MAJOR" .version | cut -d '=' -f2)
RELEASE_CLOUD=1
else
CURRENT_STABLE_BRANCH_MAJOR_VERSION=$(echo ${{ inputs.github_ref_name }} | cut -d '.' -f1,2)
RELEASE_CLOUD=0
fi
echo "Current stable branch major version: $CURRENT_STABLE_BRANCH_MAJOR_VERSION"

Expand All @@ -54,10 +57,15 @@ runs:
MAJOR_VERSION=$(grep -E "MAJOR" .version | cut -d '=' -f2)
MINOR_VERSION=$(grep -E "MINOR" .version | cut -d '=' -f2)
# Previous stable tags array
PREVIOUS_STABLE_TAGS+=($(git tag -l --sort=-version:refname "$component-$CURRENT_STABLE_BRANCH_MAJOR_VERSION*" | head -n 1))
if [[ $RELEASE_CLOUD -eq 1 ]]; then
PREVIOUS_STABLE_TAGS+=($(git tag -l --sort=-version:refname "$component-$CURRENT_STABLE_BRANCH_MAJOR_VERSION.*-*" | head -n 1))
else
PREVIOUS_STABLE_TAGS+=($(git tag -l --sort=-version:refname "$component-$CURRENT_STABLE_BRANCH_MAJOR_VERSION.*" | grep -E "$component-$CURRENT_STABLE_BRANCH_MAJOR_VERSION.[0-9]+$" | head -n 1))
fi
# New stable tags array
TMP_STABLE_TAGS+=("$component-$MAJOR_VERSION.$MINOR_VERSION")
done

echo "Previous releases were: ${PREVIOUS_STABLE_TAGS[*]}"
echo "Temporary new releases are: ${TMP_STABLE_TAGS[*]}"
# Building final NEW_STABLE_TAGS with the new version tags only
Expand Down Expand Up @@ -96,11 +104,6 @@ runs:
git config --global user.email "[email protected]"
git config --global user.name "Centreon"

# Rebuild NEW_STABLE_TAGS as an array
for i in ${NEW_RELEASE_TAGS[@]}; do
NEW_RELEASE_TAGS+=("$i")
done

# Create release tags on git for each release components
# Abort if no tags or existing tag
echo "Creating release tags."
Expand Down Expand Up @@ -149,6 +152,7 @@ runs:
else
echo "::error::Release tag $TAG was empty, exiting."
exit 1
fi
done
shell: bash
env:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/centreon-collect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ on:
- conanfile.txt
- selinux/**
- "!.veracode-exclusions"
- "!veracode.json"
push:
branches:
- develop
Expand All @@ -41,6 +42,7 @@ on:
- conanfile.txt
- selinux/**
- "!.veracode-exclusions"
- "!veracode.json"

jobs:
get-version:
Expand Down Expand Up @@ -180,7 +182,6 @@ jobs:
major_version: ${{ needs.get-version.outputs.version }}
minor_version: ${{ needs.get-version.outputs.patch }}
stability: ${{ needs.get-version.outputs.stability }}
repository_name: standard
github_ref_name: ${{ github.ref_name }}
release_type: ${{ needs.get-version.outputs.release_type }}
release_cloud: ${{ needs.get-version.outputs.release_cloud }}
1 change: 0 additions & 1 deletion .github/workflows/libzmq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ jobs:
major_version: ${{ needs.get-version.outputs.version }}
minor_version: ${{ needs.get-version.outputs.patch }}
stability: ${{ needs.get-version.outputs.stability }}
repository_name: standard
github_ref_name: ${{ github.ref_name }}
release_type: ${{ needs.get-version.outputs.release_type }}
release_cloud: ${{ needs.get-version.outputs.release_cloud }}
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
MAJOR=23.04
MINOR=11
MINOR=12
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ endif()
# Version.
set(COLLECT_MAJOR 23)
set(COLLECT_MINOR 04)
set(COLLECT_PATCH 11)
set(COLLECT_PATCH 12)
set(COLLECT_VERSION "${COLLECT_MAJOR}.${COLLECT_MINOR}.${COLLECT_PATCH}")
add_definitions(-DCENTREON_CONNECTOR_VERSION=\"${COLLECT_VERSION}\")

Expand Down
44 changes: 26 additions & 18 deletions broker/bam/src/configuration/reader_v2.cc
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/*
** Copyright 2014-2017, 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 : [email protected]
*/
/**
* Copyright 2014-2017, 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 : [email protected]
*/

#include "com/centreon/broker/bam/configuration/reader_v2.hh"

Expand Down Expand Up @@ -506,7 +506,15 @@ void reader_v2::_load_dimensions() {
std::promise<database::mysql_result> promise_ba_tp;
std::future<database::mysql_result> future_ba_tp = promise_ba_tp.get_future();
_mysql.run_query_and_get_result(
"SELECT ba_id, tp_id FROM mod_bam_relations_ba_timeperiods",
fmt::format(
"SELECT bt.ba_id, bt.tp_id FROM mod_bam_relations_ba_timeperiods bt"
" INNER JOIN mod_bam AS b"
" ON b.ba_id = bt.ba_id"
" INNER JOIN mod_bam_poller_relations AS pr"
" ON b.ba_id=pr.ba_id"
" WHERE b.activate='1'"
" AND pr.poller_id={}",
config::applier::state::instance().poller_id()),
std::move(promise_ba_tp), 0);

try {
Expand Down
2 changes: 2 additions & 0 deletions broker/bam/src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

#include "bbdo/bam/ba_duration_event.hh"
#include "bbdo/bam/ba_event.hh"
#include "bbdo/bam/ba_status.hh"
#include "bbdo/bam/dimension_ba_bv_relation_event.hh"
#include "bbdo/bam/dimension_ba_event.hh"
Expand Down Expand Up @@ -109,6 +110,7 @@ void broker_module_init(void const* arg) {
e.register_event(make_type(io::storage, storage::de_status), "status",
&storage::status::operations, storage::status::entries);

register_bam_event<bam::ba_event>(e, bam::de_ba_event, "ba_event");
register_bam_event<bam::ba_status>(e, bam::de_ba_status, "ba_status");
register_bam_event<bam::kpi_status>(e, bam::de_kpi_status, "kpi_status");
register_bam_event<bam::kpi_event>(e, bam::de_kpi_event, "kpi_event");
Expand Down
2 changes: 1 addition & 1 deletion engine/scripts/logrotate_systemd.conf.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@ENGINE_VAR_LOG_DIR@/*.log {
compress
create 640 @USER@ @GROUP@
create 644 @USER@ @GROUP@
daily
delaycompress
missingok
Expand Down
Loading
Loading