Skip to content

Commit

Permalink
MON-150047 Centreon next 24.10 (Jira release #20136#) (#1749)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkippes authored Oct 30, 2024
2 parents 488b6d8 + b183045 commit c7af5ad
Show file tree
Hide file tree
Showing 282 changed files with 21,926 additions and 2,084 deletions.
14 changes: 8 additions & 6 deletions .github/actions/package/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ runs:
using: composite

steps:
- name: Parse distrib name
id: parse-distrib
uses: ./.github/actions/parse-distrib
with:
distrib: ${{ inputs.distrib }}

- name: Import gpg key
env:
RPM_GPG_SIGNING_KEY: ${{ inputs.rpm_gpg_key }}
Expand All @@ -62,14 +68,10 @@ runs:
export ARCH="${{ inputs.arch }}"
if [ "${{ inputs.package_extension }}" = "rpm" ]; then
export DIST=".${{ inputs.distrib }}"
export DIST="${{ steps.parse-distrib.outputs.package_distrib_separator }}${{ steps.parse-distrib.outputs.package_distrib_name }}"
else
export DIST=""
if [ "${{ inputs.stability }}" = "unstable" ] || [ "${{ inputs.stability }}" = "canary" ]; then
export RELEASE="$RELEASE~${{ inputs.distrib }}"
else
export RELEASE="1~${{ inputs.distrib }}"
fi
export RELEASE="$RELEASE${{ steps.parse-distrib.outputs.package_distrib_separator }}${{ steps.parse-distrib.outputs.package_distrib_name }}"
fi
MAJOR_LEFT=$( echo $MAJOR_VERSION | cut -d "." -f1 )
Expand Down
45 changes: 45 additions & 0 deletions .github/actions/parse-distrib/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "parse-distrib"
description: "parse distrib name."
inputs:
distrib:
description: "The distribution name"
required: true
outputs:
package_distrib_separator:
description: "Separator between package version and distrib number"
value: ${{ steps.parse-distrib.outputs.package_distrib_separator }}
package_distrib_name:
description: "Distribution suffix in package name"
value: ${{ steps.parse-distrib.outputs.package_distrib_name }}

runs:
using: "composite"
steps:
- name: Parse distrib
id: parse-distrib
run: |
if [[ "${{ inputs.distrib }}" == "centos7" || "${{ inputs.distrib }}" == "el7" ]]; then
PACKAGE_DISTRIB_SEPARATOR="."
PACKAGE_DISTRIB_NAME="el7"
elif [[ "${{ inputs.distrib }}" == "alma8" || "${{ inputs.distrib }}" == "el8" ]]; then
PACKAGE_DISTRIB_SEPARATOR="."
PACKAGE_DISTRIB_NAME="el8"
elif [[ "${{ inputs.distrib }}" == "alma9" || "${{ inputs.distrib }}" == "el9" ]]; then
PACKAGE_DISTRIB_SEPARATOR="."
PACKAGE_DISTRIB_NAME="el9"
elif [[ "${{ inputs.distrib }}" == "bullseye" ]]; then
PACKAGE_DISTRIB_SEPARATOR="+"
PACKAGE_DISTRIB_NAME="deb11u1"
elif [[ "${{ inputs.distrib }}" == "bookworm" ]]; then
PACKAGE_DISTRIB_SEPARATOR="+"
PACKAGE_DISTRIB_NAME="deb12u1"
elif [[ "${{ inputs.distrib }}" == "jammy" ]]; then
PACKAGE_DISTRIB_SEPARATOR="-"
PACKAGE_DISTRIB_NAME="0ubuntu.22.04"
else
echo "::error::Distrib ${{ inputs.distrib }} cannot be parsed"
exit 1
fi
echo "package_distrib_separator=$PACKAGE_DISTRIB_SEPARATOR" >> $GITHUB_OUTPUT
echo "package_distrib_name=$PACKAGE_DISTRIB_NAME" >> $GITHUB_OUTPUT
shell: bash
33 changes: 24 additions & 9 deletions .github/actions/promote-to-stable/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ runs:
JF_URL: https://centreon.jfrog.io
JF_ACCESS_TOKEN: ${{ inputs.artifactory_token }}

- name: Parse distrib name
id: parse-distrib
uses: ./.github/actions/parse-distrib
with:
distrib: ${{ inputs.distrib }}

- name: Promote RPM packages to stable
if: ${{ startsWith(inputs.distrib, 'el') }}
run: |
Expand Down Expand Up @@ -81,7 +87,7 @@ runs:
# 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 }}/"
TARGET_PATH="$ROOT_REPO_PATH/${{ inputs.major_version }}/${{ inputs.distrib }}/stable/$ARCH/RPMS/${{ inputs.module_name }}/"
echo "[DEBUG] - Target path: $TARGET_PATH"
# Download candidates for promote
Expand All @@ -91,10 +97,15 @@ runs:
jf rt download $ARTIFACT --flat
done
DRY_RUN_FLAG="--dry-run"
if [ "${{ inputs.stability }}" == "stable" ]; then
DRY_RUN_FLAG=""
fi
# 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
jf rt upload "$ARTIFACT_DL" "$TARGET_PATH" --flat $DRY_RUN_FLAG
done
# Cleanup before next round of candidates
Expand Down Expand Up @@ -123,7 +134,7 @@ runs:
SRC_PATHS=$(jf rt search --include-dirs $ROOT_REPO_PATH-testing/pool/${{ inputs.module_name }}/*.deb | jq -r '.[].path')
;;
*)
SRC_PATHS=$(jf rt search --include-dirs $ROOT_REPO_PATH-testing/pool/${{ inputs.module_name }}/*${{ inputs.distrib }}*.deb | jq -r '.[].path')
SRC_PATHS=$(jf rt search --include-dirs $ROOT_REPO_PATH-testing/pool/${{ inputs.module_name }}/*${{ steps.parse-distrib.outputs.package_distrib_name }}*.deb | jq -r '.[].path')
;;
esac
Expand All @@ -132,12 +143,12 @@ runs:
echo "[DEBUG] - Source path found: $SRC_PATH"
done
else
echo "[DEBUG] - No source path found."
continue
echo "::warning::No source path found."
exit 0
fi
echo "[DEBUG] - Build target path."
TARGET_PATH="$ROOT_REPO_PATH-${{ inputs.stability }}/pool/${{ inputs.module_name }}/"
TARGET_PATH="$ROOT_REPO_PATH-stable/pool/${{ inputs.module_name }}/"
echo "[DEBUG] - Target path: $TARGET_PATH"
echo "[DEBUG] - Promoting DEB testing artifacts to stable."
Expand All @@ -151,16 +162,20 @@ runs:
ARTIFACT_SEARCH_PATTERN=".+\.deb"
;;
*)
ARTIFACT_SEARCH_PATTERN=".+${{ inputs.distrib }}.+\.deb"
ARTIFACT_SEARCH_PATTERN=".+${{ steps.parse-distrib.outputs.package_distrib_name }}.+\.deb"
;;
esac
DRY_RUN_FLAG="--dry-run"
if [ "${{ inputs.stability }}" == "stable" ]; then
DRY_RUN_FLAG=""
fi
for ARTIFACT_DL in $(dir -1|grep -E $ARTIFACT_SEARCH_PATTERN); 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" --flat
jf rt upload "$ARTIFACT_DL" "$TARGET_PATH" --deb "${{ inputs.distrib }}/main/$ARCH" --flat $DRY_RUN_FLAG
done
rm -f *.deb
shell: bash
Loading

0 comments on commit c7af5ad

Please sign in to comment.