MON-111643 Centreon next 22.10 (Jira release #19890#) #3657
Workflow file for this run
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 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
pull_request: | |
paths: | |
- bbdo/** | |
- broker/** | |
- ccc/** | |
- clib/** | |
- connectors/** | |
- engine/** | |
- grpc/** | |
- packaging/** | |
- cmake.sh | |
- CMakeLists.txt | |
- conanfile.txt | |
- selinux/** | |
- "!.veracode-exclusions" | |
- "!veracode.json" | |
push: | |
branches: | |
- develop | |
- dev-[2-9][0-9].[0-9][0-9].x | |
- master | |
- "[2-9][0-9].[0-9][0-9].x" | |
paths: | |
- bbdo/** | |
- broker/** | |
- ccc/** | |
- clib/** | |
- connectors/** | |
- engine/** | |
- grpc/** | |
- packaging/** | |
- cmake.sh | |
- CMakeLists.txt | |
- conanfile.txt | |
- selinux/** | |
- "!.veracode-exclusions" | |
- "!veracode.json" | |
jobs: | |
get-version: | |
uses: ./.github/workflows/get-version.yml | |
create-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- id: version | |
run: | | |
IMG_VERSION=$(md5sum conanfile.txt | awk '{print substr($1, 0, 8)}') | |
echo "imgversion=$IMG_VERSION" >> $GITHUB_OUTPUT | |
VERSION=$(awk '$1 ~ "COLLECT_MAJOR" {maj=substr($2, 1, length($2)-1)} $1 ~ "COLLECT_MINOR" {min=substr($2, 1, length($2)-1) ; print maj "." min}' CMakeLists.txt) | |
PATCH=$(awk '$1 ~ "COLLECT_PATCH" {print substr($2, 1, length($2) - 1)}' CMakeLists.txt) | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
echo "patch=$PATCH" >> $GITHUB_OUTPUT | |
if [[ -z "$GITHUB_HEAD_REF" ]] ; then | |
BRANCHNAME="$GITHUB_REF_NAME" | |
else | |
BRANCHNAME="$GITHUB_HEAD_REF" | |
fi | |
case "$BRANCHNAME" in | |
master | [2-9][0-9].[0-9][0-9].x | release* | hotfix*) | |
echo "release=1" >> $GITHUB_OUTPUT | |
;; | |
*) | |
echo "release=`date +%s`.`echo ${{ github.sha }} | cut -c -7`" >> $GITHUB_OUTPUT | |
;; | |
esac | |
shell: bash | |
- run: | | |
echo "ImgVersion is ${{ steps.version.outputs.imgversion }}" | |
echo "Version is ${{ steps.version.outputs.version }}.${{ steps.version.outputs.patch }}" | |
echo "Release is ${{ steps.version.outputs.release }}" | |
outputs: | |
imgversion: ${{ steps.version.outputs.imgversion }} | |
version: ${{ steps.version.outputs.version }} | |
patch: ${{ steps.version.outputs.patch }} | |
release: ${{ steps.version.outputs.release }} | |
centreon-collect-test: | |
needs: [create-version, get-version] | |
if: ${{ ! contains(fromJson('["stable"]'), needs.get-version.outputs.stability) }} | |
runs-on: [self-hosted, collect] | |
env: | |
imgversion: ${{ needs.create-version.outputs.imgversion }} | |
version: ${{ needs.create-version.outputs.version }}.${{ needs.create-version.outputs.patch }} | |
release: ${{ needs.create-version.outputs.release }} | |
strategy: | |
fail-fast: false | |
matrix: | |
image: [centos7, alma8, debian-bullseye] | |
name: unit test ${{ matrix.image }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Login to Registry | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | |
with: | |
registry: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }} | |
username: ${{ secrets.DOCKER_REGISTRY_ID }} | |
password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} | |
- name: Test ${{ matrix.image }} | |
uses: ./.github/actions/runner-docker | |
with: | |
registry_url: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }} | |
script_name: /src/ci/scripts/collect-unit-tests | |
image_name: centreon-collect-${{ matrix.image }} | |
image_version: ${{ env.imgversion }} | |
rpm-packaging: | |
needs: [create-version, get-version] | |
if: ${{ ! contains(fromJson('["stable"]'), needs.get-version.outputs.stability) }} | |
runs-on: [self-hosted, collect] | |
env: | |
version: ${{ needs.create-version.outputs.version }}.${{ needs.create-version.outputs.patch }} | |
imgversion: ${{ needs.create-version.outputs.imgversion }} | |
release: ${{ needs.create-version.outputs.release }} | |
strategy: | |
matrix: | |
include: | |
- image: centos7 | |
distrib: el7 | |
- image: alma8 | |
distrib: el8 | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Login to Registry | |
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0 | |
with: | |
registry: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }} | |
username: ${{ secrets.DOCKER_REGISTRY_ID }} | |
password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} | |
- name: make rpm ${{ matrix.image }} | |
uses: ./.github/actions/runner-docker | |
with: | |
registry_url: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }} | |
script_name: /src/ci/scripts/collect-rpm-package | |
image_name: centreon-collect-${{ matrix.image }} | |
image_version: ${{ env.imgversion }} | |
env_variable: -e DISTRIB="${{ matrix.distrib }}" -e VERSION="${{ env.version }}" -e RELEASE="${{ env.release }}" | |
- name: sign rpm ${{ matrix.image }} | |
uses: ./.github/actions/package-sign | |
with: | |
script_name: rpm-signing | |
image_name: rpm-signing | |
image_version: ubuntu | |
registry_url: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }} | |
registry_username: ${{ secrets.DOCKER_REGISTRY_ID }} | |
registry_password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} | |
- name: Use cache RPM files | |
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 | |
env: | |
cache-name-rpmbuild: cache-${{ github.sha }}-${{ github.run_id }}-rpmbuild-collect-${{ matrix.distrib }} | |
with: | |
path: ./*.rpm | |
key: ${{ env.cache-name-rpmbuild }} | |
debian-packaging: | |
needs: [create-version, get-version] | |
if: ${{ ! contains(fromJson('["stable"]'), needs.get-version.outputs.stability) }} | |
runs-on: [self-hosted, collect] | |
env: | |
imgversion: ${{ needs.create-version.outputs.imgversion }} | |
version: ${{ needs.create-version.outputs.version }}.${{ needs.create-version.outputs.patch }} | |
release: ${{ needs.create-version.outputs.release }} | |
strategy: | |
matrix: | |
include: | |
- image: debian-bullseye | |
distrib: bullseye | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
path: centreon-collect | |
- name: Login to Registry | |
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0 | |
with: | |
registry: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }} | |
username: ${{ secrets.DOCKER_REGISTRY_ID }} | |
password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} | |
- name: debmake ${{ matrix.image }} | |
uses: ./centreon-collect/.github/actions/runner-docker | |
with: | |
registry_url: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }} | |
script_name: /src/centreon-collect/ci/scripts/collect-deb-package | |
image_name: centreon-collect-${{ matrix.image }} | |
image_version: ${{ env.imgversion }} | |
env_variable: -e DISTRIB="${{ matrix.distrib }}" -e VERSION="${{ env.version }}" -e RELEASE="${{ env.release }}" | |
- name: Use cache DEB files | |
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 | |
env: | |
cache-name-debbuild: cache-${{ github.sha }}-${{ github.run_id }}-debbuild-centreon-collect-${{ matrix.distrib }} | |
with: | |
path: ./*.deb | |
key: ${{ env.cache-name-debbuild }} | |
deliver-sources: | |
runs-on: [self-hosted, common] | |
needs: [get-version, debian-packaging, rpm-packaging] | |
if: ${{ contains(fromJson('["stable"]'), needs.get-version.outputs.stability) && github.event_name != 'workflow_dispatch' }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
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-version.outputs.version }} | |
minor_version: ${{ needs.get-version.outputs.patch }} | |
token_download_centreon_com: ${{ secrets.TOKEN_DOWNLOAD_CENTREON_COM }} | |
delivery-rpm: | |
needs: [rpm-packaging, create-version, get-version] | |
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-version.outputs.stability) }} | |
env: | |
version: ${{ needs.create-version.outputs.version }} | |
environment: ${{ needs.get-version.outputs.environment }} | |
runs-on: [self-hosted, common] | |
name: Delivery | |
strategy: | |
matrix: | |
distrib: [el7, el8] | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Publish RPM packages | |
uses: ./.github/actions/delivery | |
with: | |
distrib: ${{ matrix.distrib }} | |
version: ${{ env.version }} | |
module_name: collect | |
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} | |
cache_key: cache-${{ github.sha }}-${{ github.run_id }}-rpmbuild-collect-${{ matrix.distrib }} | |
stability: ${{ needs.get-version.outputs.stability }} | |
release_type: ${{ needs.get-version.outputs.release_type }} | |
release_cloud: ${{ needs.get-version.outputs.release_cloud }} | |
delivery-debian: | |
needs: [debian-packaging, create-version, get-version] | |
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-version.outputs.stability) }} | |
env: | |
version: ${{ needs.create-version.outputs.version }} | |
environment: ${{ needs.get-version.outputs.environment }} | |
runs-on: [self-hosted, common] | |
name: Delivery | |
strategy: | |
matrix: | |
distrib: [bullseye] | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Publish DEB packages | |
uses: ./.github/actions/delivery | |
with: | |
module_name: collect | |
distrib: ${{ matrix.distrib }} | |
version: ${{ env.version }} | |
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} | |
cache_key: cache-${{ github.sha }}-${{ github.run_id }}-debbuild-centreon-collect-${{ matrix.distrib }} | |
stability: ${{ needs.get-version.outputs.stability }} | |
release_type: ${{ needs.get-version.outputs.release_type }} | |
release_cloud: ${{ needs.get-version.outputs.release_cloud }} | |
promote: | |
needs: [get-version] | |
if: ${{ contains(fromJson('["stable"]'), needs.get-version.outputs.stability) && github.event_name != 'workflow_dispatch' }} | |
runs-on: [self-hosted, common] | |
strategy: | |
matrix: | |
distrib: [el7, el8, bullseye] | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- 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-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 }} |