Skip to content

Commit

Permalink
chore(packaging): package centreon-common in a dedicated workflow (#1886
Browse files Browse the repository at this point in the history
)
  • Loading branch information
kduret authored Nov 27, 2024
1 parent 5e47333 commit d51752e
Show file tree
Hide file tree
Showing 75 changed files with 714 additions and 63 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/centreon-collect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ on:
- custom-triplets/**
- engine/**
- grpc/**
- packaging/**
- packaging/centreon-collect/**
- cmake.sh
- cmake-vcpkg.sh
- CMakeLists.txt
- CMakeListsLinux.txt
- vcpkg.json
- overlays/**
- selinux/**
- "!selinux/centreon-common/**"
- "!.veracode-exclusions"
- "!veracode.json"
- "!**/test/**"
Expand All @@ -74,14 +75,15 @@ on:
- custom-triplets/**
- engine/**
- grpc/**
- packaging/**
- packaging/centreon-collect/**
- cmake.sh
- cmake-vcpkg.sh
- CMakeLists.txt
- CMakeListsLinux.txt
- vcpkg.json
- overlays/**
- selinux/**
- "!selinux/centreon-common/**"
- "!.veracode-exclusions"
- "!veracode.json"
- "!**/test/**"
Expand Down
169 changes: 169 additions & 0 deletions .github/workflows/centreon-common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
name: centreon-common

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

on:
workflow_dispatch:
pull_request:
paths:
- "packaging/centreon-common/**"
- "selinux/centreon-common/**"
push:
branches:
- develop
- dev-[2-9][0-9].[0-9][0-9].x
- master
- "[2-9][0-9].[0-9][0-9].x"
paths:
- "packaging/centreon-common/**"
- "selinux/centreon-common/**"

jobs:
get-environment:
uses: ./.github/workflows/get-environment.yml
with:
version_file: .version.centreon-common

package:
needs: [get-environment]

strategy:
fail-fast: false
matrix:
include:
- package_extension: rpm
image: centreon-collect-alma8
distrib: el8
- package_extension: rpm
image: centreon-collect-alma9
distrib: el9
- package_extension: deb
image: centreon-collect-debian-bookworm
distrib: bookworm
- package_extension: deb
image: centreon-collect-ubuntu-jammy
distrib: jammy

runs-on: ubuntu-24.04

container:
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:${{ needs.get-environment.outputs.img_version }}
credentials:
username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }}
password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }}

name: package ${{ matrix.distrib }}

steps:
- name: Checkout sources
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- name: Generate selinux binaries
if: ${{ matrix.package_extension == 'rpm' }}
run: |
cd selinux/centreon-common
sed -i "s/@VERSION@/${{ needs.get-environment.outputs.major_version }}.${{ needs.get-environment.outputs.minor_version }}/g" *.te
make -f /usr/share/selinux/devel/Makefile
shell: bash

- name: Remove selinux packaging files on debian
if: ${{ matrix.package_extension == 'deb' }}
run: rm -f packaging/centreon-common/*-selinux.yaml
shell: bash

- name: Package Centreon
uses: ./.github/actions/package
with:
nfpm_file_pattern: "packaging/centreon-common/*.yaml"
distrib: ${{ matrix.distrib }}
package_extension: ${{ matrix.package_extension }}
major_version: ${{ needs.get-environment.outputs.major_version }}
minor_version: ${{ needs.get-environment.outputs.minor_version }}
release: ${{ needs.get-environment.outputs.release }}
arch: all
commit_hash: ${{ github.sha }}
cache_key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }}
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 }}
stability: ${{ needs.get-environment.outputs.stability }}

deliver-rpm:
runs-on: [self-hosted, common]
needs: [get-environment, package]
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) }}

strategy:
matrix:
distrib: [el8, el9]

steps:
- name: Checkout sources
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- name: Delivery
uses: ./.github/actions/rpm-delivery
with:
module_name: common
distrib: ${{ matrix.distrib }}
version: ${{ needs.get-environment.outputs.major_version }}
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}
cache_key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }}
stability: ${{ needs.get-environment.outputs.stability }}
release_type: ${{ needs.get-environment.outputs.release_type }}
is_cloud: ${{ needs.get-environment.outputs.is_cloud }}

deliver-deb:
runs-on: [self-hosted, common]
needs: [get-environment, package]
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) }}

strategy:
matrix:
distrib: [bookworm, jammy]

steps:
- name: Checkout sources
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- name: Delivery
uses: ./.github/actions/deb-delivery
with:
module_name: common
distrib: ${{ matrix.distrib }}
version: ${{ needs.get-environment.outputs.major_version }}
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}
cache_key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.distrib }}
stability: ${{ needs.get-environment.outputs.stability }}
release_type: ${{ needs.get-environment.outputs.release_type }}
is_cloud: ${{ needs.get-environment.outputs.is_cloud }}

promote:
needs: [get-environment, deliver-deb, deliver-rpm]
if: |
(contains(fromJson('["stable", "testing"]'), needs.get-environment.outputs.stability) && github.event_name != 'workflow_dispatch') &&
! cancelled() &&
! contains(needs.*.result, 'failure') &&
! contains(needs.*.result, 'cancelled')
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: common
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 }}
2 changes: 1 addition & 1 deletion .github/workflows/get-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ jobs:
- name: Get version from ${{ inputs.version_file }}
id: get_version
run: |
if [[ "${{ inputs.version_file }}" == */.version ]]; then
if [[ "${{ inputs.version_file }}" == *.version* ]]; then
. .version
. ${{ inputs.version_file }}
VERSION="$MAJOR.$MINOR"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/package-collect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:

- name: Remove selinux packaging files on debian
if: ${{ inputs.package_extension == 'deb' }}
run: rm -f packaging/*-selinux.yaml
run: rm -f packaging/centreon-collect/*-selinux.yaml
shell: bash

- name: Compile sources
Expand Down Expand Up @@ -185,7 +185,7 @@ jobs:

- uses: ./.github/actions/package
with:
nfpm_file_pattern: "packaging/*.yaml"
nfpm_file_pattern: "packaging/centreon-collect/*.yaml"
distrib: ${{ inputs.distrib }}
package_extension: ${{ inputs.package_extension }}
major_version: ${{ inputs.major_version }}
Expand Down
1 change: 1 addition & 0 deletions .version.centreon-common
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MINOR=1
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ homepage: "https://www.centreon.com"
license: "Apache-2.0"

contents:
- src: "../build/broker/cbd.debug"
- src: "../../build/broker/cbd.debug"
dst: "/usr/sbin/"

- src: "../build/broker/watchdog/cbwd.debug"
- src: "../../build/broker/watchdog/cbwd.debug"
dst: "/usr/lib/debug/usr/sbin/"

overrides:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,42 @@ homepage: "https://www.centreon.com"
license: "Apache-2.0"

contents:
- src: "../broker/config/central-broker.json"
- src: "../../broker/config/central-broker.json"
dst: "/etc/centreon-broker/central-broker.json"
type: config|noreplace
file_info:
mode: 0664
owner: centreon-broker
group: centreon-broker

- src: "../broker/config/central-rrd.json"
- src: "../../broker/config/central-rrd.json"
dst: "/etc/centreon-broker/central-rrd.json"
type: config|noreplace
file_info:
mode: 0664
owner: centreon-broker
group: centreon-broker

- src: "../broker/script/watchdog.json"
- src: "../../broker/script/watchdog.json"
dst: "/etc/centreon-broker/watchdog.json"
type: config|noreplace
file_info:
mode: 0664
owner: centreon-broker
group: centreon-broker

- src: "../build/broker/cbd"
- src: "../../build/broker/cbd"
dst: "/usr/sbin/cbd"

- src: "../build/broker/watchdog/cbwd"
- src: "../../build/broker/watchdog/cbwd"
dst: "/usr/sbin/cbwd"

- src: "../broker/script/cbd.service"
- src: "../../broker/script/cbd.service"
dst: "/usr/lib/systemd/system/cbd.service"
file_info:
mode: 0644
packager: rpm
- src: "../broker/script/cbd.service"
- src: "../../broker/script/cbd.service"
dst: "/lib/systemd/system/cbd.service"
file_info:
mode: 0644
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ homepage: "https://www.centreon.com"
license: "Apache-2.0"

contents:
- src: "../build/broker/neb/cbmod.so.debug"
- src: "../../build/broker/neb/cbmod.so.debug"
dst: "/usr/lib/debug/usr/lib64/nagios/cbmod.so.debug"
file_info:
mode: 0644
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ homepage: "https://www.centreon.com"
license: "Apache-2.0"

contents:
- src: "../broker/config/central-module.json"
- src: "../../broker/config/central-module.json"
dst: "/etc/centreon-broker/central-module.json"
type: config|noreplace
file_info:
mode: 0664
owner: centreon-broker
group: centreon-broker

- src: "../build/broker/neb/cbmod.so"
- src: "../../build/broker/neb/cbmod.so"
dst: "/usr/lib64/nagios/cbmod.so"

overrides:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ homepage: "https://www.centreon.com"
license: "Apache-2.0"

contents:
- src: "../build/broker/{neb,stats,bam,storage,unified_sql,tcp,grpc,tls,rrd,lua,sql}/*.so.debug"
- src: "../../build/broker/{neb,stats,bam,storage,unified_sql,tcp,grpc,tls,rrd,lua,sql}/*.so.debug"
dst: "/usr/lib/debug/usr/share/centreon/lib/centreon-broker/"
file_info:
mode: 0644
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ homepage: "https://www.centreon.com"
license: "Apache-2.0"

contents:
- src: "../build/broker/{neb,stats,bam,storage,unified_sql,tcp,grpc,tls,rrd,lua,sql}/*.so"
- src: "../../build/broker/{neb,stats,bam,storage,unified_sql,tcp,grpc,tls,rrd,lua,sql}/*.so"
dst: "/usr/share/centreon/lib/centreon-broker/"

- src: "../broker/script/centreon-broker.logrotate"
- src: "../../broker/script/centreon-broker.logrotate"
dst: "/etc/logrotate.d/cbd"
type: config|noreplace

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ homepage: "https://www.centreon.com"
license: "Apache-2.0"

contents:
- src: "../build/broker/graphite/70-graphite.so.debug"
- src: "../../build/broker/graphite/70-graphite.so.debug"
dst: "/usr/share/centreon/lib/centreon-broker/"

overrides:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ homepage: "https://www.centreon.com"
license: "Apache-2.0"

contents:
- src: "../build/broker/graphite/70-graphite.so"
- src: "../../build/broker/graphite/70-graphite.so"
dst: "/usr/share/centreon/lib/centreon-broker/"

overrides:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ homepage: "https://www.centreon.com"
license: "Apache-2.0"

contents:
- src: "../build/broker/influxdb/70-influxdb.so.debug"
- src: "../../build/broker/influxdb/70-influxdb.so.debug"
dst: "/usr/lib/debug/usr/share/centreon/lib/centreon-broker/"

overrides:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ homepage: "https://www.centreon.com"
license: "Apache-2.0"

contents:
- src: "../build/broker/influxdb/70-influxdb.so"
- src: "../../build/broker/influxdb/70-influxdb.so"
dst: "/usr/share/centreon/lib/centreon-broker/"

overrides:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ provides:
- centreon-broker-selinux-debuginfo

contents:
- src: "../selinux/centreon-broker/centreon-broker.pp"
- src: "../../selinux/centreon-broker/centreon-broker.pp"
dst: "/usr/share/selinux/packages/centreon/centreon-broker.pp"
file_info:
mode: 0655
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ homepage: "https://www.centreon.com"
license: "Apache-2.0"

contents:
- src: "../build/broker/victoria_metrics/70-victoria_metrics.so.debug"
- src: "../../build/broker/victoria_metrics/70-victoria_metrics.so.debug"
dst: "/usr/lib/debug/usr/share/centreon/lib/centreon-broker/"

overrides:
Expand Down
Loading

0 comments on commit d51752e

Please sign in to comment.