collect nightly develop #5454
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Centreon collect | |
run-name: | | |
${{ | |
(github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.nightly_manual_trigger == 'true')) | |
&& format('collect nightly {0}', github.ref_name) | |
|| '' | |
}} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
inputs: | |
nightly_manual_trigger: | |
description: 'Set to true for nightly run' | |
required: true | |
default: false | |
type: boolean | |
legacy_engine: | |
description: 'Compile Engine with legacy configuration library' | |
required: true | |
default: false | |
type: boolean | |
packages_in_artifact: | |
description: 'Save packages in artifacts' | |
required: true | |
default: false | |
type: boolean | |
unit_tests: | |
description: 'Execute the unit tests' | |
required: true | |
default: true | |
type: boolean | |
schedule: | |
- cron: '30 0 * * 1-5' | |
pull_request: | |
paths: | |
- agent/** | |
- bbdo/** | |
- broker/** | |
- ccc/** | |
- clib/** | |
- connectors/** | |
- custom-triplets/** | |
- engine/** | |
- grpc/** | |
- packaging/centreon-collect/** | |
- cmake.sh | |
- cmake-vcpkg.sh | |
- CMakeLists.txt | |
- CMakeListsLinux.txt | |
- vcpkg.json | |
- overlays/** | |
- selinux/** | |
- "!selinux/centreon-common/**" | |
- "!.veracode-exclusions" | |
- "!veracode.json" | |
- "!**/test/**" | |
push: | |
branches: | |
- develop | |
- dev-[2-9][0-9].[0-9][0-9].x | |
- master | |
- "[2-9][0-9].[0-9][0-9].x" | |
paths: | |
- agent/** | |
- bbdo/** | |
- broker/** | |
- ccc/** | |
- clib/** | |
- connectors/** | |
- custom-triplets/** | |
- engine/** | |
- grpc/** | |
- packaging/centreon-collect/** | |
- cmake.sh | |
- cmake-vcpkg.sh | |
- CMakeLists.txt | |
- CMakeListsLinux.txt | |
- vcpkg.json | |
- overlays/** | |
- selinux/** | |
- "!selinux/centreon-common/**" | |
- "!.veracode-exclusions" | |
- "!veracode.json" | |
- "!**/test/**" | |
jobs: | |
# dispatch-to-maintained-branches: | |
# if: ${{ github.run_attempt == 1 && github.event_name == 'schedule' && github.ref_name == 'develop' }} | |
# runs-on: ubuntu-24.04 | |
# steps: | |
# - name: Checkout sources | |
# uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
# - name: Check current day of the week | |
# id: day_check | |
# run: echo "day_of_week=$(date +%u)" >> $GITHUB_OUTPUT | |
# shell: bash | |
# - if: ${{ steps.day_check.outputs.day_of_week == '1' }} | |
# run: | | |
# NIGHTLY_TARGETS=("dev-22.10.x" "dev-23.04.x" "dev-23.10.x" "dev-24.04.x" "dev-24.10.x") | |
# for target in "${NIGHTLY_TARGETS[@]}"; do | |
# echo "[INFO] - Dispatching nightly run to $target branch." | |
# gh workflow run centreon-collect.yml -r "$target" -f is_nightly=true | |
# done | |
# shell: bash | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
get-environment: | |
uses: ./.github/workflows/get-environment.yml | |
with: | |
version_file: CMakeLists.txt | |
nightly_manual_trigger: ${{ inputs.nightly_manual_trigger || false }} | |
veracode-analysis: | |
needs: [get-environment] | |
if: ${{ github.event_name == 'schedule' && github.ref_name == 'develop' }} | |
uses: ./.github/workflows/veracode-analysis.yml | |
with: | |
module_name: centreon-collect | |
major_version: ${{ needs.get-environment.outputs.major_version }} | |
minor_version: ${{ needs.get-environment.outputs.minor_version }} | |
img_version: ${{ needs.get-environment.outputs.img_version }} | |
secrets: | |
veracode_api_id: ${{ secrets.VERACODE_API_ID_COLL }} | |
veracode_api_key: ${{ secrets.VERACODE_API_KEY_COLL }} | |
veracode_srcclr_token: ${{ secrets.VERACODE_SRCCLR_TOKEN }} | |
docker_registry_id: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }} | |
docker_registry_passwd: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }} | |
unit-test: | |
needs: [get-environment] | |
if: | | |
github.event.inputs.unit_tests == 'true' && | |
needs.get-environment.outputs.skip_workflow == 'false' && | |
needs.get-environment.outputs.stability != 'stable' | |
strategy: | |
fail-fast: false | |
matrix: | |
distrib: [alma8, alma9, debian-bookworm] | |
runs-on: [self-hosted, collect] | |
env: | |
SCCACHE_PATH: "/usr/bin/sccache" | |
SCCACHE_BUCKET: "centreon-github-sccache" | |
SCCACHE_REGION: "eu-west-1" | |
AWS_ACCESS_KEY_ID: ${{ secrets.COLLECT_S3_ACCESS_KEY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.COLLECT_S3_SECRET_KEY }} | |
LEGACY_ENGINE: ${{ github.event.inputs.legacy_engine != 'true' && 'OFF' || 'ON' }} | |
container: | |
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/centreon-collect-${{ matrix.distrib }}:${{ needs.get-environment.outputs.img_version }} | |
credentials: | |
username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }} | |
password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }} | |
name: unit test ${{ matrix.distrib }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- name: Install sccache | |
run: | | |
if ! command -v wget &> /dev/null; then | |
if [[ "${{ matrix.distrib }}" == "alma8" || "${{ matrix.distrib }}" == "alma9" ]]; then | |
dnf install -y wget | |
else | |
apt-get update | |
apt-get install -y wget | |
fi | |
fi | |
wget https://github.com/mozilla/sccache/releases/download/v0.8.1/sccache-v0.8.1-x86_64-unknown-linux-musl.tar.gz | |
tar xzf sccache-v0.8.1-x86_64-unknown-linux-musl.tar.gz | |
mv sccache-v0.8.1-x86_64-unknown-linux-musl/sccache /usr/bin/ | |
${SCCACHE_PATH} --start-server | |
shell: bash | |
- name: Compile centreon-collect | |
run: | | |
CMAKE="cmake" | |
if [[ "${{ matrix.distrib }}" == "alma8" || "${{ matrix.distrib }}" == "alma9" ]]; then | |
CMAKE="cmake3" | |
fi | |
export VCPKG_ROOT=/vcpkg | |
export PATH=$VCPKG_ROOT:$PATH | |
mv /root/.cache /github/home/ | |
CXXFLAGS="-Wall -Wextra" $CMAKE \ | |
-B build \ | |
-DVCPKG_OVERLAY_TRIPLETS=/custom-triplets \ | |
-DVCPKG_TARGET_TRIPLET=x64-linux-release \ | |
-DVCPKG_OVERLAY_PORTS=/overlays \ | |
-GNinja \ | |
-DDEBUG_ROBOT=OFF \ | |
-DCMAKE_EXPORT_COMPILE_COMMANDS=On \ | |
-DCMAKE_BUILD_TYPE=Debug \ | |
-DWITH_PREFIX=/usr \ | |
-DWITH_PREFIX_BIN=/usr/sbin \ | |
-DWITH_USER_BROKER=centreon-broker \ | |
-DWITH_USER_ENGINE=centreon-engine \ | |
-DWITH_GROUP_BROKER=centreon-broker \ | |
-DWITH_GROUP_ENGINE=centreon-engine \ | |
-DWITH_TESTING=On \ | |
-DWITH_PREFIX_MODULES=/usr/share/centreon/lib/centreon-broker \ | |
-DWITH_PREFIX_CONF_BROKER=/etc/centreon-broker \ | |
-DWITH_PREFIX_LIB_BROKER=/usr/lib64/nagios \ | |
-DWITH_PREFIX_CONF_ENGINE=/etc/centreon-engine \ | |
-DWITH_PREFIX_LIB_ENGINE=/usr/lib64/centreon-engine \ | |
-DWITH_PREFIX_LIB_CLIB=/usr/lib64/ \ | |
-DWITH_RW_DIR=/var/lib/centreon-engine/rw \ | |
-DWITH_VAR_DIR=/var/log/centreon-engine \ | |
-DWITH_MODULE_SIMU=On \ | |
-DCMAKE_C_COMPILER_LAUNCHER=${SCCACHE_PATH} \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER=${SCCACHE_PATH} \ | |
-DLEGACY_ENGINE=${LEGACY_ENGINE} \ | |
-S . | |
ninja -Cbuild | |
ninja -Cbuild install | |
shell: bash | |
- name: Cache statistics | |
run: ${SCCACHE_PATH} --show-stats | |
shell: bash | |
- name: Stop sccache server | |
run: ${SCCACHE_PATH} --stop-server | |
shell: bash | |
- name: Run unit tests | |
run: | | |
tests/ut_broker --gtest_output=xml:ut_broker.xml | |
tests/ut_engine --gtest_output=xml:ut_engine.xml | |
tests/ut_clib --gtest_output=xml:ut_clib.xml | |
tests/ut_connector --gtest_output=xml:ut_connector.xml | |
tests/ut_common --gtest_output=xml:ut_common.xml | |
tests/ut_agent --gtest_output=xml:ut_agent.xml | |
working-directory: build | |
shell: bash | |
package: | |
needs: [get-environment] | |
if: | | |
needs.get-environment.outputs.skip_workflow == 'false' && | |
needs.get-environment.outputs.stability != 'stable' | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- image: centreon-collect-alma8 | |
distrib: el8 | |
package_extension: rpm | |
runner: collect | |
arch: amd64 | |
- image: centreon-collect-alma9 | |
distrib: el9 | |
package_extension: rpm | |
runner: collect | |
arch: amd64 | |
- image: centreon-collect-debian-bookworm | |
distrib: bookworm | |
package_extension: deb | |
runner: collect | |
arch: amd64 | |
- image: centreon-collect-debian-bookworm-arm64 | |
distrib: bookworm | |
package_extension: deb | |
runner: collect-arm64 | |
arch: arm64 | |
uses: ./.github/workflows/package-collect.yml | |
with: | |
major_version: ${{ needs.get-environment.outputs.major_version }} | |
minor_version: ${{ needs.get-environment.outputs.minor_version }} | |
img_version: ${{ needs.get-environment.outputs.img_version }} | |
release: ${{ needs.get-environment.outputs.release }} | |
commit_hash: ${{ github.sha }} | |
stability: ${{ needs.get-environment.outputs.stability }} | |
legacy_engine: ${{ github.event.inputs.legacy_engine != 'true' && 'OFF' || 'ON' }} | |
build_debug_packages: ${{ needs.get-environment.outputs.stability == 'testing' || contains(github.event.pull_request.labels.*.name, 'build-debug-packages') }} | |
packages_in_artifact: ${{ github.event.inputs.packages_in_artifact == 'true' }} | |
image: ${{ matrix.image }} | |
distrib: ${{ matrix.distrib }} | |
package_extension: ${{ matrix.package_extension }} | |
runner: ${{ matrix.runner }} | |
arch: ${{ matrix.arch }} | |
is_nightly: ${{ needs.get-environment.outputs.is_nightly }} | |
secrets: | |
collect_s3_access_key: ${{ secrets.COLLECT_S3_ACCESS_KEY }} | |
collect_s3_secret_key: ${{ secrets.COLLECT_S3_SECRET_KEY }} | |
registry_username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }} | |
registry_password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }} | |
rpm_gpg_key: ${{ secrets.RPM_GPG_SIGNING_KEY }} | |
rpm_gpg_signing_key_id: ${{ secrets.RPM_GPG_SIGNING_KEY_ID }} | |
rpm_gpg_signing_passphrase: ${{ secrets.RPM_GPG_SIGNING_PASSPHRASE }} | |
jira_base_url: ${{ secrets.JIRA_BASE_URL }} | |
jira_user_email: ${{ secrets.XRAY_JIRA_USER_EMAIL }} | |
jira_api_token: ${{ secrets.XRAY_JIRA_TOKEN }} | |
robot-test: | |
needs: [get-environment, package] | |
if: | | |
needs.get-environment.outputs.skip_workflow == 'false' && | |
needs.get-environment.outputs.stability != 'stable' && | |
needs.get-environment.outputs.is_nightly == 'true' && | |
! cancelled() && | |
! contains(needs.*.result, 'failure') && | |
! contains(needs.*.result, 'cancelled') && | |
github.repository == 'centreon/centreon-collect' | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- distrib: el9 | |
image: centreon-collect-alma9-test | |
package_extension: rpm | |
arch: amd64 | |
database_type: mariadb | |
test_group_name: robot_test-mariadb-el9-amd64 | |
tests_params: '{}' | |
- distrib: el9 | |
image: centreon-collect-mysql-alma9-test | |
package_extension: rpm | |
arch: amd64 | |
database_type: mysql | |
test_group_name: robot_test-mysql-el9-amd64 | |
tests_params: '{}' | |
- distrib: bookworm | |
image: centreon-collect-debian-bookworm-arm64-test | |
package_extension: deb | |
arch: arm64 | |
database_type: mariadb | |
test_group_name: robot_test-mariadb-bookworm-arm64 | |
tests_params: '{}' | |
- distrib: bookworm | |
image: centreon-collect-debian-bookworm-test | |
package_extension: deb | |
arch: amd64 | |
database_type: mariadb | |
test_group_name: robot_test-mariadb-bookworm-amd64 | |
tests_params: '{}' | |
- distrib: el9 | |
image: centreon-collect-alma9-test | |
package_extension: rpm | |
arch: amd64 | |
database_type: mariadb | |
test_group_name: robot_test-mariadb-el9-amd64-grpc | |
tests_params: '{"default_transport":"grpc","default_bbdo_version":"3.1.0"}' | |
name: ${{ matrix.test_group_name }} | |
uses: ./.github/workflows/robot-test.yml | |
with: | |
distrib: ${{ matrix.distrib }} | |
arch: ${{ matrix.arch }} | |
image: ${{ matrix.image }} | |
image_test: ${{ matrix.image }}:${{ needs.get-environment.outputs.test_img_version }} | |
image_version: ${{ needs.get-environment.outputs.img_version }} | |
package_cache_key: ${{ github.run_id }}-${{ github.sha }}-${{ matrix.package_extension }}-centreon-collect-${{ matrix.distrib }}-${{ matrix.arch }}-${{ github.head_ref || github.ref_name }} | |
package_cache_path: ./*.${{ matrix.package_extension }} | |
database_type: ${{ matrix.database_type }} | |
tests_params: ${{ matrix.tests_params }} | |
test_group_name: ${{ matrix.test_group_name }} | |
is_nightly: ${{ needs.get-environment.outputs.is_nightly }} | |
secrets: | |
registry_username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }} | |
registry_password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }} | |
collect_s3_access_key: ${{ secrets.COLLECT_S3_ACCESS_KEY }} | |
collect_s3_secret_key: ${{ secrets.COLLECT_S3_SECRET_KEY }} | |
xray_client_id: ${{ secrets.XRAY_CLIENT_ID }} | |
xray_client_secret: ${{ secrets.XRAY_CLIENT_SECRET }} | |
jira_base_url: ${{ secrets.JIRA_BASE_URL }} | |
jira_user_email: ${{ secrets.XRAY_JIRA_USER_EMAIL }} | |
jira_api_token: ${{ secrets.XRAY_JIRA_TOKEN }} | |
deliver-sources: | |
runs-on: [self-hosted, common] | |
needs: [get-environment, package] | |
if: | | |
github.event_name != 'workflow_dispatch' && | |
needs.get-environment.outputs.stability == 'stable' && | |
! cancelled() && | |
! contains(needs.*.result, 'failure') && | |
! contains(needs.*.result, 'cancelled') && | |
github.repository == 'centreon/centreon-collect' | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
with: | |
path: centreon-collect | |
- name: Deliver sources | |
uses: ./centreon-collect/.github/actions/release-sources | |
with: | |
bucket_directory: centreon-collect | |
module_directory: centreon-collect | |
module_name: centreon-collect | |
major_version: ${{ needs.get-environment.outputs.major_version }} | |
minor_version: ${{ needs.get-environment.outputs.minor_version }} | |
token_download_centreon_com: ${{ secrets.TOKEN_DOWNLOAD_CENTREON_COM }} | |
deliver-rpm: | |
if: | | |
needs.get-environment.outputs.skip_workflow == 'false' && | |
contains(fromJson('["unstable", "testing"]'), needs.get-environment.outputs.stability) && | |
! cancelled() && | |
! contains(needs.*.result, 'failure') && | |
! contains(needs.*.result, 'cancelled') && | |
github.repository == 'centreon/centreon-collect' | |
needs: [get-environment, robot-test] | |
runs-on: [self-hosted, common] | |
strategy: | |
matrix: | |
include: | |
- distrib: el8 | |
arch: amd64 | |
- distrib: el9 | |
arch: amd64 | |
name: deliver ${{ matrix.distrib }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- name: Publish RPM packages | |
uses: ./.github/actions/delivery | |
with: | |
module_name: collect | |
distrib: ${{ matrix.distrib }} | |
major_version: ${{ needs.get-environment.outputs.major_version }} | |
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} | |
cache_key: ${{ github.run_id }}-${{ github.sha }}-rpm-centreon-collect-${{ matrix.distrib }}-${{ matrix.arch }}-${{ github.head_ref || github.ref_name }} | |
stability: ${{ needs.get-environment.outputs.stability }} | |
release_type: ${{ needs.get-environment.outputs.release_type }} | |
is_cloud: ${{ needs.get-environment.outputs.is_cloud }} | |
- name: Create Jira ticket if nightly build failure | |
if: | | |
needs.get-environment.outputs.is_nightly == 'true' && github.run_attempt == 1 && | |
failure() && | |
startsWith(github.ref_name, 'dev') | |
uses: ./.github/actions/create-jira-ticket | |
with: | |
jira_base_url: ${{ secrets.JIRA_BASE_URL }} | |
jira_user_email: ${{ secrets.XRAY_JIRA_USER_EMAIL }} | |
jira_api_token: ${{ secrets.XRAY_JIRA_TOKEN }} | |
module_name: "centreon-collect" | |
ticket_labels: '["Nightly", "Pipeline", "nightly-${{ github.ref_name }}", "${{ github.job }}"]' | |
deliver-deb: | |
if: | | |
needs.get-environment.outputs.skip_workflow == 'false' && | |
contains(fromJson('["unstable", "testing"]'), needs.get-environment.outputs.stability) && | |
! cancelled() && | |
! contains(needs.*.result, 'failure') && | |
! contains(needs.*.result, 'cancelled') && | |
github.repository == 'centreon/centreon-collect' | |
needs: [get-environment, robot-test] | |
runs-on: [self-hosted, common] | |
strategy: | |
matrix: | |
include: | |
- distrib: bookworm | |
arch: amd64 | |
name: deliver ${{ matrix.distrib }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- name: Publish DEB packages | |
uses: ./.github/actions/delivery | |
with: | |
module_name: collect | |
distrib: ${{ matrix.distrib }} | |
major_version: ${{ needs.get-environment.outputs.major_version }} | |
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} | |
cache_key: ${{ github.run_id }}-${{ github.sha }}-deb-centreon-collect-${{ matrix.distrib }}-${{ matrix.arch }}-${{ github.head_ref || github.ref_name }} | |
stability: ${{ needs.get-environment.outputs.stability }} | |
release_type: ${{ needs.get-environment.outputs.release_type }} | |
is_cloud: ${{ needs.get-environment.outputs.is_cloud }} | |
- name: Create Jira ticket if nightly build failure | |
if: | | |
needs.get-environment.outputs.is_nightly == 'true' && github.run_attempt == 1 && | |
failure() && | |
startsWith(github.ref_name, 'dev') && | |
github.repository == 'centreon/centreon-collect' | |
uses: ./.github/actions/create-jira-ticket | |
with: | |
jira_base_url: ${{ secrets.JIRA_BASE_URL }} | |
jira_user_email: ${{ secrets.XRAY_JIRA_USER_EMAIL }} | |
jira_api_token: ${{ secrets.XRAY_JIRA_TOKEN }} | |
module_name: "centreon-collect" | |
ticket_labels: '["Nightly", "Pipeline", "nightly-${{ github.ref_name }}", "${{ github.job }}"]' | |
promote: | |
needs: [get-environment, deliver-rpm, deliver-deb] | |
if: | | |
needs.get-environment.outputs.skip_workflow == 'false' && | |
(contains(fromJson('["stable", "testing"]'), needs.get-environment.outputs.stability) && github.event_name != 'workflow_dispatch') && | |
! cancelled() && | |
! contains(needs.*.result, 'failure') && | |
! contains(needs.*.result, 'cancelled') && | |
github.repository == 'centreon/centreon-collect' | |
runs-on: [self-hosted, common] | |
strategy: | |
matrix: | |
distrib: [el8, el9, bookworm] | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- name: Promote ${{ matrix.distrib }} to stable | |
uses: ./.github/actions/promote-to-stable | |
with: | |
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} | |
module_name: collect | |
distrib: ${{ matrix.distrib }} | |
major_version: ${{ needs.get-environment.outputs.major_version }} | |
stability: ${{ needs.get-environment.outputs.stability }} | |
github_ref_name: ${{ github.ref_name }} | |
release_type: ${{ needs.get-environment.outputs.release_type }} | |
is_cloud: ${{ needs.get-environment.outputs.is_cloud }} | |
set-skip-label: | |
needs: [get-environment, deliver-rpm, deliver-deb, promote] | |
if: | | |
needs.get-environment.outputs.skip_workflow == 'false' && | |
! cancelled() && | |
! contains(needs.*.result, 'failure') && | |
! contains(needs.*.result, 'cancelled') | |
uses: ./.github/workflows/set-pull-request-skip-label.yml |