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-111643 Centreon next 22.10 (Jira release #19890#) #1412

Merged
merged 28 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
32ad653
MON-37107 Sync Centreon next 22.10 (Jira release #19725#) (#1192)
pkippes Mar 6, 2024
e052d8b
feat(ci): rework release workflow and communications (#1185)
tuntoja Mar 7, 2024
166af07
fix(release): fix missing array rebuilt (#1200)
tuntoja Mar 12, 2024
c4bc03e
fix(ci): fixed missing token and quotes (#1201)
tuntoja Mar 12, 2024
608141d
fix(ci): fix release workflow and action issues (#1224)
tuntoja Mar 26, 2024
b446c22
fix(ci): remove extra dir level from testing delivery (#1232) (#1236)
tuntoja Mar 29, 2024
e1572df
enh(release): add missing version files (#1204)
tuntoja Mar 29, 2024
8b283e4
fix(ci): add missing step and var to get-version workflow (#1253)
tuntoja Apr 2, 2024
63396b1
fix(ci): filter out existing tags to only use new release tags (#1263…
tuntoja Apr 4, 2024
b6a1600
fix(permissions): fix permissions on centengine log files (#1282) (#…
mushroomempires Apr 19, 2024
dbced76
enh(promote): handle debian package promotion for multiple distributi…
tuntoja Apr 24, 2024
86044d6
chore(ci): override veracode 3rd party ignore (#1319)
sc979 May 2, 2024
03fb629
chore(ci): prevent override file from triggering a build (#1324)
sc979 May 3, 2024
d68e441
fix(ci): minor fixes to promote and release actions (#1344)
tuntoja May 21, 2024
f715a4c
fix promote action on debian (#1363) (#1370)
mushroomempires May 27, 2024
446c35c
fix(ci): add missing semicolons in debian promote action (#1371) (#1376)
mushroomempires May 28, 2024
ef41102
enh(engine): Engine can be started with configuration files that comp…
jean-christophe81 May 28, 2024
6040163
enh(engine): Allow bypass the notification inhibitions for recovery n…
jean-christophe81 May 28, 2024
80dc0f7
fix(ci): force ubuntu 22.04 usage in all (mostly veracode) pipelines …
mushroomempires May 30, 2024
d4fc4d9
fix(ci): force veracode action to 0.2.6 (#1405)
sc979 Jun 6, 2024
0ad75d6
chore(release): bump collect to 22.10.10
pkippes Jun 10, 2024
caa957d
chore(release): bump collect to 22.10.10
pkippes Jun 10, 2024
2994631
fix(release): fix release action divergence (#1426)
tuntoja Jun 12, 2024
66d8ff4
fix(ci): fix mismatching cache name between packaging and delivery (#…
tuntoja Jun 12, 2024
c5ac592
fix(promote): align promote with develop (#1445)
tuntoja Jun 17, 2024
51074ec
fix(release): add release_id to data sent to JIRA release (#1450) (#1…
tuntoja Jun 19, 2024
aa06738
fix(release): fix checkout depth in release action (#1457)
tuntoja Jun 20, 2024
50ed20f
fix(release): use pcre to get jira_release_id (#1471) (#1473)
tuntoja Jun 27, 2024
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
53 changes: 46 additions & 7 deletions .github/actions/delivery/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ inputs:
artifactory_token:
description: "The token for artifactory"
required: true
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 @@ -72,6 +81,8 @@ runs:
- if: ${{ startsWith(inputs.distrib, 'el') && env.stability != 'canary' }}
name: Publish RPMs
run: |
set -eux

FILES="*.${{ env.extfile }}"

echo "[DEBUG] - Version: ${{ inputs.version }}"
Expand All @@ -87,23 +98,51 @@ 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"
ARCH=$(echo $FILE | grep -oP '(x86_64|noarch)')
echo "[DEBUG] - Arch: $ARCH"
cp "$FILE" "$ARCH"
done

for ARCH in "noarch" "x86_64"; do
if [ "$(ls -A $ARCH)" ]; then
if [ "${{ env.stability }}" == "stable" ]; then
jf rt upload "$ARCH/*.rpm" "rpm-standard/${{ inputs.version }}/${{ inputs.distrib }}/${{ env.stability }}/$ARCH/RPMS/${{ inputs.module_name }}/" --flat
else
jf rt upload "$ARCH/*.rpm" "rpm-standard/${{ inputs.version }}/${{ inputs.distrib }}/${{ env.stability }}/$ARCH/${{ inputs.module_name }}/" --sync-deletes="rpm-standard/${{ inputs.version }}/${{ inputs.distrib }}/${{ env.stability }}/$ARCH/${{ inputs.module_name }}/" --flat
# 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
echo "[DEBUG] - Stability is ${{ inputs.stability }}, not delivering."
else
jf rt upload "$ARCH/*.rpm" "$ROOT_REPO_PATH/$UPLOAD_REPO_PATH" --sync-deletes="$ROOT_REPO_PATH/$UPLOAD_REPO_PATH" --flat
fi
fi
fi
done
done
shell: bash

Expand Down
94 changes: 78 additions & 16 deletions .github/actions/promote-to-stable/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,23 @@ inputs:
stability:
description: "The package stability (stable, testing, unstable)"
required: true
github_ref_name:
description: "Release base ref name for push event"
required: true
repository_name:
description: "The repository name"
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 }}
Expand All @@ -41,13 +50,40 @@ runs:
- 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_ref_name }} == "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 search --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 @@ -56,39 +92,56 @@ 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"

# Download candidates for promote
echo "[DEBUG] - Promoting $ARCH testing artifacts to stable."
for ARTIFACT in ${SRC_PATHS[@]}; do
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
if: ${{ startsWith(inputs.distrib, 'bullseye') }}
if: ${{ contains(fromJSON('["bullseye", "bookworm"]'), inputs.distrib) }}
run: |
set -eux

echo "[DEBUG] - Major version: ${{ inputs.major_version }}"
echo "[DEBUG] - Minor version: ${{ inputs.minor_version }}"
echo "[DEBUG] - Distrib: ${{ inputs.distrib }}"
echo "[DEBUG] - Repository name: ${{ inputs.repository_name }}"

if [[ "${{ inputs.repository_name }}" == "standard" ]]; then
ROOT_REPO_PATH="apt-standard-${{ inputs.major_version }}"
else
echo "Invalid repository name: ${{ inputs.repository_name }}"
exit 1
fi
# Define ROOT_REPO_PATH for debian
# There is no cloud ROOT_REPO_PATH for debian, only onprem
# Should there be a need to deploy debian to cloud repositories, please use the same condition as RPM promotion
ROOT_REPO_PATH="apt-standard-${{ inputs.major_version }}"

echo "[DEBUG] - Get path of testing DEB packages to promote to stable."
SRC_PATHS=$(jf rt search --include-dirs $ROOT_REPO_PATH-testing/pool/${{ inputs.module_name }}/*.deb | jq -r '.[].path')

case "${{ inputs.major_version }}" in
"22.10"|"23.04"|"23.10")
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')
;;
esac

if [[ ${SRC_PATHS[@]} ]]; then
for SRC_PATH in ${SRC_PATHS[@]}; do
echo "[DEBUG] - Source path found: $SRC_PATH"
Expand All @@ -106,10 +159,19 @@ runs:
jf rt download $ARTIFACT --flat
done

for ARTIFACT_DL in $(dir|grep -E "*.deb"); do
case "${{ inputs.major_version }}" in
"22.10"|"23.04"|"23.10")
ARTIFACT_SEARCH_PATTERN=".+\.deb"
;;
*)
ARTIFACT_SEARCH_PATTERN=".+${{ inputs.distrib }}.+\.deb"
;;
esac

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"
jf rt upload "$ARTIFACT_DL" "$TARGET_PATH" --deb "${{ inputs.distrib }}/main/$ARCH" --flat
done

rm -f *.deb
Expand Down
Loading
Loading