Skip to content

Commit

Permalink
MON-147105 Centreon next 22.10 (Jira release #20026#) (#1647)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkippes authored Sep 16, 2024
2 parents 58aa746 + 2e077f8 commit c3ad6bb
Show file tree
Hide file tree
Showing 298 changed files with 51,589 additions and 566 deletions.
17 changes: 12 additions & 5 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
* @centreon/owners-cpp
* @centreon/owners-cpp

.github/** @centreon/owners-pipelines
packaging/** @centreon/owners-pipelines
selinux/** @centreon/owners-pipelines
.github/** @centreon/owners-pipelines
packaging/** @centreon/owners-pipelines
selinux/** @centreon/owners-pipelines

tests/** @centreon/owners-robot-e2e
tests/** @centreon/owners-robot-e2e

gorgone/ @centreon/owners-perl
gorgone/docs/ @centreon/owners-doc

gorgone/tests/robot/config/ @centreon/owners-perl
*.pm @centreon/owners-perl
*.pl @centreon/owners-perl
80 changes: 80 additions & 0 deletions .github/actions/deb-delivery/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: "deb-delivery"
description: "Package deb packages"
inputs:
module_name:
description: "The package module name"
required: true
distrib:
description: "The distribution used for packaging"
required: true
version:
description: "Centreon packaged major version"
required: true
cache_key:
description: "The cached package key"
required: true
stability:
description: "The package stability (stable, testing, unstable)"
required: true
artifactory_token:
description: "Artifactory token"
required: true
release_type:
description: "Type of release (hotfix, release)"
required: true
release_cloud:
description: "Release context (cloud or not cloud)"
required: true

runs:
using: "composite"
steps:
- name: Use cache DEB files
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ./*.deb
key: ${{ inputs.cache_key }}
fail-on-cache-miss: true

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

- name: Publish DEBs
run: |
FILES="*.deb"
# 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
# Handle either standard debian or ubuntu repository path
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
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" "$ROOT_REPO_PATH/pool/${{ inputs.module_name }}/" --deb "${{ inputs.distrib }}/main/$ARCH" --flat
done
shell: bash
124 changes: 65 additions & 59 deletions .github/actions/delivery/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ name: "delivery"
description: "RPM and DEB packages delivery Centreon"
inputs:
module_name:
description: "The name of the module"
description: "The package module name"
required: true
distrib:
description: "The distribution used for packaging"
required: true
version:
description: "Centreon packaged version"
major_version:
description: "Centreon packaged major version"
required: true
cache_key:
description: "The cached package key"
Expand All @@ -31,104 +31,88 @@ runs:
steps:
- name: Build name for RPM
shell: bash
if: ${{ inputs.distrib == 'el7' || inputs.distrib == 'el8' }}
if: ${{ startsWith(inputs.distrib, 'el') }}
run: |
echo "extfile=rpm" >> $GITHUB_ENV
- 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
- name: detect stability
run: |
if [[ -z "$GITHUB_HEAD_REF" ]];
then
BRANCHNAME="$GITHUB_REF_NAME"
else
BRANCHNAME="$GITHUB_HEAD_REF"
fi
case "$BRANCHNAME" in
develop | dev-[2-9][0-9].[0-9][0-9].x)
echo "stability=unstable" >> $GITHUB_ENV
;;
release* | hotfix*)
echo "stability=testing" >> $GITHUB_ENV
;;
master | [2-9][0-9].[0-9][0-9].x)
echo "stability=stable" >> $GITHUB_ENV
;;
*)
echo "stability=canary" >> $GITHUB_ENV
;;
esac
shell: bash

- name: Use cache files
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: ./*.${{ env.extfile }}
key: ${{ inputs.cache_key }}
restore-keys: ${{ inputs.cache_key }}

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

- if: ${{ startsWith(inputs.distrib, 'el') && env.stability != 'canary' }}
- if: ${{ env.extfile == 'rpm' }}
name: Publish RPMs
run: |
set -eux
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] - Major version: ${{ inputs.major_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.major_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
# Get ARCH target for files to deliver and regroupe them by ARCH
for FILE in $FILES; do
echo "[DEBUG] - File: $FILE"
ARCH=$(echo $FILE | grep -oP '(x86_64|noarch)')
echo "[DEBUG] - Arch: $ARCH"
cp "$FILE" "$ARCH"
mv "$FILE" "$ARCH"
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/RPMS/${{ inputs.module_name }}/"
UPLOAD_REPO_PATH="${{ inputs.major_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.major_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 }}/"
UPLOAD_REPO_PATH="${{ inputs.major_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 @@ -138,28 +122,50 @@ 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.major_version }}/${{ inputs.distrib }}/${{ inputs.stability }}/$ARCH/${{ inputs.module_name }}/" --sync-deletes="$ROOT_REPO_PATH/${{ inputs.major_version }}/${{ inputs.distrib }}/${{ inputs.stability }}/$ARCH/${{ inputs.module_name }}/" --flat
fi
fi
done
done
shell: bash

- if: ${{ inputs.distrib == 'bullseye' && env.stability != 'canary' }}
- if: ${{ env.extfile == 'deb' }}
name: Publish DEBs
run: |
FILES="*.${{ env.extfile }}"
# DEBUG
echo "[DEBUG] - Major version: ${{ inputs.major_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.major_version }} || -z ${{ inputs.release_cloud }} || -z ${{ inputs.release_type }} ]]; then
echo "Some mandatory inputs are empty, please check the logs."
exit 1
fi
for FILE in $FILES; do
echo "[DEBUG] - File: $FILE"
VERSION=${{ inputs.version }}
VERSION=${{ inputs.major_version }}
DISTRIB=$(echo $FILE | cut -d '_' -f2 | cut -d '-' -f2)
ARCH=$(echo $FILE | cut -d '_' -f3 | cut -d '.' -f1)
echo "[DEBUG] - Version: $VERSION"
echo "[DEBUG] - Major version: $VERSION"
if [[ "${{ inputs.distrib }}" == "jammy" ]]; then
ROOT_REPO_PATH="ubuntu-standard-${{ inputs.major_version }}-${{ inputs.stability }}"
else
ROOT_REPO_PATH="apt-standard-${{ inputs.major_version }}-${{ inputs.stability }}"
fi
jf rt upload "$FILE" "apt-standard-${{ inputs.version }}-${{ env.stability }}/pool/${{ inputs.module_name }}/" --deb "${{ inputs.distrib }}/main/$ARCH"
jf rt upload "$FILE" "$ROOT_REPO_PATH/pool/${{ inputs.module_name }}/" --deb "${{ inputs.distrib }}/main/$ARCH"
done
shell: bash
Loading

0 comments on commit c3ad6bb

Please sign in to comment.