Skip to content

Commit

Permalink
Centreon 23.04 (Jira release #19784#)
Browse files Browse the repository at this point in the history
  • Loading branch information
paloth authored Apr 8, 2024
2 parents 84bebfd + fd3d058 commit 0786a15
Show file tree
Hide file tree
Showing 75 changed files with 10,584 additions and 10,226 deletions.
40 changes: 37 additions & 3 deletions .github/actions/delivery/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ inputs:
stability:
description: "The package stability (stable, testing, unstable)"
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"
Expand Down Expand Up @@ -49,6 +55,8 @@ runs:
- if: ${{ startsWith(inputs.distrib, 'el') }}
name: Publish RPMs
run: |
set -eux
FILES="*.${{ env.extfile }}"
echo "[DEBUG] - Version: ${{ inputs.version }}"
Expand All @@ -64,8 +72,17 @@ runs:
exit 1
fi
# 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 }}"
# 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"
Expand All @@ -76,13 +93,30 @@ runs:
mv "$FILE" "$ARCH"
done
for ROOT_REPO_PATH in "rpm-standard" "rpm-standard-internal"; do
# 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
# 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
ROOT_REPO_PATHS="rpm-standard-internal"
UPLOAD_REPO_PATH="${{ inputs.version }}/${{ inputs.distrib }}/${{ inputs.stability }}-${{ inputs.release_type }}/$ARCH/RPMS/${{ inputs.module_name }}/"
# NON-CLOUD + (HOTFIX OR RELEASE) + REPO STANDARD
elif [[ ${{ inputs.release_cloud }} -eq 0 ]]; then
ROOT_REPO_PATHS="rpm-standard"
UPLOAD_REPO_PATH="${{ inputs.version }}/${{ inputs.distrib }}/${{ inputs.stability }}/$ARCH/${{ inputs.module_name }}/"
else
echo "Invalid combination of release_type and release_cloud"
exit 1
fi
# Deliver based on inputs
for ROOT_REPO_PATH in "$ROOT_REPO_PATHS"; 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
echo "[DEBUG] - Stability is ${{ inputs.stability }}, not delivering."
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
jf rt upload "$ARCH/*.rpm" "$ROOT_REPO_PATH/$UPLOAD_REPO_PATH" --sync-deletes="$ROOT_REPO_PATH/$UPLOAD_REPO_PATH" --flat
fi
fi
done
Expand Down
62 changes: 52 additions & 10 deletions .github/actions/promote-to-stable/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,61 @@ inputs:
repository_name:
description: "The repository name"
required: true
github_ref_name:
description: "Release base ref name for push event"
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:
- uses: jfrog/setup-jfrog-cli@901bb9632db90821c2d3f076012bdeaf66598555 # v3.4.1
- uses: jfrog/setup-jfrog-cli@26da2259ee7690e63b5410d7451b2938d08ce1f9 # v4.0.0
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
set -eux
# DEBUG
echo "[DEBUG] - Major version: ${{ inputs.major_version }}"
echo "[DEBUG] - Minor version: ${{ inputs.minor_version }}"
echo "[DEBUG] - Distrib: ${{ inputs.distrib }}"
echo "[DEBUG] - release_cloud: ${{ inputs.release_cloud }}"
echo "[DEBUG] - release_type: ${{ inputs.release_type }}"
# Cloud specific promote
# delivery by default to onprem, override to internal if base branch is master
if [[ ${{ inputs.github_base_ref }} == "master" ]]; then
ROOT_REPO_PATH="rpm-standard-internal"
else
ROOT_REPO_PATH="rpm-standard"
fi
# Search for testing packages candidate for promote
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')
# Build search path based on release_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
SEARCH_REPO_PATH="${{ inputs.major_version }}/${{ inputs.distrib }}/testing-${{ inputs.release_type }}/$ARCH/${{ inputs.module_name }}"
elif [[ ${{ inputs.release_cloud }} -eq 0 ]]; then
SEARCH_REPO_PATH="${{ inputs.major_version }}/${{ inputs.distrib }}/testing/$ARCH/${{ inputs.module_name }}"
else
echo "Invalid combination of release_type and release_cloud"
fi
echo "[DEBUG] - Get path of $ARCH testing artifacts to promote to stable."
SRC_PATHS=$(jf rt search --include-dirs $ROOT_REPO_PATH/$SEARCH_REPO_PATH/*.rpm | jq -r '.[].path')
if [[ ${SRC_PATHS[@]} ]]; then
for SRC_PATH in ${SRC_PATHS[@]}; do
echo "[DEBUG] - Source path found: $SRC_PATH"
Expand All @@ -50,25 +85,31 @@ runs:
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 }}/"
# Build target path based on ARCH
echo "[DEBUG] - Build $ARCH target path."
TARGET_PATH="$ROOT_REPO_PATH/${{ inputs.major_version }}/${{ inputs.distrib }}/${{ inputs.stability }}/$ARCH/RPMS/${{ inputs.module_name }}/"
echo "[DEBUG] - Target path: $TARGET_PATH"
echo "[INFO] - Build INTERNAL $ARCH target path."
TARGET_PATH_INTERNAL="rpm-standard-internal/${{ inputs.major_version }}/${{ inputs.distrib }}/${{ inputs.stability }}/$ARCH/RPMS/${{ inputs.module_name }}/"
echo "[INFO] - Target internal path: $TARGET_PATH_INTERNAL"
# Download candidates for promote
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
echo "[DEBUG] - Downloading $ARTIFACT from TESTING."
jf rt download $ARTIFACT --flat
done
# Upload previously downloaded candidates to TARGET_PATH
for ARTIFACT_DL in $(dir|grep -E "*.rpm"); do
echo "[DEBUG] - Promoting (upload) $ARTIFACT_DL to stable $TARGET_PATH."
jf rt upload "$ARTIFACT_DL" "$TARGET_PATH" --flat
done
# Cleanup before next round of candidates
rm -f *.rpm
done
shell: bash

- name: Promote DEB packages to stable
Expand Down Expand Up @@ -103,8 +144,9 @@ runs:
for ARTIFACT_DL in $(dir|grep -E "*.deb"); do
ARCH=$(echo $ARTIFACT_DL | cut -d '_' -f3 | cut -d '.' -f1)
echo "[DEBUG] - Promoting (upload) $ARTIFACT_DL to stable $TARGET_PATH."
jf rt upload "$ARTIFACT_DL" "$TARGET_PATH" --deb "${{ inputs.distrib }}/main/$ARCH"
jf rt upload "$ARTIFACT_DL" "$TARGET_PATH" --deb "${{ inputs.distrib }}/main/$ARCH" --flat
done
rm -f *.deb
shell: bash
Loading

0 comments on commit 0786a15

Please sign in to comment.