Skip to content

Commit

Permalink
enh(ci): refactor get-version workflow (#1777) (#1781)
Browse files Browse the repository at this point in the history
  • Loading branch information
kduret authored Nov 4, 2024
1 parent 94c63c6 commit 928e5c6
Show file tree
Hide file tree
Showing 26 changed files with 535 additions and 463 deletions.
6 changes: 3 additions & 3 deletions .github/actions/deb-delivery/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ inputs:
release_type:
description: "Type of release (hotfix, release)"
required: true
release_cloud:
is_cloud:
description: "Release context (cloud or not cloud)"
required: true

Expand All @@ -49,12 +49,12 @@ runs:
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] - is_cloud: ${{ inputs.is_cloud }}"
echo "[DEBUG] - release_type: ${{ inputs.release_type }}"
echo "[DEBUG] - stability: ${{ inputs.stability }}"
# Make sure all required inputs are NOT empty
if [[ -z "${{ inputs.module_name }}" || -z "${{ inputs.distrib }}" || -z ${{ inputs.stability }} || -z ${{ inputs.version }} || -z ${{ inputs.release_cloud }} || -z ${{ inputs.release_type }} ]]; then
if [[ -z "${{ inputs.module_name }}" || -z "${{ inputs.distrib }}" || -z ${{ inputs.stability }} || -z ${{ inputs.version }} || -z "${{ inputs.is_cloud }}" ]]; then
echo "Some mandatory inputs are empty, please check the logs."
exit 1
fi
Expand Down
20 changes: 10 additions & 10 deletions .github/actions/delivery/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ inputs:
release_type:
description: "Type of release (hotfix, release)"
required: true
release_cloud:
is_cloud:
description: "Release context (cloud or not cloud)"
required: true

Expand Down Expand Up @@ -63,12 +63,12 @@ runs:
echo "[DEBUG] - Major version: ${{ inputs.major_version }}"
echo "[DEBUG] - Distrib: ${{ inputs.distrib }}"
echo "[DEBUG] - module_name: ${{ inputs.module_name }}"
echo "[DEBUG] - release_cloud: ${{ inputs.release_cloud }}"
echo "[DEBUG] - is_cloud: ${{ inputs.is_cloud }}"
echo "[DEBUG] - release_type: ${{ inputs.release_type }}"
echo "[DEBUG] - stability: ${{ inputs.stability }}"
# Make sure all required inputs are NOT empty
if [[ -z "${{ inputs.module_name }}" || -z "${{ inputs.distrib }}" || -z ${{ inputs.stability }} || -z ${{ inputs.major_version }} || -z ${{ inputs.release_cloud }} || -z ${{ inputs.release_type }} ]]; then
if [[ -z "${{ inputs.module_name }}" || -z "${{ inputs.distrib }}" || -z ${{ inputs.stability }} || -z ${{ inputs.major_version }} || -z "${{ inputs.is_cloud }}" ]]; then
echo "Some mandatory inputs are empty, please check the logs."
exit 1
fi
Expand All @@ -87,32 +87,32 @@ runs:
mv "$FILE" "$ARCH"
done
# Build upload target path based on release_cloud and release_type values
# Build upload target path based on is_cloud and release_type values
# if cloud + hotfix or cloud + release, deliver to internal testing-<release_type>
# if cloud + develop, delivery to internal unstable
# if non-cloud, delivery to onprem testing or unstable
# CLOUD + HOTFIX + REPO STANDARD INTERNAL OR CLOUD + RELEASE + REPO STANDARD INTERNAL
if [[ ${{ inputs.release_cloud }} -eq 1 && ( ${{ inputs.release_type }} == "hotfix" || ${{ inputs.release_type }} == "release" ) ]]; then
if [[ "${{ inputs.is_cloud }}" == "true" && ( "${{ inputs.release_type }}" == "hotfix" || "${{ inputs.release_type }}" == "release" ) ]]; then
echo "[DEBUG] : Release cloud + ${{ inputs.release_type }}, using rpm-standard-internal."
ROOT_REPO_PATHS="rpm-standard-internal"
UPLOAD_REPO_PATH="${{ inputs.major_version }}/${{ inputs.distrib }}/${{ inputs.stability }}-${{ inputs.release_type }}/$ARCH/${{ inputs.module_name }}/"
# CLOUD + NOT HOTFIX OR CLOUD + NOT RELEASE + REPO STANDARD INTERNAL
elif [[ ${{ inputs.release_cloud }} -eq 1 && ( ${{ inputs.release_type }} != "hotfix" && ${{ inputs.release_type }} != "release" ) ]]; then
elif [[ "${{ inputs.is_cloud }}" == "true" && ( "${{ inputs.release_type }}" != "hotfix" && "${{ inputs.release_type }}" != "release" ) ]]; then
echo "[DEBUG] : Release cloud + NOT ${{ inputs.release_type }}, using rpm-standard-internal."
ROOT_REPO_PATHS="rpm-standard-internal"
UPLOAD_REPO_PATH="${{ inputs.major_version }}/${{ inputs.distrib }}/${{ inputs.stability }}-${{ inputs.release_type }}/$ARCH/${{ inputs.module_name }}/"
# NON-CLOUD + (HOTFIX OR RELEASE) + REPO STANDARD
elif [[ ${{ inputs.release_cloud }} -eq 0 ]]; then
elif [[ "${{ inputs.is_cloud }}" == "false" ]]; then
echo "[DEBUG] : NOT Release cloud + ${{ inputs.release_type }}, using rpm-standard."
ROOT_REPO_PATHS="rpm-standard"
UPLOAD_REPO_PATH="${{ inputs.major_version }}/${{ inputs.distrib }}/${{ inputs.stability }}/$ARCH/${{ inputs.module_name }}/"
# NOT VALID, DO NOT DELIVER
else
echo "::error:: Invalid combination of release_type [${{ inputs.release_type }}] and release_cloud [${{ inputs.release_cloud }}]"
echo "::error:: Invalid combination of release_type [${{ inputs.release_type }}] and is_cloud [${{ inputs.is_cloud }}]"
exit 1
fi
Expand Down Expand Up @@ -141,12 +141,12 @@ runs:
echo "[DEBUG] - Major version: ${{ inputs.major_version }}"
echo "[DEBUG] - Distrib: ${{ inputs.distrib }}"
echo "[DEBUG] - module_name: ${{ inputs.module_name }}"
echo "[DEBUG] - release_cloud: ${{ inputs.release_cloud }}"
echo "[DEBUG] - is_cloud: ${{ inputs.is_cloud }}"
echo "[DEBUG] - release_type: ${{ inputs.release_type }}"
echo "[DEBUG] - stability: ${{ inputs.stability }}"
# Make sure all required inputs are NOT empty
if [[ -z "${{ inputs.module_name }}" || -z "${{ inputs.distrib }}" || -z ${{ inputs.stability }} || -z ${{ inputs.major_version }} || -z ${{ inputs.release_cloud }} || -z ${{ inputs.release_type }} ]]; then
if [[ -z "${{ inputs.module_name }}" || -z "${{ inputs.distrib }}" || -z ${{ inputs.stability }} || -z ${{ inputs.major_version }} || -z "${{ inputs.is_cloud }}" || -z "${{ inputs.release_type }}" ]]; then
echo "Some mandatory inputs are empty, please check the logs."
exit 1
fi
Expand Down
12 changes: 6 additions & 6 deletions .github/actions/promote-to-stable/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ inputs:
release_type:
description: "Type of release (hotfix, release)"
required: true
release_cloud:
is_cloud:
description: "Release context (cloud or not cloud)"
required: true

Expand All @@ -48,7 +48,7 @@ runs:
# DEBUG
echo "[DEBUG] - Major version: ${{ inputs.major_version }}"
echo "[DEBUG] - Distrib: ${{ inputs.distrib }}"
echo "[DEBUG] - release_cloud: ${{ inputs.release_cloud }}"
echo "[DEBUG] - is_cloud: ${{ inputs.is_cloud }}"
echo "[DEBUG] - release_type: ${{ inputs.release_type }}"
# Cloud specific promote
Expand All @@ -62,15 +62,15 @@ runs:
# Search for testing packages candidate for promote
for ARCH in "noarch" "x86_64"; do
# Build search path based on release_cloud and release_type values
# Build search path based on is_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
if [[ "${{ inputs.is_cloud }}" == "true" && "${{ inputs.release_type }}" == "hotfix" ]] || [[ "${{ inputs.is_cloud }}" == "true" && "${{ 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
elif [[ "${{ inputs.is_cloud }}" == "false" ]]; then
SEARCH_REPO_PATH="${{ inputs.major_version }}/${{ inputs.distrib }}/testing/$ARCH/${{ inputs.module_name }}"
else
echo "Invalid combination of release_type and release_cloud"
echo "Invalid combination of release_type and is_cloud"
fi
echo "[DEBUG] - Get path of $ARCH testing artifacts to promote to stable."
Expand Down
16 changes: 8 additions & 8 deletions .github/actions/rpm-delivery/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ inputs:
release_type:
description: "Type of release (hotfix, release)"
required: true
release_cloud:
is_cloud:
description: "Release context (cloud or not cloud)"
required: true

Expand Down Expand Up @@ -61,12 +61,12 @@ runs:
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] - is_cloud: ${{ inputs.is_cloud }}"
echo "[DEBUG] - release_type: ${{ inputs.release_type }}"
echo "[DEBUG] - stability: ${{ inputs.stability }}"
# Make sure all required inputs are NOT empty
if [[ -z "${{ inputs.module_name }}" || -z "${{ inputs.distrib }}" || -z ${{ inputs.stability }} || -z ${{ inputs.version }} || -z ${{ inputs.release_cloud }} || -z ${{ inputs.release_type }} ]]; then
if [[ -z "${{ inputs.module_name }}" || -z "${{ inputs.distrib }}" || -z ${{ inputs.stability }} || -z ${{ inputs.version }} || -z "${{ inputs.is_cloud }}" ]]; then
echo "Some mandatory inputs are empty, please check the logs."
exit 1
fi
Expand All @@ -85,32 +85,32 @@ runs:
mv "$FILE" "$ARCH"
done
# Build upload target path based on release_cloud and release_type values
# Build upload target path based on is_cloud and release_type values
# if cloud + hotfix or cloud + release, deliver to internal testing-<release_type>
# if cloud + develop, delivery to internal unstable
# if non-cloud, delivery to onprem testing or unstable
# CLOUD + HOTFIX + REPO STANDARD INTERNAL OR CLOUD + RELEASE + REPO STANDARD INTERNAL
if [[ ${{ inputs.release_cloud }} -eq 1 ]] && ([[ ${{ inputs.release_type }} == "hotfix" ]] || [[ ${{ inputs.release_type }} == "release" ]]); then
if [[ "${{ inputs.is_cloud }}" == "true" ]] && ([[ "${{ inputs.release_type }}" == "hotfix" ]] || [[ "${{ inputs.release_type }}" == "release" ]]); then
echo "[DEBUG] : Release cloud + ${{ inputs.release_type }}, using rpm-standard-internal."
ROOT_REPO_PATHS="rpm-standard-internal"
UPLOAD_REPO_PATH="${{ inputs.version }}/${{ inputs.distrib }}/${{ inputs.stability }}-${{ inputs.release_type }}/$ARCH/${{ inputs.module_name }}/"
# CLOUD + NOT HOTFIX OR CLOUD + NOT RELEASE + REPO STANDARD INTERNAL
elif [[ ${{ inputs.release_cloud }} -eq 1 ]] && ([[ ${{ inputs.release_type }} != "hotfix" ]] || [[ ${{ inputs.release_type }} != "release" ]]); then
elif [[ "${{ inputs.is_cloud }}" == "true" ]] && ([[ "${{ inputs.release_type }}" != "hotfix" ]] || [[ "${{ inputs.release_type }}" != "release" ]]); then
echo "[DEBUG] : Release cloud + NOT ${{ inputs.release_type }}, using rpm-standard-internal."
ROOT_REPO_PATHS="rpm-standard-internal"
UPLOAD_REPO_PATH="${{ inputs.version }}/${{ inputs.distrib }}/${{ inputs.stability }}-${{ inputs.release_type }}/$ARCH/${{ inputs.module_name }}/"
# NON-CLOUD + (HOTFIX OR RELEASE) + REPO STANDARD
elif [[ ${{ inputs.release_cloud }} -eq 0 ]]; then
elif [[ "${{ inputs.is_cloud }}" == "false" ]]; then
echo "[DEBUG] : NOT Release cloud + ${{ inputs.release_type }}, using rpm-standard."
ROOT_REPO_PATHS="rpm-standard"
UPLOAD_REPO_PATH="${{ inputs.version }}/${{ inputs.distrib }}/${{ inputs.stability }}/$ARCH/${{ inputs.module_name }}/"
# ANYTHING ELSE
else
echo "::error:: Invalid combination of release_type [${{ inputs.release_type }}] and release_cloud [${{ inputs.release_cloud }}]"
echo "::error:: Invalid combination of release_type [${{ inputs.release_type }}] and is_cloud [${{ inputs.is_cloud }}]"
exit 1
fi
Expand Down
4 changes: 3 additions & 1 deletion .github/docker/Dockerfile.gorgone-testing-alma8
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
FROM almalinux:8

ARG VERSION

RUN bash -e <<EOF

dnf install -y dnf-plugins-core zstd curl mariadb iproute procps lsof
dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm
dnf config-manager --set-enabled 'powertools'
dnf -y config-manager --add-repo https://packages.centreon.com/rpm-standard/23.10/el8/centreon-23.10.repo
dnf -y config-manager --add-repo https://packages.centreon.com/rpm-standard/${VERSION}/el8/centreon-${VERSION}.repo
dnf -y clean all --enablerepo=*
dnf install -y python3.11 python3.11-pip
pip3.11 install robotframework robotframework-examples robotframework-databaselibrary pymysql robotframework-requests robotframework-jsonlibrary
Expand Down
4 changes: 3 additions & 1 deletion .github/docker/Dockerfile.gorgone-testing-alma9
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
FROM almalinux:9

ARG VERSION

RUN bash -e <<EOF

dnf install -y dnf-plugins-core zstd mariadb iproute epel-release procps lsof
dnf config-manager --set-enabled crb
dnf config-manager --add-repo https://packages.centreon.com/rpm-standard/23.10/el9/centreon-23.10.repo
dnf config-manager --add-repo https://packages.centreon.com/rpm-standard/${VERSION}/el9/centreon-${VERSION}.repo
dnf install -y python3.11 python3.11-pip
pip3.11 install robotframework robotframework-examples robotframework-databaselibrary pymysql robotframework-requests robotframework-jsonlibrary

Expand Down
4 changes: 3 additions & 1 deletion .github/docker/Dockerfile.gorgone-testing-bookworm
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM debian:bookworm

ARG VERSION

ENV DEBIAN_FRONTEND=noninteractive

RUN bash -e <<EOF
Expand All @@ -19,7 +21,7 @@ robotframework robotframework-examples robotframework-databaselibrary \
pymysql robotframework-requests robotframework-jsonlibrary

# can't use \$() method it would be executed before the main script, and lsb_release would not be installed.
lsb_release -sc | xargs -I % sh -c 'echo deb https://packages.centreon.com/apt-standard-24.05-stable/ % main' | tee /etc/apt/sources.list.d/centreon.list
lsb_release -sc | xargs -I % sh -c 'echo deb https://packages.centreon.com/apt-standard-${VERSION}-stable/ % main' | tee /etc/apt/sources.list.d/centreon.list
lsb_release -sc | xargs -I % sh -c 'echo deb https://packages.centreon.com/apt-plugins-stable/ % main' | tee /etc/apt/sources.list.d/centreon-plugins.list

wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1
Expand Down
4 changes: 3 additions & 1 deletion .github/docker/Dockerfile.gorgone-testing-bullseye
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM debian:bullseye

ARG VERSION

ENV DEBIAN_FRONTEND noninteractive
# fix locale
ENV LANG en_US.utf8
Expand All @@ -18,7 +20,7 @@ localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
pip3 install robotframework robotframework-examples robotframework-databaselibrary \
pymysql robotframework-requests robotframework-jsonlibrary

lsb_release -sc | xargs -I % sh -c 'echo deb https://packages.centreon.com/apt-standard-24.05-stable/ % main' | tee /etc/apt/sources.list.d/centreon.list
lsb_release -sc | xargs -I % sh -c 'echo deb https://packages.centreon.com/apt-standard-${VERSION}-stable/ % main' | tee /etc/apt/sources.list.d/centreon.list
lsb_release -sc | xargs -I % sh -c 'echo deb https://packages.centreon.com/apt-plugins-stable/ % main' | tee /etc/apt/sources.list.d/centreon-plugins.list

wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1
Expand Down
4 changes: 3 additions & 1 deletion .github/docker/Dockerfile.gorgone-testing-jammy
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM ubuntu:jammy

ARG VERSION

ENV DEBIAN_FRONTEND=noninteractive

# Set locale
Expand All @@ -11,7 +13,7 @@ RUN apt-get update && \
ENV LANG=en_US.UTF-8

# Add Centreon repositories and their public key
RUN echo "deb https://packages.centreon.com/ubuntu-standard-24.05-testing/ jammy main" | tee -a /etc/apt/sources.list.d/centreon-testing.list && \
RUN echo "deb https://packages.centreon.com/ubuntu-standard-${VERSION}-testing/ jammy main" | tee -a /etc/apt/sources.list.d/centreon-testing.list && \
echo "deb https://packages.centreon.com/ubuntu-plugins-testing/ jammy main" | tee -a /etc/apt/sources.list.d/centreon-plugins-testing.list && \
wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1 && \
apt-get update
Expand Down
Loading

0 comments on commit 928e5c6

Please sign in to comment.