From a47a4408705158055aca9101a758a68ec514d2ce Mon Sep 17 00:00:00 2001 From: Kevin Duret Date: Mon, 30 Sep 2024 08:53:09 +0200 Subject: [PATCH] chore(packaging): update deb packages naming convention (#5203) --- .github/actions/package-nfpm/action.yml | 10 ++++- .github/actions/parse-distrib/action.yml | 46 ++++++++++++++++++++ .github/actions/promote-to-stable/action.yml | 13 ++++-- .github/workflows/perl-cpan-libraries.yml | 12 ++++- .github/workflows/perl-filesys-smbclient.yml | 8 +++- 5 files changed, 80 insertions(+), 9 deletions(-) create mode 100644 .github/actions/parse-distrib/action.yml diff --git a/.github/actions/package-nfpm/action.yml b/.github/actions/package-nfpm/action.yml index 0406144b8..1aca021b8 100644 --- a/.github/actions/package-nfpm/action.yml +++ b/.github/actions/package-nfpm/action.yml @@ -54,6 +54,12 @@ runs: rm -f ./*.rpm shell: bash + - 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 }} @@ -84,9 +90,9 @@ runs: else export DIST="" if [ "${{ inputs.stability }}" == "unstable" ] || [ "${{ inputs.stability }}" == "canary" ]; then - export RELEASE="$RELEASE~${{ inputs.distrib }}" + export RELEASE="$RELEASE${{ steps.parse-distrib.outputs.package_distrib_separator }}${{ steps.parse-distrib.outputs.package_distrib_name }}" else - export RELEASE="1~${{ inputs.distrib }}" + export RELEASE="1${{ steps.parse-distrib.outputs.package_distrib_separator }}${{ steps.parse-distrib.outputs.package_distrib_name }}" fi export APACHE_USER="www-data" export APACHE_GROUP="www-data" diff --git a/.github/actions/parse-distrib/action.yml b/.github/actions/parse-distrib/action.yml new file mode 100644 index 000000000..bf79d0005 --- /dev/null +++ b/.github/actions/parse-distrib/action.yml @@ -0,0 +1,46 @@ +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 diff --git a/.github/actions/promote-to-stable/action.yml b/.github/actions/promote-to-stable/action.yml index 0309e7677..209f10d38 100644 --- a/.github/actions/promote-to-stable/action.yml +++ b/.github/actions/promote-to-stable/action.yml @@ -22,6 +22,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: | @@ -68,15 +74,15 @@ runs: echo "[DEBUG] - Distrib: ${{ inputs.module }}" echo "[DEBUG] - Get path of testing DEB packages to promote to stable." - SRC_PATHS=$(jf rt search --include-dirs apt-plugins-testing/pool/${{ inputs.module }}/*${{ inputs.distrib }}*.deb | jq -r '.[].path') + SRC_PATHS=$(jf rt search --include-dirs apt-plugins-testing/pool/${{ inputs.module }}/*${{ steps.parse-distrib.outputs.package_distrib_name }}*.deb | jq -r '.[].path') if [[ ${SRC_PATHS[@]} ]]; then for SRC_PATH in ${SRC_PATHS[@]}; do 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." @@ -95,5 +101,4 @@ runs: jf rt upload "$ARTIFACT_DL" "$TARGET_PATH" --deb "${{ inputs.distrib }}/main/$ARCH" done rm -f *.deb - shell: bash diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index c59373545..7f7f3b2bd 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -425,6 +425,13 @@ jobs: - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + name: Parse distrib name + id: parse-distrib + uses: ./.github/actions/parse-distrib + with: + distrib: ${{ matrix.distrib }} + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} name: Get package version id: package-version @@ -470,7 +477,8 @@ jobs: gem install fpm # Patch to apply fpm fix for debian package generation while waiting for the official fix to be released. patch -i .github/patch/fpm-deb.rb.diff $(find / -type f -name "deb.rb") - fpm -a native -s cpan -t ${{ matrix.package_extension }} --deb-dist ${{ matrix.distrib }} --iteration ${{ matrix.distrib }} --verbose --cpan-verbose --no-cpan-test$PACKAGE_DEPENDENCIES -v ${{ steps.package-version.outputs.package_version }} ${{ matrix.name }} + + fpm -a native -s cpan -t ${{ matrix.package_extension }} --deb-dist ${{ matrix.distrib }} --iteration ${{ steps.parse-distrib.outputs.package_distrib_name }} --verbose --cpan-verbose --no-cpan-test$PACKAGE_DEPENDENCIES -v ${{ steps.package-version.outputs.package_version }} ${{ matrix.name }} shell: bash - if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.use_dh_make_perl == 'true' }} @@ -478,7 +486,7 @@ jobs: apt-get install -y libcurl4-openssl-dev dh-make-perl libssh-dev uuid-dev libczmq-dev libmodule-install-perl libmodule-build-tiny-perl # module-build-tiny is required for Mojo::IOLoop::Signal build. - DEB_BUILD_OPTIONS="nocheck nodocs notest" dh-make-perl make --dist ${{ matrix.distrib }} --build --version ${{ steps.package-version.outputs.package_version }}-${{ matrix.distrib }} --cpan ${{ matrix.name }} + DEB_BUILD_OPTIONS="nocheck nodocs notest" dh-make-perl make --dist ${{ matrix.distrib }} --build --version ${{ steps.package-version.outputs.package_version }}${{ steps.parse-distrib.outputs.package_distrib_separator }}${{ steps.parse-distrib.outputs.package_distrib_name }} --cpan ${{ matrix.name }} shell: bash - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} diff --git a/.github/workflows/perl-filesys-smbclient.yml b/.github/workflows/perl-filesys-smbclient.yml index 62875563f..a3642109e 100644 --- a/.github/workflows/perl-filesys-smbclient.yml +++ b/.github/workflows/perl-filesys-smbclient.yml @@ -132,6 +132,12 @@ jobs: steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Parse distrib name + id: parse-distrib + uses: ./.github/actions/parse-distrib + with: + distrib: ${{ matrix.distrib }} + - run: | apt update apt install -y dh-make-perl perl libsmbclient-dev @@ -139,7 +145,7 @@ jobs: mv dependencies/perl-filesys-smbclient/src/ perl-filesys-smbclient tar czf perl-filesys-smbclient.tar.gz perl-filesys-smbclient - DEB_BUILD_OPTIONS="nocheck nodocs notest noautodbgsym" dh-make-perl make --dist ${{ matrix.distrib }} --verbose --build --version 4.0-${{ matrix.distrib }} perl-filesys-smbclient/ + DEB_BUILD_OPTIONS="nocheck nodocs notest noautodbgsym" dh-make-perl make --dist ${{ matrix.distrib }} --verbose --build --version 4.0${{ steps.parse-distrib.outputs.package_distrib_separator }}${{ steps.parse-distrib.outputs.package_distrib_name }} perl-filesys-smbclient/ shell: bash - uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2