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

fix(ci): fix release pipelines issues #1250

Merged
merged 3 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
fix(ci): fix release pipelines issues
  • Loading branch information
tuntoja committed Apr 2, 2024
commit 2eb8ab33410dd25ca5c7f9fd2b85dcc94ae3d26e
2 changes: 1 addition & 1 deletion .github/actions/delivery/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ runs:
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
jf rt upload "$ARCH/*.rpm" "$ROOT_REPO_PATH/$UPLOAD_REPO_PATH" --sync-deletes="$ROOT_REPO_PATH/$UPLOAD_REPO_PATH" --sync-deletes="$ROOT_REPO_PATH/$UPLOAD_REPO_PATH/"--flat
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
jf rt upload "$ARCH/*.rpm" "$ROOT_REPO_PATH/$UPLOAD_REPO_PATH" --sync-deletes="$ROOT_REPO_PATH/$UPLOAD_REPO_PATH" --sync-deletes="$ROOT_REPO_PATH/$UPLOAD_REPO_PATH/"--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
40 changes: 22 additions & 18 deletions .github/actions/promote-to-stable/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ inputs:
repository_name:
description: "The repository name"
required: true
github_base_ref:
description: "Release base ref"
github_ref_name:
description: "Release base ref name for push event"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: "Release base ref name for push event"
description: "Release base ref name for push event"

required: true
release_type:
description: "Type of release (hotfix, release)"
Expand All @@ -35,7 +35,7 @@ inputs:
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 @@ -60,21 +60,23 @@ runs:
ROOT_REPO_PATH="rpm-standard"
fi

# 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

# 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."

# 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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_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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
elif [[ ${{ inputs.release_cloud }} -eq 0 ]];then
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 @@ -85,7 +87,7 @@ runs:
fi

# Build target path based on ARCH
echo "[DEBUG] - Build $ARCH artifactory target path."
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"

Expand All @@ -105,6 +107,7 @@ runs:
# Cleanup before next round of candidates
rm -f *.rpm
done

shell: bash

- name: Promote DEB packages to stable
Expand All @@ -115,7 +118,7 @@ runs:
echo "[DEBUG] - Distrib: ${{ inputs.distrib }}"

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

if [[ ${SRC_PATHS[@]} ]]; then
for SRC_PATH in ${SRC_PATHS[@]}; do
Expand All @@ -139,8 +142,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
2 changes: 1 addition & 1 deletion .github/workflows/centreon-collect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,6 @@ jobs:
minor_version: ${{ needs.get-version.outputs.patch }}
stability: ${{ needs.get-version.outputs.stability }}
repository_name: standard
github_base_ref: ${{ github.base_ref }}
github_ref_name: ${{ github.ref_name }}
release_type: ${{ needs.get-version.outputs.release_type }}
release_cloud: ${{ needs.get-version.outputs.release_cloud }}
2 changes: 2 additions & 0 deletions .github/workflows/get-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ jobs:
case "$BRANCHNAME" in
master | [2-9][0-9].[0-9][0-9].x)
echo "release=1" >> $GITHUB_OUTPUT
echo "release_cloud=$GITHUB_RELEASE_CLOUD" >> $GITHUB_OUTPUT
echo "release_type=$GITHUB_RELEASE_TYPE" >> $GITHUB_OUTPUT
;;
release* | hotfix*)
# Handle workflow_dispatch run triggers and run a dispatch ONLY for cloud release
Expand Down
Loading