Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MON-151748 Centreon next 23.04 (Jira release #20165#) #1790

Merged
merged 14 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/actions/deb-delivery/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ inputs:
release_type:
description: "Type of release (hotfix, release)"
required: true
release_cloud:
is_cloud:
description: "Release context (cloud or not cloud)"
required: true

Expand All @@ -49,12 +49,12 @@ runs:
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] - is_cloud: ${{ inputs.is_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
if [[ -z "${{ inputs.module_name }}" || -z "${{ inputs.distrib }}" || -z ${{ inputs.stability }} || -z ${{ inputs.version }} || -z "${{ inputs.is_cloud }}" ]]; then
echo "Some mandatory inputs are empty, please check the logs."
exit 1
fi
Expand Down
20 changes: 10 additions & 10 deletions .github/actions/delivery/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ inputs:
release_type:
description: "Type of release (hotfix, release)"
required: true
release_cloud:
is_cloud:
description: "Release context (cloud or not cloud)"
required: true

Expand Down Expand Up @@ -63,12 +63,12 @@ runs:
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] - is_cloud: ${{ inputs.is_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
if [[ -z "${{ inputs.module_name }}" || -z "${{ inputs.distrib }}" || -z ${{ inputs.stability }} || -z ${{ inputs.major_version }} || -z "${{ inputs.is_cloud }}" ]]; then
echo "Some mandatory inputs are empty, please check the logs."
exit 1
fi
Expand All @@ -87,32 +87,32 @@ runs:
mv "$FILE" "$ARCH"
done

# Build upload target path based on release_cloud and release_type values
# Build upload target path based on is_cloud and release_type values
# 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_type }} == "release" ) ]]; then
if [[ "${{ inputs.is_cloud }}" == "true" && ( "${{ 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.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
elif [[ "${{ inputs.is_cloud }}" == "true" && ( "${{ 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
elif [[ "${{ inputs.is_cloud }}" == "false" ]]; then
echo "[DEBUG] : NOT Release cloud + ${{ inputs.release_type }}, using rpm-standard."
ROOT_REPO_PATHS="rpm-standard"
UPLOAD_REPO_PATH="${{ inputs.major_version }}/${{ inputs.distrib }}/${{ inputs.stability }}/$ARCH/${{ inputs.module_name }}/"

# NOT VALID, DO NOT DELIVER
else
echo "::error:: Invalid combination of release_type [${{ inputs.release_type }}] and release_cloud [${{ inputs.release_cloud }}]"
echo "::error:: Invalid combination of release_type [${{ inputs.release_type }}] and is_cloud [${{ inputs.is_cloud }}]"
exit 1
fi

Expand Down Expand Up @@ -141,12 +141,12 @@ runs:
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] - is_cloud: ${{ inputs.is_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
if [[ -z "${{ inputs.module_name }}" || -z "${{ inputs.distrib }}" || -z ${{ inputs.stability }} || -z ${{ inputs.major_version }} || -z "${{ inputs.is_cloud }}" ]]; then
echo "Some mandatory inputs are empty, please check the logs."
exit 1
fi
Expand Down
10 changes: 8 additions & 2 deletions .github/actions/package-sign/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ inputs:
registry_password:
description: Docker registry password
required: true
registry_private_username:
description: Docker private registry username
required: true
registry_private_token:
description: Docker private registry token
required: true
params:
description: "params for script"
required: false
Expand All @@ -32,8 +38,8 @@ runs:
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
with:
registry: ${{ inputs.registry_url }}
username: ${{ inputs.registry_username }}
password: ${{ inputs.registry_password }}
username: ${{ inputs.registry_private_username }}
password: ${{ inputs.registry_private_token }}

# REMOVE ME LATER
- run: docker pull ${{ inputs.registry_url }}/${{ inputs.image_name }}:${{ inputs.image_version}}
Expand Down
12 changes: 6 additions & 6 deletions .github/actions/promote-to-stable/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ inputs:
release_type:
description: "Type of release (hotfix, release)"
required: true
release_cloud:
is_cloud:
description: "Release context (cloud or not cloud)"
required: true

Expand All @@ -42,7 +42,7 @@ runs:
# DEBUG
echo "[DEBUG] - Major version: ${{ inputs.major_version }}"
echo "[DEBUG] - Distrib: ${{ inputs.distrib }}"
echo "[DEBUG] - release_cloud: ${{ inputs.release_cloud }}"
echo "[DEBUG] - is_cloud: ${{ inputs.is_cloud }}"
echo "[DEBUG] - release_type: ${{ inputs.release_type }}"

# Cloud specific promote
Expand All @@ -56,15 +56,15 @@ runs:
# Search for testing packages candidate for promote
for ARCH in "noarch" "x86_64"; do

# Build search path based on release_cloud and release_type values
# Build search path based on is_cloud and release_type values
# if cloud, search in testing-<release_type> path
# if non-cloud, search in the testing usual path
if [[ ${{ inputs.release_cloud }} -eq 1 && ${{ inputs.release_type }} == "hotfix" ]] || [[ ${{ inputs.release_cloud }} -eq 1 && ${{ inputs.release_type }} == "release" ]]; then
if [[ "${{ inputs.is_cloud }}" == "true" && "${{ inputs.release_type }}" == "hotfix" ]] || [[ "${{ inputs.is_cloud }}" == "true" && "${{ inputs.release_type }}" == "release" ]]; then
SEARCH_REPO_PATH="${{ inputs.major_version }}/${{ inputs.distrib }}/testing-${{ inputs.release_type }}/$ARCH/${{ inputs.module_name }}"
elif [[ ${{ inputs.release_cloud }} -eq 0 ]]; then
elif [[ "${{ inputs.is_cloud }}" == "false" ]]; then
SEARCH_REPO_PATH="${{ inputs.major_version }}/${{ inputs.distrib }}/testing/$ARCH/${{ inputs.module_name }}"
else
echo "Invalid combination of release_type and release_cloud"
echo "Invalid combination of release_type and is_cloud"
fi

echo "[DEBUG] - Get path of $ARCH testing artifacts to promote to stable."
Expand Down
16 changes: 8 additions & 8 deletions .github/actions/rpm-delivery/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ inputs:
release_type:
description: "Type of release (hotfix, release)"
required: true
release_cloud:
is_cloud:
description: "Release context (cloud or not cloud)"
required: true

Expand Down Expand Up @@ -61,12 +61,12 @@ runs:
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] - is_cloud: ${{ inputs.is_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
if [[ -z "${{ inputs.module_name }}" || -z "${{ inputs.distrib }}" || -z ${{ inputs.stability }} || -z ${{ inputs.version }} || -z "${{ inputs.is_cloud }}" ]]; then
echo "Some mandatory inputs are empty, please check the logs."
exit 1
fi
Expand All @@ -85,32 +85,32 @@ runs:
mv "$FILE" "$ARCH"
done

# Build upload target path based on release_cloud and release_type values
# Build upload target path based on is_cloud and release_type values
# 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_type }} == "release" ]]); then
if [[ "${{ inputs.is_cloud }}" == "true" ]] && ([[ "${{ 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/${{ 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
elif [[ "${{ inputs.is_cloud }}" == "true" ]] && ([[ "${{ 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.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
elif [[ "${{ inputs.is_cloud }}" == "false" ]]; 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 }}/"

# ANYTHING ELSE
else
echo "::error:: Invalid combination of release_type [${{ inputs.release_type }}] and release_cloud [${{ inputs.release_cloud }}]"
echo "::error:: Invalid combination of release_type [${{ inputs.release_type }}] and is_cloud [${{ inputs.is_cloud }}]"
exit 1
fi

Expand Down
74 changes: 36 additions & 38 deletions .github/workflows/centreon-collect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ on:
- "!**/test/**"

jobs:
get-version:
uses: ./.github/workflows/get-version.yml
get-environment:
uses: ./.github/workflows/get-environment.yml
with:
version_file: CMakeLists.txt

unit-test:
needs: [get-version]
if: ${{ ! contains(fromJson('["stable"]'), needs.get-version.outputs.stability) }}
needs: [get-environment]
if: ${{ ! contains(fromJson('["stable"]'), needs.get-environment.outputs.stability) }}
runs-on: [self-hosted, collect]

strategy:
Expand All @@ -71,34 +71,34 @@ jobs:
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
registry: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}
username: ${{ secrets.DOCKER_REGISTRY_ID }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }}
password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }}

- name: Test ${{ matrix.image }}
uses: ./.github/actions/runner-docker
with:
registry_url: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}
script_name: /src/.github/scripts/collect-unit-tests
image_name: centreon-collect-${{ matrix.image }}
image_version: ${{ needs.get-version.outputs.img_version }}
image_version: ${{ needs.get-environment.outputs.img_version }}

package:
needs: [get-version]
if: ${{ ! contains(fromJson('["stable"]'), needs.get-version.outputs.stability) }}
needs: [get-environment]
if: ${{ ! contains(fromJson('["stable"]'), needs.get-environment.outputs.stability) }}
uses: ./.github/workflows/package-collect.yml
with:
major_version: ${{ needs.get-version.outputs.major_version }}
minor_version: ${{ needs.get-version.outputs.minor_version }}
img_version: ${{ needs.get-version.outputs.img_version }}
release: ${{ needs.get-version.outputs.release }}
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-version.outputs.stability }}
stability: ${{ needs.get-environment.outputs.stability }}
secrets: inherit

deliver-sources:
runs-on: [self-hosted, common]
needs: [get-version, package]
if: ${{ contains(fromJson('["stable"]'), needs.get-version.outputs.stability) && github.event_name != 'workflow_dispatch' }}
needs: [get-environment, package]
if: ${{ contains(fromJson('["stable"]'), needs.get-environment.outputs.stability) && github.event_name != 'workflow_dispatch' }}

steps:
- name: Checkout sources
Expand All @@ -112,14 +112,13 @@ jobs:
bucket_directory: centreon-collect
module_directory: centreon-collect
module_name: centreon-collect
major_version: ${{ needs.get-version.outputs.major_version }}
minor_version: ${{ needs.get-version.outputs.minor_version }}
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: ${{ contains(fromJson('["testing", "stable"]'), needs.get-version.outputs.stability) }}
needs: [get-version, package]
environment: ${{ needs.get-version.outputs.environment }}
if: ${{ contains(fromJson('["testing", "stable"]'), needs.get-environment.outputs.stability) }}
needs: [get-environment, package]
runs-on: [self-hosted, common]
strategy:
matrix:
Expand All @@ -140,17 +139,16 @@ jobs:
with:
module_name: collect
distrib: ${{ matrix.distrib }}
major_version: ${{ needs.get-version.outputs.major_version }}
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-version.outputs.stability }}
release_type: ${{ needs.get-version.outputs.release_type }}
release_cloud: ${{ needs.get-version.outputs.release_cloud }}
stability: ${{ needs.get-environment.outputs.stability }}
release_type: ${{ needs.get-environment.outputs.release_type }}
is_cloud: ${{ needs.get-environment.outputs.is_cloud }}

deliver-deb:
if: ${{ contains(fromJson('["testing", "stable"]'), needs.get-version.outputs.stability) }}
needs: [get-version, package]
environment: ${{ needs.get-version.outputs.environment }}
if: ${{ contains(fromJson('["testing", "stable"]'), needs.get-environment.outputs.stability) }}
needs: [get-environment, package]
runs-on: [self-hosted, common]
strategy:
matrix:
Expand All @@ -169,16 +167,16 @@ jobs:
with:
module_name: collect
distrib: ${{ matrix.distrib }}
major_version: ${{ needs.get-version.outputs.major_version }}
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-version.outputs.stability }}
release_type: ${{ needs.get-version.outputs.release_type }}
release_cloud: ${{ needs.get-version.outputs.release_cloud }}
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-version]
if: ${{ contains(fromJson('["stable"]'), needs.get-version.outputs.stability) && github.event_name != 'workflow_dispatch' }}
needs: [get-environment]
if: ${{ contains(fromJson('["stable"]'), needs.get-environment.outputs.stability) && github.event_name != 'workflow_dispatch' }}
runs-on: [self-hosted, common]
strategy:
matrix:
Expand All @@ -194,8 +192,8 @@ jobs:
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}
module_name: collect
distrib: ${{ matrix.distrib }}
major_version: ${{ needs.get-version.outputs.major_version }}
stability: ${{ needs.get-version.outputs.stability }}
major_version: ${{ needs.get-environment.outputs.major_version }}
stability: ${{ needs.get-environment.outputs.stability }}
github_ref_name: ${{ github.ref_name }}
release_type: ${{ needs.get-version.outputs.release_type }}
release_cloud: ${{ needs.get-version.outputs.release_cloud }}
release_type: ${{ needs.get-environment.outputs.release_type }}
is_cloud: ${{ needs.get-environment.outputs.is_cloud }}
Loading
Loading