Skip to content

Commit

Permalink
Centreon 23.10 (Jira release #19428#)
Browse files Browse the repository at this point in the history
  • Loading branch information
paloth authored Oct 30, 2023
2 parents 109b154 + 26cb954 commit 919f04d
Show file tree
Hide file tree
Showing 1,209 changed files with 86,494 additions and 42,194 deletions.
16 changes: 16 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version = 1

[[analyzers]]
name = "shell"
enabled = true

[[analyzers]]
name = "python"
enabled = true

[analyzers.meta]
runtime_version = "3.x.x"

[[analyzers]]
name = "cxx"
enabled = true
37 changes: 37 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## Description

Please include a short resume of the changes and what is the purpose of PR. Any relevant information should be added to help:
* **QA Team** (Quality Assurance) with tests.
* **reviewers** to understand what are the stakes of the pull request.

**Fixes** # (issue)

## Type of change

- [ ] Patch fixing an issue (non-breaking change)
- [ ] New functionality (non-breaking change)
- [ ] Breaking change (patch or feature) that might cause side effects breaking part of the Software
- [ ] Updating documentation (missing information, typo...)

## Target serie

- [ ] 21.10.x
- [ ] 22.04.x
- [ ] 22.10.x
- [ ] 23.04.x
- [ ] 23.10.x (master)

<h2> How this pull request can be tested ? </h2>

Please describe the **procedure** to verify that the goal of the PR is matched. Provide clear instructions so that it can be **correctly tested**.

Any **relevant details** of the configuration to perform the test should be added.

## Checklist

- [ ] I have followed the **coding style guidelines** provided by Centreon
- [ ] I have commented my code, especially new **classes**, **functions** or any **legacy code** modified. (***docblock***)
- [ ] I have commented my code, especially **hard-to-understand areas** of the PR.
- [ ] I have made corresponding changes to the **documentation**.
- [ ] I have **rebased** my development branch on the base branch (master, maintenance).

118 changes: 118 additions & 0 deletions .github/actions/delivery/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: "delivery"
description: "RPM and DEB packages delivery Centreon"
inputs:
module_name:
description: "The package module name"
required: true
distrib:
description: "The distribution used for packaging"
required: true
version:
description: "Centreon packaged version"
required: true
cache_key:
description: "The cached package key"
required: true
artifactory_token:
description: "The token for artifactory"
required: true
stability:
description: "The package stability (stable, testing, unstable)"
required: true

runs:
using: "composite"
steps:
- name: Build name for RPM
shell: bash
if: ${{ startsWith(inputs.distrib, 'el') }}
run: |
echo "extfile=rpm" >> $GITHUB_ENV
- name: Build name for DEB
shell: bash
if: ${{ inputs.distrib == 'bullseye' }}
run: |
echo "extfile=deb" >> $GITHUB_ENV
- name: Use cache files
uses: actions/cache@v3
with:
path: ./*.${{ env.extfile }}
key: ${{ inputs.cache_key }}

- uses: jfrog/setup-jfrog-cli@v3
env:
JF_URL: https://centreon.jfrog.io
JF_ACCESS_TOKEN: ${{ inputs.artifactory_token }}

- if: ${{ startsWith(inputs.distrib, 'el') }}
name: Publish RPMs
run: |
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
mkdir noarch x86_64
for FILE in $FILES; do
echo "[DEBUG] - File: $FILE"
ARCH=$(echo $FILE | grep -oP '(x86_64|noarch)')
echo "[DEBUG] - Arch: $ARCH"
mv "$FILE" "$ARCH"
done
for ROOT_REPO_PATH in "rpm-standard" "rpm-standard-internal"; do
for ARCH in "noarch" "x86_64"; do
if [ "$(ls -A $ARCH)" ]; then
if [ "${{ inputs.stability }}" == "stable" ]; then
jf rt upload "$ARCH/*.rpm" "$ROOT_REPO_PATH/${{ inputs.version }}/${{ inputs.distrib }}/${{ inputs.stability }}/$ARCH/RPMS/${{ inputs.module_name }}/" --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
done
shell: bash

- if: ${{ inputs.distrib == 'bullseye' }}
name: Publish DEBs
run: |
FILES="*.${{ env.extfile }}"
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
for FILE in $FILES; do
echo "[DEBUG] - File: $FILE"
VERSION=${{ inputs.version }}
DISTRIB=$(echo $FILE | cut -d '_' -f2 | cut -d '-' -f2)
ARCH=$(echo $FILE | cut -d '_' -f3 | cut -d '.' -f1)
echo "[DEBUG] - Version: $VERSION"
jf rt upload "$FILE" "apt-standard-${{ inputs.version }}-${{ inputs.stability }}/pool/${{ inputs.module_name }}/" --deb "${{ inputs.distrib }}/main/$ARCH"
done
shell: bash
82 changes: 82 additions & 0 deletions .github/actions/package/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: package
description: Package module using nfpm
inputs:
nfpm_file_pattern:
description: The pattern of the nfpm configuration file(s)
required: true
package_extension:
description: The package extension (deb or rpm)
required: true
distrib:
description: The package distrib
required: true
version:
description: The package version
required: false
release:
description: The package release number
required: false
arch:
description: The package architecture
required: false
commit_hash:
description: The commit hash
required: true
cache_key:
description: The package files cache key
required: true
rpm_gpg_key:
description: The rpm gpg key
required: true
rpm_gpg_signing_key_id:
description: The rpm gpg signing key identifier
required: true
rpm_gpg_signing_passphrase:
description: The rpm gpg signing passphrase
required: true

runs:
using: composite

steps:
- name: Import gpg key
env:
RPM_GPG_SIGNING_KEY: ${{ inputs.rpm_gpg_key }}
run: echo -n "$RPM_GPG_SIGNING_KEY" > key.gpg
shell: bash

- name: Build ${{ inputs.package_extension }} files
env:
RPM_GPG_SIGNING_KEY_ID: ${{ inputs.rpm_gpg_signing_key_id }}
RPM_GPG_SIGNING_PASSPHRASE: ${{ inputs.rpm_gpg_signing_passphrase }}
run: |
export VERSION="${{ inputs.version }}"
export RELEASE="${{ inputs.release }}"
export ARCH="${{ inputs.arch }}"
if [ "${{ inputs.package_extension }}" = "rpm" ]; then
export DIST=".${{ inputs.distrib }}"
else
export DIST=""
fi
export RPM_SIGNING_KEY_FILE="$(pwd)/key.gpg"
export RPM_SIGNING_KEY_ID="$RPM_GPG_SIGNING_KEY_ID"
export NFPM_RPM_PASSPHRASE="$RPM_GPG_SIGNING_PASSPHRASE"
for FILE in ${{ inputs.nfpm_file_pattern }}; do
DIRNAME=$(dirname $FILE)
BASENAME=$(basename $FILE)
cd $DIRNAME
sed -i "s/@COMMIT_HASH@/${{ inputs.commit_hash }}/g" $BASENAME
nfpm package --config $BASENAME --packager ${{ inputs.package_extension }}
cd -
mv $DIRNAME/*.${{ inputs.package_extension }} ./
done
shell: bash

- name: Cache packages
uses: actions/cache/save@v3
with:
path: ./*.${{ inputs.package_extension }}
key: ${{ inputs.cache_key }}
92 changes: 92 additions & 0 deletions .github/actions/promote-to-stable/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: "promote testing to stable"
description: "Promote testing packages to stable."
inputs:
artifactory_token:
description: "Artifactory token"
required: true
module_name:
description: "Module name"
required: true
distrib:
description: "The distribution used for packaging"
required: true
major_version:
description: "Centreon packaged major version"
required: true
minor_version:
description: "Centreon package minor version"
required: true
stability:
description: "The package stability (stable, testing, unstable)"
required: true
repository_name:
description: "The repository name"
required: true

runs:
using: "composite"
steps:
- uses: jfrog/setup-jfrog-cli@v3
env:
JF_URL: https://centreon.jfrog.io
JF_ACCESS_TOKEN: ${{ inputs.artifactory_token }}

- name: Promote RPM packages to stable
if: ${{ startsWith(inputs.distrib, 'el') }}
run: |
set -x
echo "[DEBUG] - Major version: ${{ inputs.major_version }}"
echo "[DEBUG] - Minor version: ${{ inputs.minor_version }}"
echo "[DEBUG] - Distrib: ${{ inputs.distrib }}"
for ARCH in "noarch" "x86_64"; do
echo "[DEBUG] - Get artifactory path of $ARCH testing artifacts to promote to stable."
SRC_PATHS=$(jf rt s --include-dirs rpm-standard/${{ inputs.major_version }}/${{ inputs.distrib }}/testing/$ARCH/${{ inputs.module_name }}/*.rpm | jq -r '.[].path')
if [[ ${SRC_PATHS[@]} ]]; then
for SRC_PATH in ${SRC_PATHS[@]}; do
echo "[DEBUG] - Source path found: $SRC_PATH"
done
else
echo "[DEBUG] - No source path found."
continue
fi
echo "[DEBUG] - Build $ARCH artifactory target path."
TARGET_PATH="rpm-standard/${{ inputs.major_version }}/${{ inputs.distrib }}/${{ inputs.stability }}/$ARCH/RPMS/${{ inputs.module_name }}/"
echo "[DEBUG] - Target path: $TARGET_PATH"
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
done
done
shell: bash

- name: Promote DEB packages to stable
if: ${{ startsWith(inputs.distrib, 'bullseye') }}
run: |
echo "[DEBUG] - Major version: ${{ inputs.major_version }}"
echo "[DEBUG] - Minor version: ${{ inputs.minor_version }}"
echo "[DEBUG] - Distrib: ${{ inputs.distrib }}"
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')
if [[ ${SRC_PATHS[@]} ]]; then
for SRC_PATH in ${SRC_PATHS[@]}; do
echo "[DEBUG] - Source path found: $SRC_PATH"
done
else
echo "[DEBUG] - No source path found."
continue
fi
echo "[DEBUG] - Build target path."
TARGET_PATH="apt-standard-${{ inputs.major_version }}-${{ inputs.stability }}/pool/${{ inputs.module_name }}/"
echo "[DEBUG] - Target path: $TARGET_PATH"
echo "[DEBUG] - Promoting DEB testing artifacts to stable."
for ARTIFACT in ${SRC_PATHS[@]}; do
echo "[DEBUG] - Promoting $ARTIFACT to stable."
jf rt cp $ARTIFACT $TARGET_PATH --flat=true
done
shell: bash
46 changes: 46 additions & 0 deletions .github/actions/release-sources/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "release-sources"
description: "Release sources on download.centreon.com"
inputs:
bucket_directory:
description: The bucket directory
required: true
module_directory:
description: The module directory
required: true
module_name:
description: The module name
required: true
major_version:
description: The major version
required: true
minor_version:
description: The minor version
required: true
token_download_centreon_com:
description: The token to call download.centreon.com api
required: true

runs:
using: "composite"
steps:
- name: Setup awscli
run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
sudo unzip -q awscliv2.zip
sudo ./aws/install
shell: bash

- run: |
MAJOR_VERSION="${{ inputs.major_version }}"
VERSION="${{ inputs.major_version }}.${{ inputs.minor_version }}"
SRC_FILE="${{ inputs.module_name }}-$VERSION.tar.gz"
mv "${{ inputs.module_directory }}" "${{ inputs.module_name }}-$VERSION"
tar czf $SRC_FILE "${{ inputs.module_name }}-$VERSION"
SRC_HASH=$(md5sum $SRC_FILE | cut -d ' ' -f 1)
SRC_SIZE=$(stat -c '%s' $SRC_FILE)
aws s3 cp --acl public-read "$SRC_FILE" "s3://centreon-download/public/${{ inputs.bucket_directory }}/$SRC_FILE"
curl --fail "https://download.centreon.com/api/?token=${{ inputs.token_download_centreon_com }}&product=${{ inputs.module_name }}&release=$MAJOR_VERSION&version=$VERSION&extension=tar.gz&md5=$SRC_HASH&size=$SRC_SIZE&ddos=0&dryrun=0"
shell: bash
Loading

0 comments on commit 919f04d

Please sign in to comment.