Skip to content

Commit

Permalink
fix(ci): fix release pipelines issues (#1250)
Browse files Browse the repository at this point in the history
* fix(ci): fix release pipelines issues

* fix(ci): fix libzmq promote input

* fix invalid rpm promote command
  • Loading branch information
tuntoja committed Apr 2, 2024
1 parent 764ae33 commit 679b6af
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
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"
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
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 @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/libzmq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,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 }}

0 comments on commit 679b6af

Please sign in to comment.