From 7b0dd87a8d54d313cb902c2b96fcba15381983ba Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Sat, 7 Dec 2024 22:51:02 +0100 Subject: [PATCH 01/35] Adding cpan libs tests --- .github/workflows/perl-cpan-libraries.yml | 150 +++++- .github/workflows/test-cpan-libraries.yml | 563 ++++++++++++++++++++++ 2 files changed, 701 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/test-cpan-libraries.yml diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 988cc04cf6..4d75fa1a78 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -6,17 +6,17 @@ concurrency: on: workflow_dispatch: - pull_request: - paths: - - ".github/workflows/perl-cpan-libraries.yml" - push: - branches: - - develop - - dev-[2-9][0-9].[0-9][0-9].x - - master - - "[2-9][0-9].[0-9][0-9].x" - paths: - - ".github/workflows/perl-cpan-libraries.yml" +# pull_request: +# paths: +# - ".github/workflows/perl-cpan-libraries.yml" +# push: +# branches: +# - develop +# - dev-[2-9][0-9].[0-9][0-9].x +# - master +# - "[2-9][0-9].[0-9][0-9].x" +# paths: +# - ".github/workflows/perl-cpan-libraries.yml" jobs: get-environment: @@ -524,8 +524,134 @@ jobs: path: ./*.deb key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.distrib }} - deliver-packages: + test-packages: needs: [get-environment, sign-rpm, download-and-cache-deb] + strategy: + fail-fast: false + matrix: + include: + - package_extension: rpm + image: almalinux:8 + distrib: el8 + arch: amd64 + runner_name: ubuntu-24.04 + - package_extension: rpm + image: almalinux:9 + distrib: el9 + arch: amd64 + runner_name: ubuntu-24.04 + - package_extension: deb + image: debian:bullseye + distrib: bullseye + arch: amd64 + runner_name: ubuntu-24.04 + - package_extension: deb + image: debian:bookworm + distrib: bookworm + arch: amd64 + runner_name: ubuntu-24.04 + - package_extension: deb + image: ubuntu:jammy + distrib: jammy + arch: amd64 + runner_name: ubuntu-24.04 + - package_extension: deb + image: arm64v8/debian:bullseye + distrib: bullseye + arch: arm64 + runner_name: ["self-hosted", "collect-arm64"] + + runs-on: ${{ matrix.runner_name }} + container: + image: ${{ matrix.image }} + + name: Test perl CPAN libs packages on ${{ matrix.package_extension }} ${{ matrix.distrib }} ${{ matrix.arch }} + steps: + - name: Install zstd, perl and Centreon repositories + run: | + if [ "${{ matrix.package_extension }}" == "rpm" ]; then + dnf install -y zstd perl epel-release 'dnf-command(config-manager)' + dnf config-manager --set-enabled powertools || true # alma 8 + dnf config-manager --set-enabled crb || true # alma 9 + # Add Centreon plugins repositories + echo -e '[centreon-plugins-stable]\nname=centreon plugins stable x86_64\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/x86_64\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n[centreon-plugins-stable-noarch]\nname=centreon plugins stable noarch\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/noarch\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n' >> /etc/yum.repos.d/centreon-plugins.repo + else + apt-get update + apt-get install -y zstd perl wget gpg apt-utils + # Add Centreon plugins repositories + if [ "${{ matrix.distrib }}" == "jammy" ]; then + echo "deb https://packages.centreon.com/ubuntu-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list + else + echo "deb https://packages.centreon.com/apt-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list + fi + wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1 + apt-get update + fi + shell: bash + - name: Restore packages from cache + uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 + with: + path: ./*.${{ matrix.package_extension }} + key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} + fail-on-cache-miss: true + - if: ${{ matrix.package_extension == 'rpm' }} + name: Install packages + run: | + error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" + for package in ./*.rpm; do + # List dependencies + dependencies=$(rpm -qpR $package) + for dependency in $dependencies; do + # If the dependency has been built in the same workflow, install it + if [ -f $dependency*.rpm ]; then + dnf install -y $dependency*.rpm 2>> $error_log || { echo "Error during installation of $package" >> $error_log; true; } + fi + done + # Install package + dnf install -y $package 2>> $error_log || { echo "Error during installation of $package" >> $error_log; true; } + # Uninstall package with all his dependencies + dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>> $error_log || true + done + # Si le fichier error_log existe et n'est pas vide, le workflow est en erreur + if [ -s $error_log ]; then + cat $error_log + exit 1 + fi + shell: bash + - if: ${{ matrix.package_extension == 'deb' }} + name: Install packages + run: | + error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" + for package in ./*.deb; do + # List dependencies + dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //') + for dependency in $dependencies; do + # If the dependency has been built in the same workflow, install it + if [ -f $dependency*.deb ]; then + apt-get install -y $dependency*.deb 2>> $error_log || { echo "Error during installation of $package" >> $error_log; true; } + fi + done + # Install package + apt-get install -y $package 2>> $error_log || { echo "Error during installation of $package" >> $error_log; true; } + # Uninstall package with all his dependencies + # Package name is the name of the file less the version and the .deb extension, and without the "./" at the beginning + apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>> $error_log || true + done + # Si le fichier error_log existe et n'est pas vide, le workflow est en erreur + if [ -s $error_log ]; then + cat $error_log + exit 1 + fi + shell: bash + - name: Upload error log + if: failure() + uses: actions/upload-artifact@v4 + with: + name: install_error_log_${{ matrix.distrib }}-${{ matrix.arch }} + path: install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log + + deliver-packages: + needs: [get-environment, sign-rpm, download-and-cache-deb, test-packages] if: | needs.get-environment.outputs.skip_workflow == 'false' && (contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) || ( needs.get-environment.outputs.stability == 'stable' && github.event_name != 'workflow_dispatch')) && diff --git a/.github/workflows/test-cpan-libraries.yml b/.github/workflows/test-cpan-libraries.yml new file mode 100644 index 0000000000..dd32198db8 --- /dev/null +++ b/.github/workflows/test-cpan-libraries.yml @@ -0,0 +1,563 @@ +name: test-perl-cpan-libraries + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +on: + workflow_dispatch: + pull_request: + paths: + - ".github/workflows/test-cpan-libraries.yml" + push: + branches: + - develop + - dev-[2-9][0-9].[0-9][0-9].x + - master + - "[2-9][0-9].[0-9][0-9].x" + paths: + - ".github/workflows/test-cpan-libraries.yml" + +jobs: + get-environment: + uses: ./.github/workflows/get-environment.yml + + package-rpm: + needs: [get-environment] + if: ${{ needs.get-environment.outputs.stability != 'stable' }} + + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + distrib: [el8, el9] + name: + [ + "ARGV::Struct", + "BSON", + "FFI::Platypus", + "ZMQ::FFI" + ] + include: + - build_distribs: "el8,el9" + - rpm_dependencies: "" + - rpm_provides: "" + - version: "" + - spec_file: "" + - no-auto-depends: false + - distrib: el8 + package_extension: rpm + image: packaging-plugins-alma8 + - distrib: el9 + package_extension: rpm + image: packaging-plugins-alma9 + - name: "BSON" + rpm_provides: "perl(BSON::Bytes) perl(BSON::Code) perl(BSON::DBRef) perl(BSON::OID) perl(BSON::Raw) perl(BSON::Regex) perl(BSON::Time) perl(BSON::Timestamp) perl(BSON::Types) perl(BSON)" + - name: "FFI::Platypus" + rpm_provides: "perl(FFI::Platypus::Buffer) perl(FFI::Platypus::Memory)" + rpm_dependencies: "perl(Capture::Tiny) perl(FFI::CheckLib) perl(File::Spec::Functions) perl(IPC::Cmd) perl(JSON::PP) perl(List::Util) perl(autodie) perl(constant) perl(parent)" + no-auto-depends: true + - name: "ZMQ::FFI" + rpm_dependencies: "zeromq" + + name: package ${{ matrix.distrib }} ${{ matrix.name }} + container: + image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest + credentials: + username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }} + password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }} + + steps: + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + run: | + yum install -y yum-utils epel-release git + yum config-manager --set-enabled crb || true # alma 9 + yum config-manager --set-enabled powertools || true # alma 8 + yum install -y cpanminus rpm-build libcurl-devel libssh-devel expat-devel gcc libuuid-devel zeromq-devel libxml2-devel libffi-devel perl-DBI perl-Net-Pcap freetds freetds-devel perl-Module-Build-Tiny + + dnf module reset -y ruby + dnf module enable -y ruby:3.1 + dnf install -y ruby ruby-devel + shell: bash + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + repository: kduret/fpm + ref: fix-rpm-perl-dependency-name-unchanged + path: fpm + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + name: Build and install fpm # waiting https://github.com/jordansissel/fpm/pull/2066 + run: | + dnf install -y bsdtar + cd fpm + gem install bundler + bundle install + make install + shell: bash + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file == '' }} + run: | + if [ -z "${{ matrix.version }}" ]; then + PACKAGE_VERSION="" + else + PACKAGE_VERSION=" -v ${{ matrix.version }}" + fi + + if [ -z "${{ matrix.rpm_dependencies }}" ]; then + PACKAGE_DEPENDENCIES="" + else + for PACKAGE_DEPENDENCY in `echo "${{ matrix.rpm_dependencies }}"`; do + PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --depends "$PACKAGE_DEPENDENCY"" + done + fi + + if [ ! -z "${{ matrix.no-auto-depends }}" ]; then + PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --no-auto-depends" + fi + + if [ -z "${{ matrix.rpm_provides }}" ]; then + PACKAGE_PROVIDES="" + else + for PACKAGE_PROVIDE in `echo "${{ matrix.rpm_provides }}"`; do + PACKAGE_PROVIDES="$PACKAGE_PROVIDES --provides $PACKAGE_PROVIDE" + done + fi + + cpanm Module::Build::Tiny + cpanm Module::Install + + export SYBASE="/usr" + + fpm -s cpan -t ${{ matrix.package_extension }} --rpm-dist ${{ matrix.distrib }} --verbose --cpan-verbose --no-cpan-test$PACKAGE_DEPENDENCIES$PACKAGE_PROVIDES$PACKAGE_VERSION ${{ matrix.name }} + shell: bash + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file != '' }} + run: | + mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} + + rpmbuild --undefine=_disable_source_fetch -ba ${{ matrix.spec_file }} + + cp -r ~/rpmbuild/RPMS/noarch/*.rpm . + shell: bash + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + name: Replace '::' with - in the feature path + id: package-name + run: | + name="${{ matrix.name }}" + name_with_dash="${name//::/-}" + echo "Modified Name: $name_with_dash" + echo "name_with_dash=$name_with_dash" >> $GITHUB_OUTPUT + shell: bash + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: packages-${{ matrix.package_extension }}-${{ matrix.distrib }}-${{ steps.package-name.outputs.name_with_dash }} + path: ./*.${{ matrix.package_extension }} + retention-days: 1 + + merge-package-rpm-artifacts: + needs: [package-rpm] + runs-on: ubuntu-24.04 + strategy: + matrix: + distrib: [el8, el9] + + steps: + - name: Merge Artifacts + uses: actions/upload-artifact/merge@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: packages-rpm-${{ matrix.distrib }} + pattern: packages-rpm-${{ matrix.distrib }}-* + delete-merged: false # cannot be set to true due to random fails: Failed to DeleteArtifact: Unable to make request: ECONNRESET + retention-days: 1 + + - name: Delete merged artifacts + uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5.1.0 + with: + name: packages-rpm-${{ matrix.distrib }}-* + failOnError: false + + sign-rpm: + needs: [merge-package-rpm-artifacts] + + runs-on: ubuntu-24.04 + strategy: + matrix: + distrib: [el8, el9] + name: sign rpm ${{ matrix.distrib }} + container: + image: docker.centreon.com/centreon-private/rpm-signing:latest + options: -t + credentials: + username: ${{ secrets.HARBOR_RPM_GPG_SIGNING_REPO_USERNAME }} + password: ${{ secrets.HARBOR_RPM_GPG_SIGNING_REPO_TOKEN }} + + steps: + - run: apt-get install -y zstd + shell: bash + + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: packages-rpm-${{ matrix.distrib }} + path: ./ + + - run: echo "HOME=/root" >> $GITHUB_ENV + shell: bash + + - run: rpmsign --addsign ./*.rpm + shell: bash + + - uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + with: + path: ./*.rpm + key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }} + + package-deb: + needs: [get-environment] + if: ${{ needs.get-environment.outputs.stability != 'stable' }} + + runs-on: ${{ matrix.runner_name }} + strategy: + fail-fast: false + matrix: + image: [packaging-plugins-bullseye, packaging-plugins-bookworm, packaging-plugins-jammy, packaging-plugins-bullseye-arm64] + name: + [ + "ARGV::Struct", + "Digest::SHA1", + "Net::MQTT::Simple", + "ZMQ::LibZMQ4" + ] + include: + - runner_name: ubuntu-24.04 + - arch: amd64 + - build_distribs: "bullseye,bookworm,jammy" + - deb_dependencies: "" + - rpm_provides: "" + - version: "" + - use_dh_make_perl: "true" + - spec_file: "" + - no-auto-depends: false + - distrib: bullseye + package_extension: deb + image: packaging-plugins-bullseye + - distrib: bookworm + package_extension: deb + image: packaging-plugins-bookworm + - distrib: jammy + package_extension: deb + image: packaging-plugins-jammy + - distrib: bullseye + package_extension: deb + image: packaging-plugins-bullseye-arm64 + arch: arm64 + runner_name: ["self-hosted", "collect-arm64"] + - name: "Net::MQTT::Simple" + version: "1.29" + - name: "ZMQ::LibZMQ4" + use_dh_make_perl: "false" + version: "0.01" + deb_dependencies: "libzmq5" + name: package ${{ matrix.distrib }} ${{ matrix.arch }} ${{ matrix.name }} + container: + image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest + credentials: + username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }} + password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }} + + steps: + - 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 + run: | + apt-get update + apt-get install -y cpanminus + + if [ -z "${{ matrix.version }}" ]; then + CPAN_PACKAGE_VERSION=$(cpanm --info ${{ matrix.name }} | sed 's/\.tar\.gz$//' | sed 's/.*\-//' | sed 's/v//') + + if [[ ! $CPAN_PACKAGE_VERSION =~ ^[0-9]+\.[0-9]+ ]]; then + echo "::error::Invalid version number: ${CPAN_PACKAGE_VERSION}" + exit 1 + fi + + PACKAGE_VERSION="${CPAN_PACKAGE_VERSION}" + else + PACKAGE_VERSION="${{ matrix.version }}" + fi + + echo "package_version=$(echo $PACKAGE_VERSION)" >> $GITHUB_OUTPUT + shell: bash + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.use_dh_make_perl == 'false' }} + run: | + apt-get install -y ruby libcurl4-openssl-dev libssh-dev uuid-dev libczmq-dev + + if [ -z "${{ matrix.deb_dependencies }}" ]; then + PACKAGE_DEPENDENCIES="" + else + for PACKAGE_DEPENDENCY in `echo ${{ matrix.deb_dependencies }}`; do + PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --depends $PACKAGE_DEPENDENCY" + done + fi + + if [ ! -z "${{ matrix.no-auto-depends }}" ]; then + PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --no-auto-depends" + fi + + cpanm Module::Build::Tiny + cpanm Module::Install + + 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 ${{ 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' }} + run: | + 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 }}${{ 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) }} + name: Replace '::' with - in the feature path + id: package-name + run: | + name="${{ matrix.name }}" + name_with_dash="${name//::/-}" + echo "Modified Name: $name_with_dash" + echo "name_with_dash=$name_with_dash" >> $GITHUB_OUTPUT + shell: bash + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: packages-${{ matrix.package_extension }}-${{ matrix.distrib }}-${{ matrix.arch }}-${{ steps.package-name.outputs.name_with_dash}} + path: ./*.${{ matrix.package_extension }} + retention-days: 1 + + merge-package-deb-artifacts: + needs: [package-deb] + runs-on: ubuntu-24.04 + strategy: + matrix: + distrib: [bullseye, bookworm, jammy] + + steps: + - name: Merge Artifacts + uses: actions/upload-artifact/merge@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: packages-deb-${{ matrix.distrib }} + pattern: packages-deb-${{ matrix.distrib }}-* + delete-merged: false # cannot be set to true due to random fails: Failed to DeleteArtifact: Unable to make request: ECONNRESET + retention-days: 1 + + - name: Delete merged artifacts + uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5.1.0 + with: + name: packages-deb-${{ matrix.distrib }}-* + failOnError: false + + download-and-cache-deb: + needs: [merge-package-deb-artifacts] + runs-on: ubuntu-24.04 + strategy: + matrix: + distrib: [bullseye, bookworm, jammy] + steps: + - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: packages-deb-${{ matrix.distrib }} + path: ./ + + - uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + with: + path: ./*.deb + key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.distrib }} + + test-packages: + needs: [get-environment, sign-rpm, download-and-cache-deb] + strategy: + fail-fast: false + matrix: + include: + - package_extension: rpm + image: almalinux:8 + distrib: el8 + arch: amd64 + runner_name: ubuntu-24.04 + - package_extension: rpm + image: almalinux:9 + distrib: el9 + arch: amd64 + runner_name: ubuntu-24.04 + - package_extension: deb + image: debian:bullseye + distrib: bullseye + arch: amd64 + runner_name: ubuntu-24.04 + - package_extension: deb + image: debian:bookworm + distrib: bookworm + arch: amd64 + runner_name: ubuntu-24.04 + - package_extension: deb + image: ubuntu:jammy + distrib: jammy + arch: amd64 + runner_name: ubuntu-24.04 + - package_extension: deb + image: arm64v8/debian:bullseye + distrib: bullseye + arch: arm64 + runner_name: ["self-hosted", "collect-arm64"] + + runs-on: ${{ matrix.runner_name }} + container: + image: ${{ matrix.image }} + + name: Test perl CPAN libs packages on ${{ matrix.package_extension }} ${{ matrix.distrib }} ${{ matrix.arch }} + steps: + - name: Install zstd, perl and Centreon repositories + run: | + if [ "${{ matrix.package_extension }}" == "rpm" ]; then + dnf install -y zstd perl epel-release 'dnf-command(config-manager)' + dnf config-manager --set-enabled powertools || true # alma 8 + dnf config-manager --set-enabled crb || true # alma 9 + # Add Centreon plugins repositories + echo -e '[centreon-plugins-stable]\nname=centreon plugins stable x86_64\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/x86_64\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n[centreon-plugins-stable-noarch]\nname=centreon plugins stable noarch\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/noarch\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n' >> /etc/yum.repos.d/centreon-plugins.repo + else + apt-get update + apt-get install -y zstd perl wget gpg apt-utils + # Add Centreon plugins repositories + if [ "${{ matrix.distrib }}" == "jammy" ]; then + echo "deb https://packages.centreon.com/ubuntu-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list + else + echo "deb https://packages.centreon.com/apt-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list + fi + wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1 + apt-get update + fi + shell: bash + - name: Restore packages from cache + uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 + with: + path: ./*.${{ matrix.package_extension }} + key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} + fail-on-cache-miss: true + - if: ${{ matrix.package_extension == 'rpm' }} + name: Install packages + run: | + error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" + for package in ./*.rpm; do + # List dependencies + dependencies=$(rpm -qpR $package) + for dependency in $dependencies; do + # If the dependency has been built in the same workflow, install it + if [ -f $dependency*.rpm ]; then + dnf install -y $dependency*.rpm 2>> $error_log || { echo "Error during installation of $package" >> $error_log; true; } + fi + done + # Install package + dnf install -y $package 2>> $error_log || { echo "Error during installation of $package" >> $error_log; true; } + # Uninstall package with all his dependencies + dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>> $error_log || true + done + # Si le fichier error_log existe et n'est pas vide, le workflow est en erreur + if [ -s $error_log ]; then + cat $error_log + exit 1 + fi + shell: bash + - if: ${{ matrix.package_extension == 'deb' }} + name: Install packages + run: | + error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" + for package in ./*.deb; do + # List dependencies + dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //') + for dependency in $dependencies; do + # If the dependency has been built in the same workflow, install it + if [ -f $dependency*.deb ]; then + apt-get install -y $dependency*.deb 2>> $error_log || { echo "Error during installation of $package" >> $error_log; true; } + fi + done + # Install package + apt-get install -y $package 2>> $error_log || { echo "Error during installation of $package" >> $error_log; true; } + # Uninstall package with all his dependencies + # Package name is the name of the file less the version and the .deb extension, and without the "./" at the beginning + apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>> $error_log || true + done + # Si le fichier error_log existe et n'est pas vide, le workflow est en erreur + if [ -s $error_log ]; then + cat $error_log + exit 1 + fi + shell: bash + - name: Upload error log + if: failure() + uses: actions/upload-artifact@v4 + with: + name: install_error_log_${{ matrix.distrib }}-${{ matrix.arch }} + path: install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log + + deliver-packages: + needs: [get-environment, sign-rpm, download-and-cache-deb, test-packages] + if: | + (contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) || ( needs.get-environment.outputs.stability == 'stable' && github.event_name != 'workflow_dispatch')) && + ! cancelled() && + ! contains(needs.*.result, 'failure') && + ! contains(needs.*.result, 'cancelled') + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + include: + - distrib: el8 + package_extension: rpm + - distrib: el9 + package_extension: rpm + - distrib: bullseye + package_extension: deb + - distrib: bookworm + package_extension: deb + - distrib: jammy + package_extension: deb + + name: deliver ${{ matrix.distrib }} + steps: + - name: Checkout sources + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + + - name: Delivery + uses: ./.github/actions/package-delivery + with: + module_name: perl-cpan-libraries + distrib: ${{ matrix.distrib }} + cache_key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} + stability: ${{ needs.get-environment.outputs.stability }} + release_type: ${{ needs.get-environment.outputs.release_type }} + artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} From 316e5e499a2e17b2af30e79178abf5c9725cbaf5 Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Tue, 10 Dec 2024 14:55:51 +0100 Subject: [PATCH 02/35] Removing Digest::SHA1 (Digest::SHA used in plugins, and on official debian/ubuntu repos) --- .github/workflows/perl-cpan-libraries.yml | 1 - .github/workflows/test-cpan-libraries.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 4d75fa1a78..db0fa20d89 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -328,7 +328,6 @@ jobs: "Device::Modbus", "Device::Modbus::RTU::Client", "Device::Modbus::TCP::Client", - "Digest::SHA1", "Email::Send::SMTP::Gmail", "Hash::Ordered", "HTTP::ProxyPAC", diff --git a/.github/workflows/test-cpan-libraries.yml b/.github/workflows/test-cpan-libraries.yml index dd32198db8..80a40f300e 100644 --- a/.github/workflows/test-cpan-libraries.yml +++ b/.github/workflows/test-cpan-libraries.yml @@ -233,7 +233,6 @@ jobs: name: [ "ARGV::Struct", - "Digest::SHA1", "Net::MQTT::Simple", "ZMQ::LibZMQ4" ] From b51af89da68b97356e2ce4ac0b9179a4d941ab3f Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Tue, 10 Dec 2024 16:30:32 +0100 Subject: [PATCH 03/35] log error message only for true error --- .github/workflows/test-cpan-libraries.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-cpan-libraries.yml b/.github/workflows/test-cpan-libraries.yml index 80a40f300e..9c42f975ed 100644 --- a/.github/workflows/test-cpan-libraries.yml +++ b/.github/workflows/test-cpan-libraries.yml @@ -449,6 +449,7 @@ jobs: # Add Centreon plugins repositories echo -e '[centreon-plugins-stable]\nname=centreon plugins stable x86_64\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/x86_64\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n[centreon-plugins-stable-noarch]\nname=centreon plugins stable noarch\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/noarch\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n' >> /etc/yum.repos.d/centreon-plugins.repo else + export DEBIAN_FRONTEND=noninteractive apt-get update apt-get install -y zstd perl wget gpg apt-utils # Add Centreon plugins repositories @@ -477,13 +478,13 @@ jobs: for dependency in $dependencies; do # If the dependency has been built in the same workflow, install it if [ -f $dependency*.rpm ]; then - dnf install -y $dependency*.rpm 2>> $error_log || { echo "Error during installation of $package" >> $error_log; true; } + error_output=$(dnf install -y $dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of $dependency" >> $error_log; true; } fi done # Install package - dnf install -y $package 2>> $error_log || { echo "Error during installation of $package" >> $error_log; true; } + error_output=$(dnf install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of $package" >> $error_log; true; } # Uninstall package with all his dependencies - dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>> $error_log || true + error_output=$(dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of $package" >> $error_log; true; } done # Si le fichier error_log existe et n'est pas vide, le workflow est en erreur if [ -s $error_log ]; then @@ -501,14 +502,14 @@ jobs: for dependency in $dependencies; do # If the dependency has been built in the same workflow, install it if [ -f $dependency*.deb ]; then - apt-get install -y $dependency*.deb 2>> $error_log || { echo "Error during installation of $package" >> $error_log; true; } + error_output=$(apt-get install -y $dependency*.deb 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of $dependency" >> $error_log; true; } fi done # Install package - apt-get install -y $package 2>> $error_log || { echo "Error during installation of $package" >> $error_log; true; } + error_output=$(apt-get install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of $package" >> $error_log; true; } # Uninstall package with all his dependencies # Package name is the name of the file less the version and the .deb extension, and without the "./" at the beginning - apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>> $error_log || true + error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of $package" >> $error_log; true; } done # Si le fichier error_log existe et n'est pas vide, le workflow est en erreur if [ -s $error_log ]; then From 15a78f8a80e29f23866eea44e800401a35809513 Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Tue, 10 Dec 2024 17:52:08 +0100 Subject: [PATCH 04/35] check all cpan libs --- .github/workflows/perl-cpan-libraries.yml | 35 ++++++++++++----------- .github/workflows/test-cpan-libraries.yml | 22 +++++++------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index db0fa20d89..dba8db5de8 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -6,17 +6,17 @@ concurrency: on: workflow_dispatch: -# pull_request: -# paths: -# - ".github/workflows/perl-cpan-libraries.yml" -# push: -# branches: -# - develop -# - dev-[2-9][0-9].[0-9][0-9].x -# - master -# - "[2-9][0-9].[0-9][0-9].x" -# paths: -# - ".github/workflows/perl-cpan-libraries.yml" + pull_request: + paths: + - ".github/workflows/perl-cpan-libraries.yml" + push: + branches: + - develop + - dev-[2-9][0-9].[0-9][0-9].x + - master + - "[2-9][0-9].[0-9][0-9].x" + paths: + - ".github/workflows/perl-cpan-libraries.yml" jobs: get-environment: @@ -575,6 +575,7 @@ jobs: # Add Centreon plugins repositories echo -e '[centreon-plugins-stable]\nname=centreon plugins stable x86_64\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/x86_64\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n[centreon-plugins-stable-noarch]\nname=centreon plugins stable noarch\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/noarch\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n' >> /etc/yum.repos.d/centreon-plugins.repo else + export DEBIAN_FRONTEND=noninteractive apt-get update apt-get install -y zstd perl wget gpg apt-utils # Add Centreon plugins repositories @@ -603,13 +604,13 @@ jobs: for dependency in $dependencies; do # If the dependency has been built in the same workflow, install it if [ -f $dependency*.rpm ]; then - dnf install -y $dependency*.rpm 2>> $error_log || { echo "Error during installation of $package" >> $error_log; true; } + error_output=$(dnf install -y $dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of $dependency" >> $error_log; true; } fi done # Install package - dnf install -y $package 2>> $error_log || { echo "Error during installation of $package" >> $error_log; true; } + error_output=$(dnf install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of $package" >> $error_log; true; } # Uninstall package with all his dependencies - dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>> $error_log || true + error_output=$(dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of $package" >> $error_log; true; } done # Si le fichier error_log existe et n'est pas vide, le workflow est en erreur if [ -s $error_log ]; then @@ -627,14 +628,14 @@ jobs: for dependency in $dependencies; do # If the dependency has been built in the same workflow, install it if [ -f $dependency*.deb ]; then - apt-get install -y $dependency*.deb 2>> $error_log || { echo "Error during installation of $package" >> $error_log; true; } + error_output=$(apt-get install -y $dependency*.deb 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of $dependency" >> $error_log; true; } fi done # Install package - apt-get install -y $package 2>> $error_log || { echo "Error during installation of $package" >> $error_log; true; } + error_output=$(apt-get install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of $package" >> $error_log; true; } # Uninstall package with all his dependencies # Package name is the name of the file less the version and the .deb extension, and without the "./" at the beginning - apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>> $error_log || true + error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of $package" >> $error_log; true; } done # Si le fichier error_log existe et n'est pas vide, le workflow est en erreur if [ -s $error_log ]; then diff --git a/.github/workflows/test-cpan-libraries.yml b/.github/workflows/test-cpan-libraries.yml index 9c42f975ed..c5260c5783 100644 --- a/.github/workflows/test-cpan-libraries.yml +++ b/.github/workflows/test-cpan-libraries.yml @@ -6,17 +6,17 @@ concurrency: on: workflow_dispatch: - pull_request: - paths: - - ".github/workflows/test-cpan-libraries.yml" - push: - branches: - - develop - - dev-[2-9][0-9].[0-9][0-9].x - - master - - "[2-9][0-9].[0-9][0-9].x" - paths: - - ".github/workflows/test-cpan-libraries.yml" +# pull_request: +# paths: +# - ".github/workflows/test-cpan-libraries.yml" +# push: +# branches: +# - develop +# - dev-[2-9][0-9].[0-9][0-9].x +# - master +# - "[2-9][0-9].[0-9][0-9].x" +# paths: +# - ".github/workflows/test-cpan-libraries.yml" jobs: get-environment: From e79796ed81854e48a32653c2f946df11d9362cb1 Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Wed, 11 Dec 2024 11:42:29 +0100 Subject: [PATCH 05/35] Check only deb packages with error --- .github/workflows/perl-cpan-libraries.yml | 30 ++++++------- .github/workflows/test-cpan-libraries.yml | 51 ++++++++++------------- 2 files changed, 37 insertions(+), 44 deletions(-) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index dba8db5de8..9da538a20d 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -6,17 +6,17 @@ concurrency: on: workflow_dispatch: - pull_request: - paths: - - ".github/workflows/perl-cpan-libraries.yml" - push: - branches: - - develop - - dev-[2-9][0-9].[0-9][0-9].x - - master - - "[2-9][0-9].[0-9][0-9].x" - paths: - - ".github/workflows/perl-cpan-libraries.yml" +# pull_request: +# paths: +# - ".github/workflows/perl-cpan-libraries.yml" +# push: +# branches: +# - develop +# - dev-[2-9][0-9].[0-9][0-9].x +# - master +# - "[2-9][0-9].[0-9][0-9].x" +# paths: +# - ".github/workflows/perl-cpan-libraries.yml" jobs: get-environment: @@ -112,6 +112,10 @@ jobs: rpm_provides: "perl(FFI::Platypus::Buffer) perl(FFI::Platypus::Memory)" rpm_dependencies: "perl(Capture::Tiny) perl(FFI::CheckLib) perl(File::Spec::Functions) perl(IPC::Cmd) perl(JSON::PP) perl(List::Util) perl(autodie) perl(constant) perl(parent)" no-auto-depends: true + - name: "Mojo::IOLoop::Signal" + rpm_dependencies: "perl-Mojolicious" + rpm_provides: "perl(Mojo::IOLoop::Signal)" + no-auto-depends: true - name: "Net::DHCP" rpm_provides: "perl(Net::DHCP::Constants) perl(Net::DHCP::Packet)" - name: "Net::SMTPS" @@ -131,10 +135,6 @@ jobs: - name: "ZMQ::LibZMQ4" version: "0.01" rpm_dependencies: "zeromq" - - name: "Mojo::IOLoop::Signal" - rpm_dependencies: "perl-Mojolicious" - rpm_provides: "perl(Mojo::IOLoop::Signal)" - no-auto-depends: true name: package ${{ matrix.distrib }} ${{ matrix.name }} diff --git a/.github/workflows/test-cpan-libraries.yml b/.github/workflows/test-cpan-libraries.yml index c5260c5783..60586e131a 100644 --- a/.github/workflows/test-cpan-libraries.yml +++ b/.github/workflows/test-cpan-libraries.yml @@ -6,17 +6,17 @@ concurrency: on: workflow_dispatch: -# pull_request: -# paths: -# - ".github/workflows/test-cpan-libraries.yml" -# push: -# branches: -# - develop -# - dev-[2-9][0-9].[0-9][0-9].x -# - master -# - "[2-9][0-9].[0-9][0-9].x" -# paths: -# - ".github/workflows/test-cpan-libraries.yml" + pull_request: + paths: + - ".github/workflows/test-cpan-libraries.yml" + push: + branches: + - develop + - dev-[2-9][0-9].[0-9][0-9].x + - master + - "[2-9][0-9].[0-9][0-9].x" + paths: + - ".github/workflows/test-cpan-libraries.yml" jobs: get-environment: @@ -33,10 +33,7 @@ jobs: distrib: [el8, el9] name: [ - "ARGV::Struct", - "BSON", - "FFI::Platypus", - "ZMQ::FFI" + "ARGV::Struct" ] include: - build_distribs: "el8,el9" @@ -44,21 +41,12 @@ jobs: - rpm_provides: "" - version: "" - spec_file: "" - - no-auto-depends: false - distrib: el8 package_extension: rpm image: packaging-plugins-alma8 - distrib: el9 package_extension: rpm image: packaging-plugins-alma9 - - name: "BSON" - rpm_provides: "perl(BSON::Bytes) perl(BSON::Code) perl(BSON::DBRef) perl(BSON::OID) perl(BSON::Raw) perl(BSON::Regex) perl(BSON::Time) perl(BSON::Timestamp) perl(BSON::Types) perl(BSON)" - - name: "FFI::Platypus" - rpm_provides: "perl(FFI::Platypus::Buffer) perl(FFI::Platypus::Memory)" - rpm_dependencies: "perl(Capture::Tiny) perl(FFI::CheckLib) perl(File::Spec::Functions) perl(IPC::Cmd) perl(JSON::PP) perl(List::Util) perl(autodie) perl(constant) perl(parent)" - no-auto-depends: true - - name: "ZMQ::FFI" - rpm_dependencies: "zeromq" name: package ${{ matrix.distrib }} ${{ matrix.name }} container: @@ -232,8 +220,10 @@ jobs: image: [packaging-plugins-bullseye, packaging-plugins-bookworm, packaging-plugins-jammy, packaging-plugins-bullseye-arm64] name: [ - "ARGV::Struct", - "Net::MQTT::Simple", + "Crypt::OpenSSL::AES", + "JMX::Jmx4Perl", + "Net::Amazon::Signature::V4", + "Paws", "ZMQ::LibZMQ4" ] include: @@ -245,7 +235,6 @@ jobs: - version: "" - use_dh_make_perl: "true" - spec_file: "" - - no-auto-depends: false - distrib: bullseye package_extension: deb image: packaging-plugins-bullseye @@ -260,8 +249,12 @@ jobs: image: packaging-plugins-bullseye-arm64 arch: arm64 runner_name: ["self-hosted", "collect-arm64"] - - name: "Net::MQTT::Simple" - version: "1.29" + - name: "Net::Amazon::Signature::V4" + build_distribs: ["bullseye", "jammy"] + - name: "Paws" + use_dh_make_perl: "false" + deb_dependencies: "libmoose-perl libmoosex-classattribute-perl libjson-maybexs-perl liburl-encode-perl libargv-struct-perl libmoo-perl libtype-tiny-perl libdatastruct-flat-perl libmodule-find-perl libthrowable-perl liburi-template-perl libnet-amazon-signature-v4-perl" + no-auto-depends: true - name: "ZMQ::LibZMQ4" use_dh_make_perl: "false" version: "0.01" From 750aefa5eb8d52bf8a431351a87fae4e560cd375 Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Wed, 11 Dec 2024 15:46:02 +0100 Subject: [PATCH 06/35] Fix to skip packages tested on the wrong architecture --- .github/workflows/test-cpan-libraries.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-cpan-libraries.yml b/.github/workflows/test-cpan-libraries.yml index 60586e131a..c8a85fcf52 100644 --- a/.github/workflows/test-cpan-libraries.yml +++ b/.github/workflows/test-cpan-libraries.yml @@ -490,6 +490,10 @@ jobs: run: | error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" for package in ./*.deb; do + # If the package name ends with amd64 or arm64, we only install it if the tested architecture is the same, otherwise we skip it + if [[ $package == *amd64.deb && ${{ matrix.arch }} != "amd64" ]] || [[ $package == *arm64.deb && ${{ matrix.arch }} != "arm64" ]]; then + continue + fi # List dependencies dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //') for dependency in $dependencies; do @@ -501,7 +505,6 @@ jobs: # Install package error_output=$(apt-get install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of $package" >> $error_log; true; } # Uninstall package with all his dependencies - # Package name is the name of the file less the version and the .deb extension, and without the "./" at the beginning error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of $package" >> $error_log; true; } done # Si le fichier error_log existe et n'est pas vide, le workflow est en erreur From a356514baa6fb369b78edebca9344bd50c4f1914 Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Wed, 11 Dec 2024 16:03:45 +0100 Subject: [PATCH 07/35] Keep only packages with error, and update error messages --- .github/workflows/test-cpan-libraries.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-cpan-libraries.yml b/.github/workflows/test-cpan-libraries.yml index c8a85fcf52..0bae50e7f8 100644 --- a/.github/workflows/test-cpan-libraries.yml +++ b/.github/workflows/test-cpan-libraries.yml @@ -220,11 +220,8 @@ jobs: image: [packaging-plugins-bullseye, packaging-plugins-bookworm, packaging-plugins-jammy, packaging-plugins-bullseye-arm64] name: [ - "Crypt::OpenSSL::AES", - "JMX::Jmx4Perl", "Net::Amazon::Signature::V4", - "Paws", - "ZMQ::LibZMQ4" + "Paws" ] include: - runner_name: ubuntu-24.04 @@ -471,13 +468,13 @@ jobs: for dependency in $dependencies; do # If the dependency has been built in the same workflow, install it if [ -f $dependency*.rpm ]; then - error_output=$(dnf install -y $dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of $dependency" >> $error_log; true; } + error_output=$(dnf install -y $dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } fi done # Install package - error_output=$(dnf install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of $package" >> $error_log; true; } + error_output=$(dnf install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } # Uninstall package with all his dependencies - error_output=$(dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of $package" >> $error_log; true; } + error_output=$(dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } done # Si le fichier error_log existe et n'est pas vide, le workflow est en erreur if [ -s $error_log ]; then @@ -499,13 +496,13 @@ jobs: for dependency in $dependencies; do # If the dependency has been built in the same workflow, install it if [ -f $dependency*.deb ]; then - error_output=$(apt-get install -y $dependency*.deb 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of $dependency" >> $error_log; true; } + error_output=$(apt-get install -y $dependency*.deb 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } fi done # Install package - error_output=$(apt-get install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of $package" >> $error_log; true; } + error_output=$(apt-get install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } # Uninstall package with all his dependencies - error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of $package" >> $error_log; true; } + error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } done # Si le fichier error_log existe et n'est pas vide, le workflow est en erreur if [ -s $error_log ]; then From 63f062b772d3d74c9f8e4b799d2cf1b8d58c577b Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Wed, 11 Dec 2024 16:07:50 +0100 Subject: [PATCH 08/35] fix action-lint --- .github/workflows/test-cpan-libraries.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test-cpan-libraries.yml b/.github/workflows/test-cpan-libraries.yml index 0bae50e7f8..3843d6ed39 100644 --- a/.github/workflows/test-cpan-libraries.yml +++ b/.github/workflows/test-cpan-libraries.yml @@ -41,6 +41,7 @@ jobs: - rpm_provides: "" - version: "" - spec_file: "" + - no-auto-depends: false - distrib: el8 package_extension: rpm image: packaging-plugins-alma8 @@ -252,10 +253,6 @@ jobs: use_dh_make_perl: "false" deb_dependencies: "libmoose-perl libmoosex-classattribute-perl libjson-maybexs-perl liburl-encode-perl libargv-struct-perl libmoo-perl libtype-tiny-perl libdatastruct-flat-perl libmodule-find-perl libthrowable-perl liburi-template-perl libnet-amazon-signature-v4-perl" no-auto-depends: true - - name: "ZMQ::LibZMQ4" - use_dh_make_perl: "false" - version: "0.01" - deb_dependencies: "libzmq5" name: package ${{ matrix.distrib }} ${{ matrix.arch }} ${{ matrix.name }} container: image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest From 990db7c82b2a146cc6daaa5eadee9348139829d1 Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Thu, 12 Dec 2024 16:30:45 +0100 Subject: [PATCH 09/35] update workflow + fix dependencies installation --- .github/workflows/perl-cpan-libraries.yml | 17 ++-- .github/workflows/test-cpan-libraries.yml | 101 ++++++++++------------ 2 files changed, 55 insertions(+), 63 deletions(-) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 9da538a20d..09190c7f6c 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -604,13 +604,13 @@ jobs: for dependency in $dependencies; do # If the dependency has been built in the same workflow, install it if [ -f $dependency*.rpm ]; then - error_output=$(dnf install -y $dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of $dependency" >> $error_log; true; } + error_output=$(dnf install -y $dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } fi done # Install package - error_output=$(dnf install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of $package" >> $error_log; true; } + error_output=$(dnf install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } # Uninstall package with all his dependencies - error_output=$(dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of $package" >> $error_log; true; } + error_output=$(dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } done # Si le fichier error_log existe et n'est pas vide, le workflow est en erreur if [ -s $error_log ]; then @@ -623,19 +623,22 @@ jobs: run: | error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" for package in ./*.deb; do + # If the package name ends with amd64 or arm64, we only install it if the tested architecture is the same, otherwise we skip it + if [[ $package == *amd64.deb && ${{ matrix.arch }} != "amd64" ]] || [[ $package == *arm64.deb && ${{ matrix.arch }} != "arm64" ]]; then + continue + fi # List dependencies dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //') for dependency in $dependencies; do # If the dependency has been built in the same workflow, install it if [ -f $dependency*.deb ]; then - error_output=$(apt-get install -y $dependency*.deb 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of $dependency" >> $error_log; true; } + error_output=$(apt-get install -y $dependency*.deb 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } fi done # Install package - error_output=$(apt-get install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of $package" >> $error_log; true; } + error_output=$(apt-get install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } # Uninstall package with all his dependencies - # Package name is the name of the file less the version and the .deb extension, and without the "./" at the beginning - error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of $package" >> $error_log; true; } + error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } done # Si le fichier error_log existe et n'est pas vide, le workflow est en erreur if [ -s $error_log ]; then diff --git a/.github/workflows/test-cpan-libraries.yml b/.github/workflows/test-cpan-libraries.yml index 3843d6ed39..44a1c25499 100644 --- a/.github/workflows/test-cpan-libraries.yml +++ b/.github/workflows/test-cpan-libraries.yml @@ -427,27 +427,29 @@ jobs: name: Test perl CPAN libs packages on ${{ matrix.package_extension }} ${{ matrix.distrib }} ${{ matrix.arch }} steps: - - name: Install zstd, perl and Centreon repositories + - if: ${{ matrix.package_extension == 'rpm' }} + name: Install zstd, perl and Centreon repositories + run: | + dnf install -y zstd perl epel-release 'dnf-command(config-manager)' + dnf config-manager --set-enabled powertools || true # alma 8 + dnf config-manager --set-enabled crb || true # alma 9 + # Add Centreon plugins repositories + echo -e '[centreon-plugins-stable]\nname=centreon plugins stable x86_64\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/x86_64\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n[centreon-plugins-stable-noarch]\nname=centreon plugins stable noarch\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/noarch\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n' >> /etc/yum.repos.d/centreon-plugins.repo + shell: bash + - if: ${{ matrix.package_extension == 'deb' }} + name: Install zstd, perl and Centreon repositories run: | - if [ "${{ matrix.package_extension }}" == "rpm" ]; then - dnf install -y zstd perl epel-release 'dnf-command(config-manager)' - dnf config-manager --set-enabled powertools || true # alma 8 - dnf config-manager --set-enabled crb || true # alma 9 - # Add Centreon plugins repositories - echo -e '[centreon-plugins-stable]\nname=centreon plugins stable x86_64\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/x86_64\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n[centreon-plugins-stable-noarch]\nname=centreon plugins stable noarch\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/noarch\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n' >> /etc/yum.repos.d/centreon-plugins.repo + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get install -y zstd perl wget gpg apt-utils + # Add Centreon plugins repositories + if [ "${{ matrix.distrib }}" == "jammy" ]; then + echo "deb https://packages.centreon.com/ubuntu-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list else - export DEBIAN_FRONTEND=noninteractive - apt-get update - apt-get install -y zstd perl wget gpg apt-utils - # Add Centreon plugins repositories - if [ "${{ matrix.distrib }}" == "jammy" ]; then - echo "deb https://packages.centreon.com/ubuntu-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list - else - echo "deb https://packages.centreon.com/apt-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list - fi - wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1 - apt-get update + echo "deb https://packages.centreon.com/apt-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list fi + wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1 + apt-get update shell: bash - name: Restore packages from cache uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 @@ -455,53 +457,40 @@ jobs: path: ./*.${{ matrix.package_extension }} key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} fail-on-cache-miss: true - - if: ${{ matrix.package_extension == 'rpm' }} - name: Install packages + - name: Install packages run: | error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" - for package in ./*.rpm; do - # List dependencies - dependencies=$(rpm -qpR $package) - for dependency in $dependencies; do - # If the dependency has been built in the same workflow, install it - if [ -f $dependency*.rpm ]; then - error_output=$(dnf install -y $dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } - fi - done - # Install package - error_output=$(dnf install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } - # Uninstall package with all his dependencies - error_output=$(dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } - done - # Si le fichier error_log existe et n'est pas vide, le workflow est en erreur - if [ -s $error_log ]; then - cat $error_log - exit 1 - fi - shell: bash - - if: ${{ matrix.package_extension == 'deb' }} - name: Install packages - run: | - error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" - for package in ./*.deb; do - # If the package name ends with amd64 or arm64, we only install it if the tested architecture is the same, otherwise we skip it - if [[ $package == *amd64.deb && ${{ matrix.arch }} != "amd64" ]] || [[ $package == *arm64.deb && ${{ matrix.arch }} != "arm64" ]]; then + for package in ./*.${{ matrix.package_extension }}; do + # If a debian package name ends with amd64 or arm64, we only install it if the tested architecture is the same, otherwise we skip it + if [[ ${{ matrix.package_extension }} == 'deb' && ($package == *amd64.deb && ${{ matrix.arch }} != "amd64" || $package == *arm64.deb && ${{ matrix.arch }} != "arm64") ]]; then continue fi # List dependencies - dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //') + if [ "${{ matrix.package_extension }}" == "rpm" ]; then + dependencies=$(rpm -qpR $package) + else + dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //') + fi for dependency in $dependencies; do - # If the dependency has been built in the same workflow, install it - if [ -f $dependency*.deb ]; then - error_output=$(apt-get install -y $dependency*.deb 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } + # If the dependency has been built in the same workflow, install it + if [ -f $dependency*.${{ matrix.package_extension }} ]; then + if [ "${{ matrix.package_extension }}" == "rpm" ]; then + error_output=$(dnf install -y ./$dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } + else + error_output=$(apt-get install -y ./$dependency*.deb 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } fi + fi done - # Install package - error_output=$(apt-get install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } - # Uninstall package with all his dependencies - error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } + # Install package, then uninstall it with all his dependencies + if [ "${{ matrix.package_extension }}" == "rpm" ]; then + error_output=$(dnf install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } + error_output=$(dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } + else + error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } + error_output=$(apt-get install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } + fi done - # Si le fichier error_log existe et n'est pas vide, le workflow est en erreur + # If the file error_log exists and is not empty, the workflow is in error if [ -s $error_log ]; then cat $error_log exit 1 From d5e5146bfa27dc0c3d4277fe0e925631ad50b2ee Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Thu, 12 Dec 2024 16:57:38 +0100 Subject: [PATCH 10/35] test all cpan libs --- .github/workflows/perl-cpan-libraries.yml | 123 +++-- .github/workflows/test-cpan-libraries.yml | 542 ---------------------- 2 files changed, 56 insertions(+), 609 deletions(-) delete mode 100644 .github/workflows/test-cpan-libraries.yml diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 09190c7f6c..dc171c92da 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -6,17 +6,17 @@ concurrency: on: workflow_dispatch: -# pull_request: -# paths: -# - ".github/workflows/perl-cpan-libraries.yml" -# push: -# branches: -# - develop -# - dev-[2-9][0-9].[0-9][0-9].x -# - master -# - "[2-9][0-9].[0-9][0-9].x" -# paths: -# - ".github/workflows/perl-cpan-libraries.yml" + pull_request: + paths: + - ".github/workflows/perl-cpan-libraries.yml" + push: + branches: + - develop + - dev-[2-9][0-9].[0-9][0-9].x + - master + - "[2-9][0-9].[0-9][0-9].x" + paths: + - ".github/workflows/perl-cpan-libraries.yml" jobs: get-environment: @@ -566,27 +566,29 @@ jobs: name: Test perl CPAN libs packages on ${{ matrix.package_extension }} ${{ matrix.distrib }} ${{ matrix.arch }} steps: - - name: Install zstd, perl and Centreon repositories + - if: ${{ matrix.package_extension == 'rpm' }} + name: Install zstd, perl and Centreon repositories + run: | + dnf install -y zstd perl epel-release 'dnf-command(config-manager)' + dnf config-manager --set-enabled powertools || true # alma 8 + dnf config-manager --set-enabled crb || true # alma 9 + # Add Centreon plugins repositories + echo -e '[centreon-plugins-stable]\nname=centreon plugins stable x86_64\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/x86_64\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n[centreon-plugins-stable-noarch]\nname=centreon plugins stable noarch\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/noarch\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n' >> /etc/yum.repos.d/centreon-plugins.repo + shell: bash + - if: ${{ matrix.package_extension == 'deb' }} + name: Install zstd, perl and Centreon repositories run: | - if [ "${{ matrix.package_extension }}" == "rpm" ]; then - dnf install -y zstd perl epel-release 'dnf-command(config-manager)' - dnf config-manager --set-enabled powertools || true # alma 8 - dnf config-manager --set-enabled crb || true # alma 9 - # Add Centreon plugins repositories - echo -e '[centreon-plugins-stable]\nname=centreon plugins stable x86_64\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/x86_64\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n[centreon-plugins-stable-noarch]\nname=centreon plugins stable noarch\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/noarch\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n' >> /etc/yum.repos.d/centreon-plugins.repo + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get install -y zstd perl wget gpg apt-utils + # Add Centreon plugins repositories + if [ "${{ matrix.distrib }}" == "jammy" ]; then + echo "deb https://packages.centreon.com/ubuntu-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list else - export DEBIAN_FRONTEND=noninteractive - apt-get update - apt-get install -y zstd perl wget gpg apt-utils - # Add Centreon plugins repositories - if [ "${{ matrix.distrib }}" == "jammy" ]; then - echo "deb https://packages.centreon.com/ubuntu-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list - else - echo "deb https://packages.centreon.com/apt-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list - fi - wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1 - apt-get update + echo "deb https://packages.centreon.com/apt-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list fi + wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1 + apt-get update shell: bash - name: Restore packages from cache uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 @@ -594,53 +596,40 @@ jobs: path: ./*.${{ matrix.package_extension }} key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} fail-on-cache-miss: true - - if: ${{ matrix.package_extension == 'rpm' }} - name: Install packages + - name: Install packages run: | error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" - for package in ./*.rpm; do - # List dependencies - dependencies=$(rpm -qpR $package) - for dependency in $dependencies; do - # If the dependency has been built in the same workflow, install it - if [ -f $dependency*.rpm ]; then - error_output=$(dnf install -y $dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } - fi - done - # Install package - error_output=$(dnf install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } - # Uninstall package with all his dependencies - error_output=$(dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } - done - # Si le fichier error_log existe et n'est pas vide, le workflow est en erreur - if [ -s $error_log ]; then - cat $error_log - exit 1 - fi - shell: bash - - if: ${{ matrix.package_extension == 'deb' }} - name: Install packages - run: | - error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" - for package in ./*.deb; do - # If the package name ends with amd64 or arm64, we only install it if the tested architecture is the same, otherwise we skip it - if [[ $package == *amd64.deb && ${{ matrix.arch }} != "amd64" ]] || [[ $package == *arm64.deb && ${{ matrix.arch }} != "arm64" ]]; then + for package in ./*.${{ matrix.package_extension }}; do + # If a debian package name ends with amd64 or arm64, we only install it if the tested architecture is the same, otherwise we skip it + if [[ ${{ matrix.package_extension }} == 'deb' && ($package == *amd64.deb && ${{ matrix.arch }} != "amd64" || $package == *arm64.deb && ${{ matrix.arch }} != "arm64") ]]; then continue fi # List dependencies - dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //') + if [ "${{ matrix.package_extension }}" == "rpm" ]; then + dependencies=$(rpm -qpR $package) + else + dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //') + fi for dependency in $dependencies; do - # If the dependency has been built in the same workflow, install it - if [ -f $dependency*.deb ]; then - error_output=$(apt-get install -y $dependency*.deb 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } + # If the dependency has been built in the same workflow, install it + if [ -f $dependency*.${{ matrix.package_extension }} ]; then + if [ "${{ matrix.package_extension }}" == "rpm" ]; then + error_output=$(dnf install -y ./$dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } + else + error_output=$(apt-get install -y ./$dependency*.deb 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } fi + fi done - # Install package - error_output=$(apt-get install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } - # Uninstall package with all his dependencies - error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } + # Install package, then uninstall it with all his dependencies + if [ "${{ matrix.package_extension }}" == "rpm" ]; then + error_output=$(dnf install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } + error_output=$(dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } + else + error_output=$(apt-get install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } + error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } + fi done - # Si le fichier error_log existe et n'est pas vide, le workflow est en erreur + # If the file error_log exists and is not empty, the workflow is in error if [ -s $error_log ]; then cat $error_log exit 1 diff --git a/.github/workflows/test-cpan-libraries.yml b/.github/workflows/test-cpan-libraries.yml deleted file mode 100644 index 44a1c25499..0000000000 --- a/.github/workflows/test-cpan-libraries.yml +++ /dev/null @@ -1,542 +0,0 @@ -name: test-perl-cpan-libraries - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -on: - workflow_dispatch: - pull_request: - paths: - - ".github/workflows/test-cpan-libraries.yml" - push: - branches: - - develop - - dev-[2-9][0-9].[0-9][0-9].x - - master - - "[2-9][0-9].[0-9][0-9].x" - paths: - - ".github/workflows/test-cpan-libraries.yml" - -jobs: - get-environment: - uses: ./.github/workflows/get-environment.yml - - package-rpm: - needs: [get-environment] - if: ${{ needs.get-environment.outputs.stability != 'stable' }} - - runs-on: ubuntu-24.04 - strategy: - fail-fast: false - matrix: - distrib: [el8, el9] - name: - [ - "ARGV::Struct" - ] - include: - - build_distribs: "el8,el9" - - rpm_dependencies: "" - - rpm_provides: "" - - version: "" - - spec_file: "" - - no-auto-depends: false - - distrib: el8 - package_extension: rpm - image: packaging-plugins-alma8 - - distrib: el9 - package_extension: rpm - image: packaging-plugins-alma9 - - name: package ${{ matrix.distrib }} ${{ matrix.name }} - container: - image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest - credentials: - username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }} - password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }} - - steps: - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} - run: | - yum install -y yum-utils epel-release git - yum config-manager --set-enabled crb || true # alma 9 - yum config-manager --set-enabled powertools || true # alma 8 - yum install -y cpanminus rpm-build libcurl-devel libssh-devel expat-devel gcc libuuid-devel zeromq-devel libxml2-devel libffi-devel perl-DBI perl-Net-Pcap freetds freetds-devel perl-Module-Build-Tiny - - dnf module reset -y ruby - dnf module enable -y ruby:3.1 - dnf install -y ruby ruby-devel - shell: bash - - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - repository: kduret/fpm - ref: fix-rpm-perl-dependency-name-unchanged - path: fpm - - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} - name: Build and install fpm # waiting https://github.com/jordansissel/fpm/pull/2066 - run: | - dnf install -y bsdtar - cd fpm - gem install bundler - bundle install - make install - shell: bash - - - if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file == '' }} - run: | - if [ -z "${{ matrix.version }}" ]; then - PACKAGE_VERSION="" - else - PACKAGE_VERSION=" -v ${{ matrix.version }}" - fi - - if [ -z "${{ matrix.rpm_dependencies }}" ]; then - PACKAGE_DEPENDENCIES="" - else - for PACKAGE_DEPENDENCY in `echo "${{ matrix.rpm_dependencies }}"`; do - PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --depends "$PACKAGE_DEPENDENCY"" - done - fi - - if [ ! -z "${{ matrix.no-auto-depends }}" ]; then - PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --no-auto-depends" - fi - - if [ -z "${{ matrix.rpm_provides }}" ]; then - PACKAGE_PROVIDES="" - else - for PACKAGE_PROVIDE in `echo "${{ matrix.rpm_provides }}"`; do - PACKAGE_PROVIDES="$PACKAGE_PROVIDES --provides $PACKAGE_PROVIDE" - done - fi - - cpanm Module::Build::Tiny - cpanm Module::Install - - export SYBASE="/usr" - - fpm -s cpan -t ${{ matrix.package_extension }} --rpm-dist ${{ matrix.distrib }} --verbose --cpan-verbose --no-cpan-test$PACKAGE_DEPENDENCIES$PACKAGE_PROVIDES$PACKAGE_VERSION ${{ matrix.name }} - shell: bash - - - if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file != '' }} - run: | - mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} - - rpmbuild --undefine=_disable_source_fetch -ba ${{ matrix.spec_file }} - - cp -r ~/rpmbuild/RPMS/noarch/*.rpm . - shell: bash - - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} - name: Replace '::' with - in the feature path - id: package-name - run: | - name="${{ matrix.name }}" - name_with_dash="${name//::/-}" - echo "Modified Name: $name_with_dash" - echo "name_with_dash=$name_with_dash" >> $GITHUB_OUTPUT - shell: bash - - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: packages-${{ matrix.package_extension }}-${{ matrix.distrib }}-${{ steps.package-name.outputs.name_with_dash }} - path: ./*.${{ matrix.package_extension }} - retention-days: 1 - - merge-package-rpm-artifacts: - needs: [package-rpm] - runs-on: ubuntu-24.04 - strategy: - matrix: - distrib: [el8, el9] - - steps: - - name: Merge Artifacts - uses: actions/upload-artifact/merge@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: packages-rpm-${{ matrix.distrib }} - pattern: packages-rpm-${{ matrix.distrib }}-* - delete-merged: false # cannot be set to true due to random fails: Failed to DeleteArtifact: Unable to make request: ECONNRESET - retention-days: 1 - - - name: Delete merged artifacts - uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5.1.0 - with: - name: packages-rpm-${{ matrix.distrib }}-* - failOnError: false - - sign-rpm: - needs: [merge-package-rpm-artifacts] - - runs-on: ubuntu-24.04 - strategy: - matrix: - distrib: [el8, el9] - name: sign rpm ${{ matrix.distrib }} - container: - image: docker.centreon.com/centreon-private/rpm-signing:latest - options: -t - credentials: - username: ${{ secrets.HARBOR_RPM_GPG_SIGNING_REPO_USERNAME }} - password: ${{ secrets.HARBOR_RPM_GPG_SIGNING_REPO_TOKEN }} - - steps: - - run: apt-get install -y zstd - shell: bash - - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: packages-rpm-${{ matrix.distrib }} - path: ./ - - - run: echo "HOME=/root" >> $GITHUB_ENV - shell: bash - - - run: rpmsign --addsign ./*.rpm - shell: bash - - - uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 - with: - path: ./*.rpm - key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }} - - package-deb: - needs: [get-environment] - if: ${{ needs.get-environment.outputs.stability != 'stable' }} - - runs-on: ${{ matrix.runner_name }} - strategy: - fail-fast: false - matrix: - image: [packaging-plugins-bullseye, packaging-plugins-bookworm, packaging-plugins-jammy, packaging-plugins-bullseye-arm64] - name: - [ - "Net::Amazon::Signature::V4", - "Paws" - ] - include: - - runner_name: ubuntu-24.04 - - arch: amd64 - - build_distribs: "bullseye,bookworm,jammy" - - deb_dependencies: "" - - rpm_provides: "" - - version: "" - - use_dh_make_perl: "true" - - spec_file: "" - - distrib: bullseye - package_extension: deb - image: packaging-plugins-bullseye - - distrib: bookworm - package_extension: deb - image: packaging-plugins-bookworm - - distrib: jammy - package_extension: deb - image: packaging-plugins-jammy - - distrib: bullseye - package_extension: deb - image: packaging-plugins-bullseye-arm64 - arch: arm64 - runner_name: ["self-hosted", "collect-arm64"] - - name: "Net::Amazon::Signature::V4" - build_distribs: ["bullseye", "jammy"] - - name: "Paws" - use_dh_make_perl: "false" - deb_dependencies: "libmoose-perl libmoosex-classattribute-perl libjson-maybexs-perl liburl-encode-perl libargv-struct-perl libmoo-perl libtype-tiny-perl libdatastruct-flat-perl libmodule-find-perl libthrowable-perl liburi-template-perl libnet-amazon-signature-v4-perl" - no-auto-depends: true - name: package ${{ matrix.distrib }} ${{ matrix.arch }} ${{ matrix.name }} - container: - image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest - credentials: - username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }} - password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }} - - steps: - - 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 - run: | - apt-get update - apt-get install -y cpanminus - - if [ -z "${{ matrix.version }}" ]; then - CPAN_PACKAGE_VERSION=$(cpanm --info ${{ matrix.name }} | sed 's/\.tar\.gz$//' | sed 's/.*\-//' | sed 's/v//') - - if [[ ! $CPAN_PACKAGE_VERSION =~ ^[0-9]+\.[0-9]+ ]]; then - echo "::error::Invalid version number: ${CPAN_PACKAGE_VERSION}" - exit 1 - fi - - PACKAGE_VERSION="${CPAN_PACKAGE_VERSION}" - else - PACKAGE_VERSION="${{ matrix.version }}" - fi - - echo "package_version=$(echo $PACKAGE_VERSION)" >> $GITHUB_OUTPUT - shell: bash - - - if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.use_dh_make_perl == 'false' }} - run: | - apt-get install -y ruby libcurl4-openssl-dev libssh-dev uuid-dev libczmq-dev - - if [ -z "${{ matrix.deb_dependencies }}" ]; then - PACKAGE_DEPENDENCIES="" - else - for PACKAGE_DEPENDENCY in `echo ${{ matrix.deb_dependencies }}`; do - PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --depends $PACKAGE_DEPENDENCY" - done - fi - - if [ ! -z "${{ matrix.no-auto-depends }}" ]; then - PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --no-auto-depends" - fi - - cpanm Module::Build::Tiny - cpanm Module::Install - - 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 ${{ 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' }} - run: | - 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 }}${{ 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) }} - name: Replace '::' with - in the feature path - id: package-name - run: | - name="${{ matrix.name }}" - name_with_dash="${name//::/-}" - echo "Modified Name: $name_with_dash" - echo "name_with_dash=$name_with_dash" >> $GITHUB_OUTPUT - shell: bash - - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: packages-${{ matrix.package_extension }}-${{ matrix.distrib }}-${{ matrix.arch }}-${{ steps.package-name.outputs.name_with_dash}} - path: ./*.${{ matrix.package_extension }} - retention-days: 1 - - merge-package-deb-artifacts: - needs: [package-deb] - runs-on: ubuntu-24.04 - strategy: - matrix: - distrib: [bullseye, bookworm, jammy] - - steps: - - name: Merge Artifacts - uses: actions/upload-artifact/merge@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: packages-deb-${{ matrix.distrib }} - pattern: packages-deb-${{ matrix.distrib }}-* - delete-merged: false # cannot be set to true due to random fails: Failed to DeleteArtifact: Unable to make request: ECONNRESET - retention-days: 1 - - - name: Delete merged artifacts - uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5.1.0 - with: - name: packages-deb-${{ matrix.distrib }}-* - failOnError: false - - download-and-cache-deb: - needs: [merge-package-deb-artifacts] - runs-on: ubuntu-24.04 - strategy: - matrix: - distrib: [bullseye, bookworm, jammy] - steps: - - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: packages-deb-${{ matrix.distrib }} - path: ./ - - - uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 - with: - path: ./*.deb - key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.distrib }} - - test-packages: - needs: [get-environment, sign-rpm, download-and-cache-deb] - strategy: - fail-fast: false - matrix: - include: - - package_extension: rpm - image: almalinux:8 - distrib: el8 - arch: amd64 - runner_name: ubuntu-24.04 - - package_extension: rpm - image: almalinux:9 - distrib: el9 - arch: amd64 - runner_name: ubuntu-24.04 - - package_extension: deb - image: debian:bullseye - distrib: bullseye - arch: amd64 - runner_name: ubuntu-24.04 - - package_extension: deb - image: debian:bookworm - distrib: bookworm - arch: amd64 - runner_name: ubuntu-24.04 - - package_extension: deb - image: ubuntu:jammy - distrib: jammy - arch: amd64 - runner_name: ubuntu-24.04 - - package_extension: deb - image: arm64v8/debian:bullseye - distrib: bullseye - arch: arm64 - runner_name: ["self-hosted", "collect-arm64"] - - runs-on: ${{ matrix.runner_name }} - container: - image: ${{ matrix.image }} - - name: Test perl CPAN libs packages on ${{ matrix.package_extension }} ${{ matrix.distrib }} ${{ matrix.arch }} - steps: - - if: ${{ matrix.package_extension == 'rpm' }} - name: Install zstd, perl and Centreon repositories - run: | - dnf install -y zstd perl epel-release 'dnf-command(config-manager)' - dnf config-manager --set-enabled powertools || true # alma 8 - dnf config-manager --set-enabled crb || true # alma 9 - # Add Centreon plugins repositories - echo -e '[centreon-plugins-stable]\nname=centreon plugins stable x86_64\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/x86_64\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n[centreon-plugins-stable-noarch]\nname=centreon plugins stable noarch\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/noarch\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n' >> /etc/yum.repos.d/centreon-plugins.repo - shell: bash - - if: ${{ matrix.package_extension == 'deb' }} - name: Install zstd, perl and Centreon repositories - run: | - export DEBIAN_FRONTEND=noninteractive - apt-get update - apt-get install -y zstd perl wget gpg apt-utils - # Add Centreon plugins repositories - if [ "${{ matrix.distrib }}" == "jammy" ]; then - echo "deb https://packages.centreon.com/ubuntu-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list - else - echo "deb https://packages.centreon.com/apt-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list - fi - wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1 - apt-get update - shell: bash - - name: Restore packages from cache - uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 - with: - path: ./*.${{ matrix.package_extension }} - key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} - fail-on-cache-miss: true - - name: Install packages - run: | - error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" - for package in ./*.${{ matrix.package_extension }}; do - # If a debian package name ends with amd64 or arm64, we only install it if the tested architecture is the same, otherwise we skip it - if [[ ${{ matrix.package_extension }} == 'deb' && ($package == *amd64.deb && ${{ matrix.arch }} != "amd64" || $package == *arm64.deb && ${{ matrix.arch }} != "arm64") ]]; then - continue - fi - # List dependencies - if [ "${{ matrix.package_extension }}" == "rpm" ]; then - dependencies=$(rpm -qpR $package) - else - dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //') - fi - for dependency in $dependencies; do - # If the dependency has been built in the same workflow, install it - if [ -f $dependency*.${{ matrix.package_extension }} ]; then - if [ "${{ matrix.package_extension }}" == "rpm" ]; then - error_output=$(dnf install -y ./$dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } - else - error_output=$(apt-get install -y ./$dependency*.deb 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } - fi - fi - done - # Install package, then uninstall it with all his dependencies - if [ "${{ matrix.package_extension }}" == "rpm" ]; then - error_output=$(dnf install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } - error_output=$(dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } - else - error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } - error_output=$(apt-get install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } - fi - done - # If the file error_log exists and is not empty, the workflow is in error - if [ -s $error_log ]; then - cat $error_log - exit 1 - fi - shell: bash - - name: Upload error log - if: failure() - uses: actions/upload-artifact@v4 - with: - name: install_error_log_${{ matrix.distrib }}-${{ matrix.arch }} - path: install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log - - deliver-packages: - needs: [get-environment, sign-rpm, download-and-cache-deb, test-packages] - if: | - (contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) || ( needs.get-environment.outputs.stability == 'stable' && github.event_name != 'workflow_dispatch')) && - ! cancelled() && - ! contains(needs.*.result, 'failure') && - ! contains(needs.*.result, 'cancelled') - runs-on: ubuntu-24.04 - strategy: - fail-fast: false - matrix: - include: - - distrib: el8 - package_extension: rpm - - distrib: el9 - package_extension: rpm - - distrib: bullseye - package_extension: deb - - distrib: bookworm - package_extension: deb - - distrib: jammy - package_extension: deb - - name: deliver ${{ matrix.distrib }} - steps: - - name: Checkout sources - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Delivery - uses: ./.github/actions/package-delivery - with: - module_name: perl-cpan-libraries - distrib: ${{ matrix.distrib }} - cache_key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} - stability: ${{ needs.get-environment.outputs.stability }} - release_type: ${{ needs.get-environment.outputs.release_type }} - artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} From b3d8eeec7bc8f7dc2c355b2640c161e06788e654 Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Fri, 13 Dec 2024 09:35:22 +0100 Subject: [PATCH 11/35] Add installation informations in the CI --- .github/workflows/perl-cpan-libraries.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index dc171c92da..6ee7aabc98 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -600,6 +600,7 @@ jobs: run: | error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" for package in ./*.${{ matrix.package_extension }}; do + echo "Installing package: $package" # If a debian package name ends with amd64 or arm64, we only install it if the tested architecture is the same, otherwise we skip it if [[ ${{ matrix.package_extension }} == 'deb' && ($package == *amd64.deb && ${{ matrix.arch }} != "amd64" || $package == *arm64.deb && ${{ matrix.arch }} != "arm64") ]]; then continue @@ -611,8 +612,10 @@ jobs: dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //') fi for dependency in $dependencies; do + echo "Check dependency: $dependency" # If the dependency has been built in the same workflow, install it if [ -f $dependency*.${{ matrix.package_extension }} ]; then + echo "Installing dependency: $dependency" if [ "${{ matrix.package_extension }}" == "rpm" ]; then error_output=$(dnf install -y ./$dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } else From fece55b31b22d688e6e50825dfe3a4fbab3da8f0 Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Fri, 13 Dec 2024 10:21:26 +0100 Subject: [PATCH 12/35] filter dependencies --- .github/workflows/perl-cpan-libraries.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 6ee7aabc98..caa18ca9c5 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -600,11 +600,11 @@ jobs: run: | error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" for package in ./*.${{ matrix.package_extension }}; do - echo "Installing package: $package" # If a debian package name ends with amd64 or arm64, we only install it if the tested architecture is the same, otherwise we skip it if [[ ${{ matrix.package_extension }} == 'deb' && ($package == *amd64.deb && ${{ matrix.arch }} != "amd64" || $package == *arm64.deb && ${{ matrix.arch }} != "arm64") ]]; then continue fi + echo "Installing package: $package" # List dependencies if [ "${{ matrix.package_extension }}" == "rpm" ]; then dependencies=$(rpm -qpR $package) @@ -612,9 +612,14 @@ jobs: dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //') fi for dependency in $dependencies; do + if [ "${{ matrix.package_extension }}" == "rpm" ] && [[ $dependency != perl* ]]; then + continue + elif [ "${{ matrix.package_extension }}" == "deb" ] && [[ $dependency != lib*-perl ]]; then + continue + fi echo "Check dependency: $dependency" # If the dependency has been built in the same workflow, install it - if [ -f $dependency*.${{ matrix.package_extension }} ]; then + if [ -f ./$dependency*.${{ matrix.package_extension }} ]; then echo "Installing dependency: $dependency" if [ "${{ matrix.package_extension }}" == "rpm" ]; then error_output=$(dnf install -y ./$dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } From bdb03e5b18dbf1459f70801e293961dac3f5b26d Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Fri, 13 Dec 2024 11:21:35 +0100 Subject: [PATCH 13/35] fix for rpm dependencies --- .github/workflows/perl-cpan-libraries.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index caa18ca9c5..865c43648d 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -612,8 +612,14 @@ jobs: dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //') fi for dependency in $dependencies; do - if [ "${{ matrix.package_extension }}" == "rpm" ] && [[ $dependency != perl* ]]; then + # Skip non-perl dependencies + if [ "${{ matrix.package_extension }}" == "rpm" ]; then + if [[ $dependency != perl* ]]; then continue + else + # Update the dependency name to match the package name + dependency=$(echo $dependency | sed 's/(/-/g' | sed 's/)/-/g' | sed 's/::/-/g') + fi elif [ "${{ matrix.package_extension }}" == "deb" ] && [[ $dependency != lib*-perl ]]; then continue fi From cbd507cfb6065c7b9a703a5fdd01646b6778bc23 Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Fri, 13 Dec 2024 12:04:53 +0100 Subject: [PATCH 14/35] update --- .github/workflows/perl-cpan-libraries.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 865c43648d..1696ba6118 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -617,15 +617,17 @@ jobs: if [[ $dependency != perl* ]]; then continue else - # Update the dependency name to match the package name - dependency=$(echo $dependency | sed 's/(/-/g' | sed 's/)/-/g' | sed 's/::/-/g') + echo "Check dependency: $dependency" + # Update the dependency name to match the package name + dependency=$(echo $dependency | sed 's/(/-/g' | sed 's/)//g' | sed 's/::/-/g') fi - elif [ "${{ matrix.package_extension }}" == "deb" ] && [[ $dependency != lib*-perl ]]; then + elif [[ "${{ matrix.package_extension }}" == "deb" && $dependency != lib*-perl ]]; then continue + else + echo "Check dependency: $dependency" fi - echo "Check dependency: $dependency" # If the dependency has been built in the same workflow, install it - if [ -f ./$dependency*.${{ matrix.package_extension }} ]; then + if [[ -f ./$dependency*.${{ matrix.package_extension }} ]]; then echo "Installing dependency: $dependency" if [ "${{ matrix.package_extension }}" == "rpm" ]; then error_output=$(dnf install -y ./$dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } @@ -644,7 +646,7 @@ jobs: fi done # If the file error_log exists and is not empty, the workflow is in error - if [ -s $error_log ]; then + if [[ -s $error_log ]]; then cat $error_log exit 1 fi From f8b0ff9fb828cc12c7704cc4a45f15f6561d577f Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Fri, 13 Dec 2024 15:09:03 +0100 Subject: [PATCH 15/35] fix dependencies installation --- .github/workflows/perl-cpan-libraries.yml | 99 ++++-- .github/workflows/test-cpan-libraries.yml | 404 ++++++++++++++++++++++ 2 files changed, 465 insertions(+), 38 deletions(-) create mode 100644 .github/workflows/test-cpan-libraries.yml diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 1696ba6118..b73f033556 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -92,6 +92,7 @@ jobs: - rpm_provides: "" - version: "" - spec_file: "" + - no-auto-depends: false - distrib: el8 package_extension: rpm image: packaging-plugins-alma8 @@ -136,7 +137,6 @@ jobs: version: "0.01" rpm_dependencies: "zeromq" - name: package ${{ matrix.distrib }} ${{ matrix.name }} container: image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest @@ -572,8 +572,12 @@ jobs: dnf install -y zstd perl epel-release 'dnf-command(config-manager)' dnf config-manager --set-enabled powertools || true # alma 8 dnf config-manager --set-enabled crb || true # alma 9 + # Import Centreon GPG key + GPG_KEY_URL="https://yum-gpg.centreon.com/RPM-GPG-KEY-CES" + curl -sSL $GPG_KEY_URL -o RPM-GPG-KEY-CES + rpm --import RPM-GPG-KEY-CES # Add Centreon plugins repositories - echo -e '[centreon-plugins-stable]\nname=centreon plugins stable x86_64\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/x86_64\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n[centreon-plugins-stable-noarch]\nname=centreon plugins stable noarch\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/noarch\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n' >> /etc/yum.repos.d/centreon-plugins.repo + # echo -e '[centreon-plugins-stable]\nname=centreon plugins stable x86_64\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/x86_64\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n[centreon-plugins-stable-noarch]\nname=centreon plugins stable noarch\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/noarch\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n' >> /etc/yum.repos.d/centreon-plugins.repo shell: bash - if: ${{ matrix.package_extension == 'deb' }} name: Install zstd, perl and Centreon repositories @@ -582,11 +586,11 @@ jobs: apt-get update apt-get install -y zstd perl wget gpg apt-utils # Add Centreon plugins repositories - if [ "${{ matrix.distrib }}" == "jammy" ]; then - echo "deb https://packages.centreon.com/ubuntu-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list - else - echo "deb https://packages.centreon.com/apt-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list - fi + # if [ "${{ matrix.distrib }}" == "jammy" ]; then + # echo "deb https://packages.centreon.com/ubuntu-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list + # else + # echo "deb https://packages.centreon.com/apt-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list + # fi wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1 apt-get update shell: bash @@ -596,54 +600,73 @@ jobs: path: ./*.${{ matrix.package_extension }} key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} fail-on-cache-miss: true - - name: Install packages + - if: ${{ matrix.package_extension == 'rpm' }} + name: Install packages run: | error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" for package in ./*.${{ matrix.package_extension }}; do - # If a debian package name ends with amd64 or arm64, we only install it if the tested architecture is the same, otherwise we skip it + echo "Installing package: $package" + # List dependencies, and remove version and comparison operators + dependencies=$(rpm -qpR $package | sed 's/ [0-9.-]*\(\s\|$\)/ /g' | sed 's/ [<>!=]*\(\s\|$\)/ /g') + for dependency in $dependencies; do + # Skip non-perl dependencies + if [[ $dependency != perl* ]]; then + continue + else + echo "Check dependency: $dependency" + # Update the dependency name to match the package name + dependency=$(echo $dependency | sed 's/(/-/g' | sed 's/)//g' | sed 's/::/-/g') + fi + # If the dependency has been built in the same workflow, install it + if [[ -n $(find . -maxdepth 1 -regex "\.\/$dependency-[0-9v].*\.${{ matrix.package_extension }}") ]]; then + echo "Installing dependency: $dependency" + error_output=$(dnf install -y ./$dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } + fi + done + # Install package, then uninstall it with all his dependencies + echo "Package installation..." + error_output=$(dnf install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } + echo "Package installation done." + echo "Package uninstallation..." + error_output=$(dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } + echo "Package uninstallation done." + done + # If the file error_log exists and is not empty, the workflow is in error + if [[ -s $error_log ]]; then + cat $error_log + exit 1 + fi + shell: bash + - if: ${{ matrix.package_extension == 'deb' }} + name: Install packages + run: | + error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" + for package in ./*.${{ matrix.package_extension }}; do + # If the debian package name ends with amd64 or arm64, we only install it if the tested architecture is the same, otherwise we skip it if [[ ${{ matrix.package_extension }} == 'deb' && ($package == *amd64.deb && ${{ matrix.arch }} != "amd64" || $package == *arm64.deb && ${{ matrix.arch }} != "arm64") ]]; then continue fi echo "Installing package: $package" # List dependencies - if [ "${{ matrix.package_extension }}" == "rpm" ]; then - dependencies=$(rpm -qpR $package) - else - dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //') - fi + dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //' | sed 's/,//g') for dependency in $dependencies; do # Skip non-perl dependencies - if [ "${{ matrix.package_extension }}" == "rpm" ]; then - if [[ $dependency != perl* ]]; then - continue - else - echo "Check dependency: $dependency" - # Update the dependency name to match the package name - dependency=$(echo $dependency | sed 's/(/-/g' | sed 's/)//g' | sed 's/::/-/g') - fi - elif [[ "${{ matrix.package_extension }}" == "deb" && $dependency != lib*-perl ]]; then + if [[ $dependency != lib*-perl ]]; then continue - else - echo "Check dependency: $dependency" fi # If the dependency has been built in the same workflow, install it - if [[ -f ./$dependency*.${{ matrix.package_extension }} ]]; then + if [[ -n $(find . -maxdepth 1 -regex "\.\/lib.*-perl[-_][0-9].*all\.${{ matrix.package_extension }}" -o -regex "\.\/lib.*-perl[-_][0-9].*${{ matrix.arch }}\.${{ matrix.package_extension }}") ]]; then echo "Installing dependency: $dependency" - if [ "${{ matrix.package_extension }}" == "rpm" ]; then - error_output=$(dnf install -y ./$dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } - else - error_output=$(apt-get install -y ./$dependency*.deb 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } - fi + error_output=$(apt-get install -y ./$dependency*.deb 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } fi done # Install package, then uninstall it with all his dependencies - if [ "${{ matrix.package_extension }}" == "rpm" ]; then - error_output=$(dnf install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } - error_output=$(dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } - else - error_output=$(apt-get install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } - error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } - fi + echo "Package installation..." + error_output=$(apt-get install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } + echo "Package installation done." + echo "Package uninstallation..." + error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } + echo "Package uninstallation done." done # If the file error_log exists and is not empty, the workflow is in error if [[ -s $error_log ]]; then diff --git a/.github/workflows/test-cpan-libraries.yml b/.github/workflows/test-cpan-libraries.yml new file mode 100644 index 0000000000..8f921b0988 --- /dev/null +++ b/.github/workflows/test-cpan-libraries.yml @@ -0,0 +1,404 @@ +name: test-cpan-libraries + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +on: + workflow_dispatch: +# pull_request: +# paths: +# - ".github/workflows/test-cpan-libraries.yml" + +jobs: + get-environment: + uses: ./.github/workflows/get-environment.yml + + package-rpm: + needs: [get-environment] + if: ${{ needs.get-environment.outputs.stability != 'stable' }} + + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + distrib: [el8] + name: + [ + "ARGV::Struct", + "Authen::SASL::SASLprep", + "Authen::SCRAM::Client", + "BSON", + "BSON::XS", + "Config::AWS", + "Convert::Binary::C", + "Convert::EBCDIC", + "Crypt::Blowfish_PP", + "Crypt::OpenSSL::AES", + "DataStruct::Flat", + "DateTime::Format::Duration::ISO8601", + "DBD::Sybase", + "Device::Modbus", + "Device::Modbus::RTU::Client", + "Device::Modbus::TCP::Client", + "Email::Send::SMTP::Gmail", + "FFI::CheckLib", + "FFI::Platypus", + "File::SearchPath", + "HTTP::ProxyPAC", + "JMX::Jmx4Perl", + "Mojo::IOLoop::Signal", + "MongoDB", + "MooseX::ClassAttribute", + "Net::Amazon::Signature::V4", + "Net::DHCP", + "Net::FTPSSL", + "Net::HTTPTunnel", + "Net::NTP", + "Net::SMTP_auth", + "Net::Subnet", + "Net::TFTP", + "PBKDF2::Tiny", + "Statistics::Regression", + "Term::Clui", + "Unicode::Stringprep", + "URI::Template", + "URL::Encode", + "UUID", + "UUID::URandom", + "WWW::Selenium", + "XML::LibXML::Simple", + "ZMQ::FFI", + "ZMQ::LibZMQ4" + ] + include: + - build_distribs: "el8" + - rpm_dependencies: "" + - rpm_provides: "" + - version: "" + - spec_file: "" + - no-auto-depends: false + - distrib: el8 + package_extension: rpm + image: packaging-plugins-alma8 + - name: "BSON" + rpm_provides: "perl(BSON::Bytes) perl(BSON::Code) perl(BSON::DBRef) perl(BSON::OID) perl(BSON::Raw) perl(BSON::Regex) perl(BSON::Time) perl(BSON::Timestamp) perl(BSON::Types) perl(BSON)" + - name: "DateTime::Format::Duration::ISO8601" + rpm_provides: "perl(DateTime-Format-Duration-ISO8601)" + - name: "Device::Modbus::RTU::Client" + version: "0.022" + - name: "Device::Modbus::TCP::Client" + version: "0.026" + - name: "FFI::CheckLib" + rpm_dependencies: "perl(Env)" + - name: "FFI::Platypus" + rpm_provides: "perl(FFI::Platypus::Buffer) perl(FFI::Platypus::Memory)" + rpm_dependencies: "perl(Capture::Tiny) perl(FFI::CheckLib) perl(File::Spec::Functions) perl(IPC::Cmd) perl(JSON::PP) perl(List::Util) perl(autodie) perl(constant) perl(parent)" + no-auto-depends: true + - name: "Mojo::IOLoop::Signal" + rpm_dependencies: "perl-Mojolicious" + rpm_provides: "perl(Mojo::IOLoop::Signal)" + no-auto-depends: true + - name: "Net::DHCP" + rpm_provides: "perl(Net::DHCP::Constants) perl(Net::DHCP::Packet)" + - name: "Statistics::Regression" + version: "0.53" + - name: "UUID" + version: "0.31" + - name: "ZMQ::FFI" + rpm_dependencies: "zeromq" + - name: "ZMQ::LibZMQ4" + version: "0.01" + rpm_dependencies: "zeromq" + + name: package ${{ matrix.distrib }} ${{ matrix.name }} + container: + image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest + credentials: + username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }} + password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }} + + steps: + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + run: | + yum install -y yum-utils epel-release git + yum config-manager --set-enabled crb || true # alma 9 + yum config-manager --set-enabled powertools || true # alma 8 + yum install -y cpanminus rpm-build libcurl-devel libssh-devel expat-devel gcc libuuid-devel zeromq-devel libxml2-devel libffi-devel perl-DBI perl-Net-Pcap freetds freetds-devel perl-Module-Build-Tiny + + dnf module reset -y ruby + dnf module enable -y ruby:3.1 + dnf install -y ruby ruby-devel + shell: bash + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + repository: kduret/fpm + ref: fix-rpm-perl-dependency-name-unchanged + path: fpm + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + name: Build and install fpm # waiting https://github.com/jordansissel/fpm/pull/2066 + run: | + dnf install -y bsdtar + cd fpm + gem install bundler + bundle install + make install + shell: bash + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file == '' }} + run: | + if [ -z "${{ matrix.version }}" ]; then + PACKAGE_VERSION="" + else + PACKAGE_VERSION=" -v ${{ matrix.version }}" + fi + + if [ -z "${{ matrix.rpm_dependencies }}" ]; then + PACKAGE_DEPENDENCIES="" + else + for PACKAGE_DEPENDENCY in `echo "${{ matrix.rpm_dependencies }}"`; do + PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --depends "$PACKAGE_DEPENDENCY"" + done + fi + + if [ ! -z "${{ matrix.no-auto-depends }}" ]; then + PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --no-auto-depends" + fi + + if [ -z "${{ matrix.rpm_provides }}" ]; then + PACKAGE_PROVIDES="" + else + for PACKAGE_PROVIDE in `echo "${{ matrix.rpm_provides }}"`; do + PACKAGE_PROVIDES="$PACKAGE_PROVIDES --provides $PACKAGE_PROVIDE" + done + fi + + cpanm Module::Build::Tiny + cpanm Module::Install + + export SYBASE="/usr" + + fpm -s cpan -t ${{ matrix.package_extension }} --rpm-dist ${{ matrix.distrib }} --verbose --cpan-verbose --no-cpan-test$PACKAGE_DEPENDENCIES$PACKAGE_PROVIDES$PACKAGE_VERSION ${{ matrix.name }} + shell: bash + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file != '' }} + run: | + mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} + + rpmbuild --undefine=_disable_source_fetch -ba ${{ matrix.spec_file }} + + cp -r ~/rpmbuild/RPMS/noarch/*.rpm . + shell: bash + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + name: Replace '::' with - in the feature path + id: package-name + run: | + name="${{ matrix.name }}" + name_with_dash="${name//::/-}" + echo "Modified Name: $name_with_dash" + echo "name_with_dash=$name_with_dash" >> $GITHUB_OUTPUT + shell: bash + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: packages-${{ matrix.package_extension }}-${{ matrix.distrib }}-${{ steps.package-name.outputs.name_with_dash }} + path: ./*.${{ matrix.package_extension }} + retention-days: 1 + + merge-package-rpm-artifacts: + needs: [package-rpm] + runs-on: ubuntu-24.04 + strategy: + matrix: + distrib: [el8] + + steps: + - name: Merge Artifacts + uses: actions/upload-artifact/merge@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: packages-rpm-${{ matrix.distrib }} + pattern: packages-rpm-${{ matrix.distrib }}-* + delete-merged: false # cannot be set to true due to random fails: Failed to DeleteArtifact: Unable to make request: ECONNRESET + retention-days: 1 + + - name: Delete merged artifacts + uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5.1.0 + with: + name: packages-rpm-${{ matrix.distrib }}-* + failOnError: false + + sign-rpm: + needs: [merge-package-rpm-artifacts] + + runs-on: ubuntu-24.04 + strategy: + matrix: + distrib: [el8] + name: sign rpm ${{ matrix.distrib }} + container: + image: docker.centreon.com/centreon-private/rpm-signing:latest + options: -t + credentials: + username: ${{ secrets.HARBOR_RPM_GPG_SIGNING_REPO_USERNAME }} + password: ${{ secrets.HARBOR_RPM_GPG_SIGNING_REPO_TOKEN }} + + steps: + - run: apt-get install -y zstd + shell: bash + + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: packages-rpm-${{ matrix.distrib }} + path: ./ + + - run: echo "HOME=/root" >> $GITHUB_ENV + shell: bash + + - run: rpmsign --addsign ./*.rpm + shell: bash + + - uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + with: + path: ./*.rpm + key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }} + + test-packages: + needs: [get-environment, sign-rpm] + strategy: + fail-fast: false + matrix: + include: + - package_extension: rpm + image: almalinux:8 + distrib: el8 + arch: amd64 + runner_name: ubuntu-24.04 + + runs-on: ${{ matrix.runner_name }} + container: + image: ${{ matrix.image }} + + name: Test perl CPAN libs packages on ${{ matrix.package_extension }} ${{ matrix.distrib }} ${{ matrix.arch }} + steps: + - if: ${{ matrix.package_extension == 'rpm' }} + name: Install zstd, perl and Centreon repositories + run: | + dnf install -y zstd perl epel-release 'dnf-command(config-manager)' + dnf config-manager --set-enabled powertools || true # alma 8 + dnf config-manager --set-enabled crb || true # alma 9 + # Import Centreon GPG key + GPG_KEY_URL="https://yum-gpg.centreon.com/RPM-GPG-KEY-CES" + curl -sSL $GPG_KEY_URL -o RPM-GPG-KEY-CES + rpm --import RPM-GPG-KEY-CES + # Add Centreon plugins repositories + # echo -e '[centreon-plugins-stable]\nname=centreon plugins stable x86_64\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/x86_64\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n[centreon-plugins-stable-noarch]\nname=centreon plugins stable noarch\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/noarch\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n' >> /etc/yum.repos.d/centreon-plugins.repo + shell: bash + - if: ${{ matrix.package_extension == 'deb' }} + name: Install zstd, perl and Centreon repositories + run: | + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get install -y zstd perl wget gpg apt-utils + # Add Centreon plugins repositories + # if [ "${{ matrix.distrib }}" == "jammy" ]; then + # echo "deb https://packages.centreon.com/ubuntu-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list + # else + # echo "deb https://packages.centreon.com/apt-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list + # fi + wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1 + apt-get update + shell: bash + - name: Restore packages from cache + uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 + with: + path: ./*.${{ matrix.package_extension }} + key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} + fail-on-cache-miss: true + - name: Install packages + run: | + error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" + for package in ./*.${{ matrix.package_extension }}; do + echo "Package found: $package" + # If a debian package name ends with amd64 or arm64, we only install it if the tested architecture is the same, otherwise we skip it + if [[ ${{ matrix.package_extension }} == 'deb' && ($package == *amd64.deb && ${{ matrix.arch }} != "amd64" || $package == *arm64.deb && ${{ matrix.arch }} != "arm64") ]]; then + continue + fi + echo "Installing package: $package" + # List dependencies + if [ "${{ matrix.package_extension }}" == "rpm" ]; then + # List dependencies, and remove version and comparison operators + dependencies=$(rpm -qpR $package | sed 's/ [0-9.-]*\(\s\|$\)/ /g' | sed 's/ [<>!=]*\(\s\|$\)/ /g') + else + dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //' | sed 's/,//g') + fi + echo "Dependencies: $dependencies" + for dependency in $dependencies; do + echo "Dependency: $dependency" + # Skip non-perl dependencies + if [ "${{ matrix.package_extension }}" == "rpm" ]; then + if [[ $dependency != perl* ]]; then + continue + else + echo "Check dependency: $dependency" + # Update the dependency name to match the package name + dependency=$(echo $dependency | sed 's/(/-/g' | sed 's/)//g' | sed 's/::/-/g') + fi + elif [[ ${{ matrix.package_extension }} == "deb" && $dependency != lib*-perl ]]; then + continue + fi + # If the dependency has been built in the same workflow, install it + echo "searching file: $dependency*.${{ matrix.package_extension }}" + if [[ -n $(find . -maxdepth 1 -regex "\.\/$dependency[-_][\dv].*\.${{ matrix.package_extension }}") ]]; then + echo "Installing dependency: $dependency" + if [ "${{ matrix.package_extension }}" == "rpm" ]; then + error_output=$(dnf install -y ./$dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } + else + error_output=$(apt-get install -y ./$dependency*.deb 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } + fi + else + echo "Dependency $dependency not found" + fi + done + # Install package, then uninstall it with all his dependencies + if [ "${{ matrix.package_extension }}" == "rpm" ]; then + echo "Package installation..." + error_output=$(dnf install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } + echo "Package installation done." + echo "Package uninstallation..." + error_output=$(dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } + echo "Package uninstallation done." + # Clean dnf cache + dnf clean all + else + echo "Package installation..." + error_output=$(apt-get install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } + echo "Package installation done." + echo "Package uninstallation..." + error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } + echo "Package uninstallation done." + # Clean apt cache + apt-get clean + fi + done + # If the file error_log exists and is not empty, the workflow is in error + if [[ -s $error_log ]]; then + cat $error_log + exit 1 + fi + shell: bash + - name: Upload error log + if: failure() + uses: actions/upload-artifact@v4 + with: + name: install_error_log_${{ matrix.distrib }}-${{ matrix.arch }} + path: install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log From ec5005ca2896775d681472df11693c899959e519 Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Mon, 16 Dec 2024 23:10:51 +0100 Subject: [PATCH 16/35] fix deb dependencies --- .github/workflows/perl-cpan-libraries.yml | 26 ++++++++--------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index b73f033556..2b94573e56 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -576,8 +576,6 @@ jobs: GPG_KEY_URL="https://yum-gpg.centreon.com/RPM-GPG-KEY-CES" curl -sSL $GPG_KEY_URL -o RPM-GPG-KEY-CES rpm --import RPM-GPG-KEY-CES - # Add Centreon plugins repositories - # echo -e '[centreon-plugins-stable]\nname=centreon plugins stable x86_64\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/x86_64\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n[centreon-plugins-stable-noarch]\nname=centreon plugins stable noarch\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/noarch\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n' >> /etc/yum.repos.d/centreon-plugins.repo shell: bash - if: ${{ matrix.package_extension == 'deb' }} name: Install zstd, perl and Centreon repositories @@ -585,12 +583,6 @@ jobs: export DEBIAN_FRONTEND=noninteractive apt-get update apt-get install -y zstd perl wget gpg apt-utils - # Add Centreon plugins repositories - # if [ "${{ matrix.distrib }}" == "jammy" ]; then - # echo "deb https://packages.centreon.com/ubuntu-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list - # else - # echo "deb https://packages.centreon.com/apt-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list - # fi wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1 apt-get update shell: bash @@ -604,7 +596,7 @@ jobs: name: Install packages run: | error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" - for package in ./*.${{ matrix.package_extension }}; do + for package in ./*.rpm; do echo "Installing package: $package" # List dependencies, and remove version and comparison operators dependencies=$(rpm -qpR $package | sed 's/ [0-9.-]*\(\s\|$\)/ /g' | sed 's/ [<>!=]*\(\s\|$\)/ /g') @@ -618,7 +610,7 @@ jobs: dependency=$(echo $dependency | sed 's/(/-/g' | sed 's/)//g' | sed 's/::/-/g') fi # If the dependency has been built in the same workflow, install it - if [[ -n $(find . -maxdepth 1 -regex "\.\/$dependency-[0-9v].*\.${{ matrix.package_extension }}") ]]; then + if [[ -n $(find . -maxdepth 1 -regex "\.\/$dependency-[0-9v].*\.rpm") ]]; then echo "Installing dependency: $dependency" error_output=$(dnf install -y ./$dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } fi @@ -641,24 +633,24 @@ jobs: name: Install packages run: | error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" - for package in ./*.${{ matrix.package_extension }}; do + for package in ./*.deb; do # If the debian package name ends with amd64 or arm64, we only install it if the tested architecture is the same, otherwise we skip it - if [[ ${{ matrix.package_extension }} == 'deb' && ($package == *amd64.deb && ${{ matrix.arch }} != "amd64" || $package == *arm64.deb && ${{ matrix.arch }} != "arm64") ]]; then + if [[ $package == *amd64.deb && ${{ matrix.arch }} != "amd64" || $package == *arm64.deb && ${{ matrix.arch }} != "arm64" ]]; then continue fi echo "Installing package: $package" # List dependencies - dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //' | sed 's/,//g') + dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //' | sed 's/,//g' | sed 's/(\(.*\)//g') || { echo "$error_output" >> $error_log; echo "Error while listing dependencies of the package $package" >> $error_log; true; } for dependency in $dependencies; do # Skip non-perl dependencies if [[ $dependency != lib*-perl ]]; then continue fi # If the dependency has been built in the same workflow, install it - if [[ -n $(find . -maxdepth 1 -regex "\.\/lib.*-perl[-_][0-9].*all\.${{ matrix.package_extension }}" -o -regex "\.\/lib.*-perl[-_][0-9].*${{ matrix.arch }}\.${{ matrix.package_extension }}") ]]; then - echo "Installing dependency: $dependency" - error_output=$(apt-get install -y ./$dependency*.deb 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } - fi + for dependency_package in $(find . -maxdepth 1 -regex "\.\/${dependency}_[0-9].*all\.deb" -o -regex "\.\/${dependency}_[0-9].*${{ matrix.arch }}\.deb"); do + echo "Installing dependency: $dependency_package" + error_output=$(apt-get install -y ./$dependency_package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } + done done # Install package, then uninstall it with all his dependencies echo "Package installation..." From c140dd05e23f5c06bf6600d61e47daf26235c5d6 Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Tue, 17 Dec 2024 17:23:44 +0100 Subject: [PATCH 17/35] Add missing lib for jammy --- .github/workflows/perl-cpan-libraries.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 2b94573e56..91a4234af6 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -328,6 +328,7 @@ jobs: "Device::Modbus", "Device::Modbus::RTU::Client", "Device::Modbus::TCP::Client", + "Digest::SHA1", "Email::Send::SMTP::Gmail", "Hash::Ordered", "HTTP::ProxyPAC", @@ -371,6 +372,8 @@ jobs: build_distribs: "bookworm" - name: "Device::Modbus::TCP::Client" build_distribs: "bookworm" + - name: "Digest::SHA1" + build_distribs: "jammy" - name: "Net::Amazon::Signature::V4" build_distribs: ["bullseye", "jammy"] - name: "Net::MQTT::Simple" From 112b1c2299c65fc7cfd79523e6b018bd508c0d09 Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Wed, 18 Dec 2024 16:39:53 +0100 Subject: [PATCH 18/35] test --- .github/workflows/perl-cpan-libraries.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 91a4234af6..68c7d41d3a 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -585,7 +585,7 @@ jobs: run: | export DEBIAN_FRONTEND=noninteractive apt-get update - apt-get install -y zstd perl wget gpg apt-utils + apt-get install -y zstd perl wget gpg apt-utils procps wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1 apt-get update shell: bash @@ -642,6 +642,8 @@ jobs: continue fi echo "Installing package: $package" + echo $(df -h) + echo $(free -h) # List dependencies dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //' | sed 's/,//g' | sed 's/(\(.*\)//g') || { echo "$error_output" >> $error_log; echo "Error while listing dependencies of the package $package" >> $error_log; true; } for dependency in $dependencies; do @@ -655,13 +657,23 @@ jobs: error_output=$(apt-get install -y ./$dependency_package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } done done + echo $(df -h) + echo $(free -h) # Install package, then uninstall it with all his dependencies echo "Package installation..." error_output=$(apt-get install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } echo "Package installation done." + echo $(df -h) + echo $(free -h) echo "Package uninstallation..." error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } echo "Package uninstallation done." + echo $(df -h) + echo $(free -h) + apt-get clean + apt-get update + echo $(df -h) + echo $(free -h) done # If the file error_log exists and is not empty, the workflow is in error if [[ -s $error_log ]]; then From 1cf3c8171650e845b2b96c5668fabb5e742951d5 Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Thu, 19 Dec 2024 13:54:55 +0100 Subject: [PATCH 19/35] - Package only the deb packages that doesn't exist in the debian repo - Add trace for errors --- .github/workflows/perl-cpan-libraries.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 68c7d41d3a..78116f9dc9 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -430,6 +430,21 @@ jobs: echo "package_version=$(echo $PACKAGE_VERSION)" >> $GITHUB_OUTPUT shell: bash + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + name: Check if package already exists + run: | + package_name=$(echo "lib${{ matrix.name }}-perl" | sed 's/::/-/g' | tr '[:upper:]' '[:lower:]') + package_info=$(apt-cache policy $package_name) + if [[ -n $package_info ]]; then + echo "Package already exists in the repository." + candidate_version=$(echo "$package_info" | grep 'Candidate:' | awk '{print $2}') + if [[ "$candidate_version" == "${{ steps.package-version.outputs.package_version }}"* ]]; then + echo "Package already exists in the repository with the same version." + exit 0 + fi + fi + shell: bash + - if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.use_dh_make_perl == 'false' }} run: | apt-get install -y ruby libcurl4-openssl-dev libssh-dev uuid-dev libczmq-dev @@ -654,14 +669,16 @@ jobs: # If the dependency has been built in the same workflow, install it for dependency_package in $(find . -maxdepth 1 -regex "\.\/${dependency}_[0-9].*all\.deb" -o -regex "\.\/${dependency}_[0-9].*${{ matrix.arch }}\.deb"); do echo "Installing dependency: $dependency_package" - error_output=$(apt-get install -y ./$dependency_package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } + echo $(dpkg-deb --info $package) + error_output=$(apt-get -o Debug::pkgProblemResolver=true -o Debug::dpkg=true -o Debug::pkgDepCache::Marker=true install -y ./$dependency_package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } done done echo $(df -h) echo $(free -h) # Install package, then uninstall it with all his dependencies echo "Package installation..." - error_output=$(apt-get install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } + echo $(dpkg-deb --info $package) + error_output=$(apt-get -o Debug::pkgProblemResolver=true -o Debug::dpkg=true -o Debug::pkgDepCache::Marker=true install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } echo "Package installation done." echo $(df -h) echo $(free -h) From 9533e2eb07d0bd2b914f2a1ebc23857f202b22be Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Thu, 19 Dec 2024 17:28:31 +0100 Subject: [PATCH 20/35] remove df and free commands + install local dependency only if it doesn't exists on the debian repo --- .github/workflows/perl-cpan-libraries.yml | 31 ++++++++++------------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 78116f9dc9..8287c39502 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -657,8 +657,6 @@ jobs: continue fi echo "Installing package: $package" - echo $(df -h) - echo $(free -h) # List dependencies dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //' | sed 's/,//g' | sed 's/(\(.*\)//g') || { echo "$error_output" >> $error_log; echo "Error while listing dependencies of the package $package" >> $error_log; true; } for dependency in $dependencies; do @@ -666,31 +664,28 @@ jobs: if [[ $dependency != lib*-perl ]]; then continue fi - # If the dependency has been built in the same workflow, install it - for dependency_package in $(find . -maxdepth 1 -regex "\.\/${dependency}_[0-9].*all\.deb" -o -regex "\.\/${dependency}_[0-9].*${{ matrix.arch }}\.deb"); do - echo "Installing dependency: $dependency_package" - echo $(dpkg-deb --info $package) - error_output=$(apt-get -o Debug::pkgProblemResolver=true -o Debug::dpkg=true -o Debug::pkgDepCache::Marker=true install -y ./$dependency_package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } - done + # If the dependency exists in the Debian repository, don't check the local dependencies + dependency_info=$(apt-cache policy $dependency) + if [[ -n $dependency_info ]]; then + echo "Dependency exists in debian repository." + continue + else + # If the dependency has been built in the same workflow, install it + for dependency_package in $(find . -maxdepth 1 -regex "\.\/${dependency}_[0-9].*all\.deb" -o -regex "\.\/${dependency}_[0-9].*${{ matrix.arch }}\.deb"); do + echo "Installing dependency: $dependency_package" + echo $(dpkg-deb --info $package) + error_output=$(apt-get -o Debug::pkgProblemResolver=true -o Debug::dpkg=true -o Debug::pkgDepCache::Marker=true install -y ./$dependency_package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } + done + fi done - echo $(df -h) - echo $(free -h) # Install package, then uninstall it with all his dependencies echo "Package installation..." echo $(dpkg-deb --info $package) error_output=$(apt-get -o Debug::pkgProblemResolver=true -o Debug::dpkg=true -o Debug::pkgDepCache::Marker=true install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } echo "Package installation done." - echo $(df -h) - echo $(free -h) echo "Package uninstallation..." error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } echo "Package uninstallation done." - echo $(df -h) - echo $(free -h) - apt-get clean - apt-get update - echo $(df -h) - echo $(free -h) done # If the file error_log exists and is not empty, the workflow is in error if [[ -s $error_log ]]; then From 4694067cea9faf47c229fbc66d503e58d4c15e2a Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Fri, 20 Dec 2024 12:11:32 +0100 Subject: [PATCH 21/35] use dpkg to install a package, and install all his dependencies before --- .github/workflows/perl-cpan-libraries.yml | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 8287c39502..5e344fc625 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -660,31 +660,25 @@ jobs: # List dependencies dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //' | sed 's/,//g' | sed 's/(\(.*\)//g') || { echo "$error_output" >> $error_log; echo "Error while listing dependencies of the package $package" >> $error_log; true; } for dependency in $dependencies; do - # Skip non-perl dependencies - if [[ $dependency != lib*-perl ]]; then - continue - fi # If the dependency exists in the Debian repository, don't check the local dependencies dependency_info=$(apt-cache policy $dependency) if [[ -n $dependency_info ]]; then - echo "Dependency exists in debian repository." - continue + echo "Dependency $dependency exists in debian repository." + apt-get install -y $dependency else # If the dependency has been built in the same workflow, install it for dependency_package in $(find . -maxdepth 1 -regex "\.\/${dependency}_[0-9].*all\.deb" -o -regex "\.\/${dependency}_[0-9].*${{ matrix.arch }}\.deb"); do echo "Installing dependency: $dependency_package" - echo $(dpkg-deb --info $package) - error_output=$(apt-get -o Debug::pkgProblemResolver=true -o Debug::dpkg=true -o Debug::pkgDepCache::Marker=true install -y ./$dependency_package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } + error_output=$(apt-get install -y ./$dependency_package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } done fi done # Install package, then uninstall it with all his dependencies echo "Package installation..." - echo $(dpkg-deb --info $package) - error_output=$(apt-get -o Debug::pkgProblemResolver=true -o Debug::dpkg=true -o Debug::pkgDepCache::Marker=true install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } + error_output=$(dpkg -i $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } echo "Package installation done." echo "Package uninstallation..." - error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } + error_output=$(dpkg --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } echo "Package uninstallation done." done # If the file error_log exists and is not empty, the workflow is in error From 3b7cce6311a8368c80eb3c7fb04b0b9a057f5e38 Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Fri, 20 Dec 2024 16:37:55 +0100 Subject: [PATCH 22/35] test building all debs with fpm --- .github/workflows/perl-cpan-libraries.yml | 2 +- .github/workflows/test-cpan-libraries.yml | 477 ++++++++++++++++++---- 2 files changed, 394 insertions(+), 85 deletions(-) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 5e344fc625..7b3e82beb3 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -678,7 +678,7 @@ jobs: error_output=$(dpkg -i $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } echo "Package installation done." echo "Package uninstallation..." - error_output=$(dpkg --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } + error_output=$(apt autoremove --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } echo "Package uninstallation done." done # If the file error_log exists and is not empty, the workflow is in error diff --git a/.github/workflows/test-cpan-libraries.yml b/.github/workflows/test-cpan-libraries.yml index 8f921b0988..b633bada26 100644 --- a/.github/workflows/test-cpan-libraries.yml +++ b/.github/workflows/test-cpan-libraries.yml @@ -6,9 +6,9 @@ concurrency: on: workflow_dispatch: -# pull_request: -# paths: -# - ".github/workflows/test-cpan-libraries.yml" + pull_request: + paths: + - ".github/workflows/test-cpan-libraries.yml" jobs: get-environment: @@ -16,13 +16,15 @@ jobs: package-rpm: needs: [get-environment] - if: ${{ needs.get-environment.outputs.stability != 'stable' }} + if: | + needs.get-environment.outputs.skip_workflow == 'false' && + needs.get-environment.outputs.stability != 'stable' runs-on: ubuntu-24.04 strategy: fail-fast: false matrix: - distrib: [el8] + distrib: [el8, el9] name: [ "ARGV::Struct", @@ -55,32 +57,39 @@ jobs: "Net::FTPSSL", "Net::HTTPTunnel", "Net::NTP", + "Net::SMTPS", "Net::SMTP_auth", "Net::Subnet", "Net::TFTP", + "Paws", "PBKDF2::Tiny", + "Statistics::Descriptive", "Statistics::Regression", "Term::Clui", "Unicode::Stringprep", "URI::Template", "URL::Encode", + "URL::Encode::XS", "UUID", "UUID::URandom", "WWW::Selenium", "XML::LibXML::Simple", + "ZMQ::Constants", "ZMQ::FFI", "ZMQ::LibZMQ4" ] include: - - build_distribs: "el8" + - build_distribs: "el8,el9" - rpm_dependencies: "" - rpm_provides: "" - version: "" - - spec_file: "" - no-auto-depends: false - distrib: el8 package_extension: rpm image: packaging-plugins-alma8 + - distrib: el9 + package_extension: rpm + image: packaging-plugins-alma9 - name: "BSON" rpm_provides: "perl(BSON::Bytes) perl(BSON::Code) perl(BSON::DBRef) perl(BSON::OID) perl(BSON::Raw) perl(BSON::Regex) perl(BSON::Time) perl(BSON::Timestamp) perl(BSON::Types) perl(BSON)" - name: "DateTime::Format::Duration::ISO8601" @@ -101,10 +110,18 @@ jobs: no-auto-depends: true - name: "Net::DHCP" rpm_provides: "perl(Net::DHCP::Constants) perl(Net::DHCP::Packet)" + - name: "Net::SMTPS" + build_distribs: el9 + - name: "Statistics::Descriptive" + build_distribs: el9 - name: "Statistics::Regression" version: "0.53" + - name: "URL::Encode::XS" + build_distribs: el9 - name: "UUID" version: "0.31" + - name: "ZMQ::Constants" + build_distribs: "el9" - name: "ZMQ::FFI" rpm_dependencies: "zeromq" - name: "ZMQ::LibZMQ4" @@ -151,7 +168,7 @@ jobs: make install shell: bash - - if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file == '' }} + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} run: | if [ -z "${{ matrix.version }}" ]; then PACKAGE_VERSION="" @@ -187,15 +204,6 @@ jobs: fpm -s cpan -t ${{ matrix.package_extension }} --rpm-dist ${{ matrix.distrib }} --verbose --cpan-verbose --no-cpan-test$PACKAGE_DEPENDENCIES$PACKAGE_PROVIDES$PACKAGE_VERSION ${{ matrix.name }} shell: bash - - if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file != '' }} - run: | - mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} - - rpmbuild --undefine=_disable_source_fetch -ba ${{ matrix.spec_file }} - - cp -r ~/rpmbuild/RPMS/noarch/*.rpm . - shell: bash - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} name: Replace '::' with - in the feature path id: package-name @@ -214,11 +222,14 @@ jobs: retention-days: 1 merge-package-rpm-artifacts: - needs: [package-rpm] + needs: [get-environment, package-rpm] + if: | + needs.get-environment.outputs.skip_workflow == 'false' && + needs.get-environment.outputs.stability != 'stable' runs-on: ubuntu-24.04 strategy: matrix: - distrib: [el8] + distrib: [el8, el9] steps: - name: Merge Artifacts @@ -236,12 +247,15 @@ jobs: failOnError: false sign-rpm: - needs: [merge-package-rpm-artifacts] + needs: [get-environment, merge-package-rpm-artifacts] + if: | + needs.get-environment.outputs.skip_workflow == 'false' && + needs.get-environment.outputs.stability != 'stable' runs-on: ubuntu-24.04 strategy: matrix: - distrib: [el8] + distrib: [el8, el9] name: sign rpm ${{ matrix.distrib }} container: image: docker.centreon.com/centreon-private/rpm-signing:latest @@ -272,8 +286,233 @@ jobs: path: ./*.rpm key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }} + package-deb: + needs: [get-environment] + if: | + needs.get-environment.outputs.skip_workflow == 'false' && + needs.get-environment.outputs.stability != 'stable' + + runs-on: ${{ matrix.runner_name }} + strategy: + fail-fast: false + matrix: + image: [packaging-plugins-bullseye, packaging-plugins-bookworm, packaging-plugins-jammy, packaging-plugins-bullseye-arm64] + name: + [ + "ARGV::Struct", + "Authen::SCRAM::Client", + "Config::AWS", + "Convert::EBCDIC", + "Crypt::Blowfish_PP", + "Crypt::OpenSSL::AES", + "DataStruct::Flat", + "DateTime::Format::Duration::ISO8601", + "Device::Modbus", + "Device::Modbus::RTU::Client", + "Device::Modbus::TCP::Client", + "Digest::SHA1", + "Email::Send::SMTP::Gmail", + "Hash::Ordered", + "HTTP::ProxyPAC", + "JMX::Jmx4Perl", + "Mojo::IOLoop::Signal", + "Net::Amazon::Signature::V4", + "Net::FTPSSL", + "Net::HTTPTunnel", + "Net::MQTT::Simple", + "Net::SMTP_auth", + "Paws", + "Statistics::Regression", + "WWW::Selenium", + "ZMQ::Constants", + "ZMQ::LibZMQ4" + ] + include: + - runner_name: ubuntu-24.04 + - arch: amd64 + - build_distribs: "bullseye,bookworm,jammy" + - deb_dependencies: "" + - rpm_provides: "" + - version: "" + - distrib: bullseye + package_extension: deb + image: packaging-plugins-bullseye + - distrib: bookworm + package_extension: deb + image: packaging-plugins-bookworm + - distrib: jammy + package_extension: deb + image: packaging-plugins-jammy + - distrib: bullseye + package_extension: deb + image: packaging-plugins-bullseye-arm64 + arch: arm64 + runner_name: ["self-hosted", "collect-arm64"] + - name: "Device::Modbus::RTU::Client" + build_distribs: "bookworm" + - name: "Device::Modbus::TCP::Client" + build_distribs: "bookworm" + - name: "Digest::SHA1" + build_distribs: "jammy" + - name: "Net::Amazon::Signature::V4" + build_distribs: ["bullseye", "jammy"] + - name: "Net::MQTT::Simple" + version: "1.29" + - name: "Paws" + deb_dependencies: "libmoose-perl libmoosex-classattribute-perl libjson-maybexs-perl liburl-encode-perl libargv-struct-perl libmoo-perl libtype-tiny-perl libdatastruct-flat-perl libmodule-find-perl libthrowable-perl liburi-template-perl libnet-amazon-signature-v4-perl" + no-auto-depends: true + - name: "Statistics::Regression" + build_distribs: "bullseye" + version: "0.53" + - name: "ZMQ::LibZMQ4" + version: "0.01" + deb_dependencies: "libzmq5" + name: package ${{ matrix.distrib }} ${{ matrix.arch }} ${{ matrix.name }} + container: + image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest + credentials: + username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }} + password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }} + + steps: + - 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 + run: | + apt-get update + apt-get install -y cpanminus + + if [ -z "${{ matrix.version }}" ]; then + CPAN_PACKAGE_VERSION=$(cpanm --info ${{ matrix.name }} | sed 's/\.tar\.gz$//' | sed 's/.*\-//' | sed 's/v//') + + if [[ ! $CPAN_PACKAGE_VERSION =~ ^[0-9]+\.[0-9]+ ]]; then + echo "::error::Invalid version number: ${CPAN_PACKAGE_VERSION}" + exit 1 + fi + + PACKAGE_VERSION="${CPAN_PACKAGE_VERSION}" + else + PACKAGE_VERSION="${{ matrix.version }}" + fi + + echo "package_version=$(echo $PACKAGE_VERSION)" >> $GITHUB_OUTPUT + shell: bash + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + name: Check if package already exists + run: | + package_name=$(echo "lib${{ matrix.name }}-perl" | sed 's/::/-/g' | tr '[:upper:]' '[:lower:]') + package_info=$(apt-cache policy $package_name) + if [[ -n $package_info ]]; then + echo "Package already exists in the repository." + candidate_version=$(echo "$package_info" | grep 'Candidate:' | awk '{print $2}') + if [[ "$candidate_version" == "${{ steps.package-version.outputs.package_version }}"* ]]; then + echo "Package already exists in the repository with the same version." + exit 0 + fi + fi + shell: bash + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + run: | + apt-get install -y ruby libcurl4-openssl-dev libssh-dev uuid-dev libczmq-dev + + if [ -z "${{ matrix.deb_dependencies }}" ]; then + PACKAGE_DEPENDENCIES="" + else + for PACKAGE_DEPENDENCY in `echo ${{ matrix.deb_dependencies }}`; do + PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --depends $PACKAGE_DEPENDENCY" + done + fi + + if [ ! -z "${{ matrix.no-auto-depends }}" ]; then + PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --no-auto-depends" + fi + + cpanm Module::Build::Tiny + cpanm Module::Install + + 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 ${{ 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) }} + name: Replace '::' with - in the feature path + id: package-name + run: | + name="${{ matrix.name }}" + name_with_dash="${name//::/-}" + echo "Modified Name: $name_with_dash" + echo "name_with_dash=$name_with_dash" >> $GITHUB_OUTPUT + shell: bash + + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: packages-${{ matrix.package_extension }}-${{ matrix.distrib }}-${{ matrix.arch }}-${{ steps.package-name.outputs.name_with_dash}} + path: ./*.${{ matrix.package_extension }} + retention-days: 1 + + merge-package-deb-artifacts: + needs: [get-environment, package-deb] + if: | + needs.get-environment.outputs.skip_workflow == 'false' && + needs.get-environment.outputs.stability != 'stable' + runs-on: ubuntu-24.04 + strategy: + matrix: + distrib: [bullseye, bookworm, jammy] + + steps: + - name: Merge Artifacts + uses: actions/upload-artifact/merge@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: packages-deb-${{ matrix.distrib }} + pattern: packages-deb-${{ matrix.distrib }}-* + delete-merged: false # cannot be set to true due to random fails: Failed to DeleteArtifact: Unable to make request: ECONNRESET + retention-days: 1 + + - name: Delete merged artifacts + uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5.1.0 + with: + name: packages-deb-${{ matrix.distrib }}-* + failOnError: false + + download-and-cache-deb: + needs: [get-environment, merge-package-deb-artifacts] + if: | + needs.get-environment.outputs.skip_workflow == 'false' && + needs.get-environment.outputs.stability != 'stable' + runs-on: ubuntu-24.04 + strategy: + matrix: + distrib: [bullseye, bookworm, jammy] + steps: + - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: packages-deb-${{ matrix.distrib }} + path: ./ + + - uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + with: + path: ./*.deb + key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.distrib }} + test-packages: - needs: [get-environment, sign-rpm] + needs: [get-environment, sign-rpm, download-and-cache-deb] strategy: fail-fast: false matrix: @@ -283,6 +522,31 @@ jobs: distrib: el8 arch: amd64 runner_name: ubuntu-24.04 + - package_extension: rpm + image: almalinux:9 + distrib: el9 + arch: amd64 + runner_name: ubuntu-24.04 + - package_extension: deb + image: debian:bullseye + distrib: bullseye + arch: amd64 + runner_name: ubuntu-24.04 + - package_extension: deb + image: debian:bookworm + distrib: bookworm + arch: amd64 + runner_name: ubuntu-24.04 + - package_extension: deb + image: ubuntu:jammy + distrib: jammy + arch: amd64 + runner_name: ubuntu-24.04 + - package_extension: deb + image: arm64v8/debian:bullseye + distrib: bullseye + arch: arm64 + runner_name: ["self-hosted", "collect-arm64"] runs-on: ${{ matrix.runner_name }} container: @@ -300,21 +564,13 @@ jobs: GPG_KEY_URL="https://yum-gpg.centreon.com/RPM-GPG-KEY-CES" curl -sSL $GPG_KEY_URL -o RPM-GPG-KEY-CES rpm --import RPM-GPG-KEY-CES - # Add Centreon plugins repositories - # echo -e '[centreon-plugins-stable]\nname=centreon plugins stable x86_64\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/x86_64\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n[centreon-plugins-stable-noarch]\nname=centreon plugins stable noarch\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/noarch\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n' >> /etc/yum.repos.d/centreon-plugins.repo shell: bash - if: ${{ matrix.package_extension == 'deb' }} name: Install zstd, perl and Centreon repositories run: | export DEBIAN_FRONTEND=noninteractive apt-get update - apt-get install -y zstd perl wget gpg apt-utils - # Add Centreon plugins repositories - # if [ "${{ matrix.distrib }}" == "jammy" ]; then - # echo "deb https://packages.centreon.com/ubuntu-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list - # else - # echo "deb https://packages.centreon.com/apt-plugins-stable/ ${{ matrix.distrib }} main" | tee /etc/apt/sources.list.d/centreon-plugins.list - # fi + apt-get install -y zstd perl wget gpg apt-utils procps wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1 apt-get update shell: bash @@ -324,71 +580,76 @@ jobs: path: ./*.${{ matrix.package_extension }} key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} fail-on-cache-miss: true - - name: Install packages + - if: ${{ matrix.package_extension == 'rpm' }} + name: Install packages run: | error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" - for package in ./*.${{ matrix.package_extension }}; do - echo "Package found: $package" - # If a debian package name ends with amd64 or arm64, we only install it if the tested architecture is the same, otherwise we skip it - if [[ ${{ matrix.package_extension }} == 'deb' && ($package == *amd64.deb && ${{ matrix.arch }} != "amd64" || $package == *arm64.deb && ${{ matrix.arch }} != "arm64") ]]; then - continue - fi + for package in ./*.rpm; do echo "Installing package: $package" - # List dependencies - if [ "${{ matrix.package_extension }}" == "rpm" ]; then - # List dependencies, and remove version and comparison operators - dependencies=$(rpm -qpR $package | sed 's/ [0-9.-]*\(\s\|$\)/ /g' | sed 's/ [<>!=]*\(\s\|$\)/ /g') - else - dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //' | sed 's/,//g') - fi - echo "Dependencies: $dependencies" + # List dependencies, and remove version and comparison operators + dependencies=$(rpm -qpR $package | sed 's/ [0-9.-]*\(\s\|$\)/ /g' | sed 's/ [<>!=]*\(\s\|$\)/ /g') for dependency in $dependencies; do - echo "Dependency: $dependency" # Skip non-perl dependencies - if [ "${{ matrix.package_extension }}" == "rpm" ]; then - if [[ $dependency != perl* ]]; then - continue - else - echo "Check dependency: $dependency" - # Update the dependency name to match the package name - dependency=$(echo $dependency | sed 's/(/-/g' | sed 's/)//g' | sed 's/::/-/g') - fi - elif [[ ${{ matrix.package_extension }} == "deb" && $dependency != lib*-perl ]]; then - continue + if [[ $dependency != perl* ]]; then + continue + else + echo "Check dependency: $dependency" + # Update the dependency name to match the package name + dependency=$(echo $dependency | sed 's/(/-/g' | sed 's/)//g' | sed 's/::/-/g') fi # If the dependency has been built in the same workflow, install it - echo "searching file: $dependency*.${{ matrix.package_extension }}" - if [[ -n $(find . -maxdepth 1 -regex "\.\/$dependency[-_][\dv].*\.${{ matrix.package_extension }}") ]]; then + if [[ -n $(find . -maxdepth 1 -regex "\.\/$dependency-[0-9v].*\.rpm") ]]; then echo "Installing dependency: $dependency" - if [ "${{ matrix.package_extension }}" == "rpm" ]; then - error_output=$(dnf install -y ./$dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } - else - error_output=$(apt-get install -y ./$dependency*.deb 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } - fi - else - echo "Dependency $dependency not found" + error_output=$(dnf install -y ./$dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } fi done # Install package, then uninstall it with all his dependencies - if [ "${{ matrix.package_extension }}" == "rpm" ]; then - echo "Package installation..." - error_output=$(dnf install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } - echo "Package installation done." - echo "Package uninstallation..." - error_output=$(dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } - echo "Package uninstallation done." - # Clean dnf cache - dnf clean all - else - echo "Package installation..." - error_output=$(apt-get install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } - echo "Package installation done." - echo "Package uninstallation..." - error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } - echo "Package uninstallation done." - # Clean apt cache - apt-get clean + echo "Package installation..." + error_output=$(dnf install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } + echo "Package installation done." + echo "Package uninstallation..." + error_output=$(dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } + echo "Package uninstallation done." + done + # If the file error_log exists and is not empty, the workflow is in error + if [[ -s $error_log ]]; then + cat $error_log + exit 1 + fi + shell: bash + - if: ${{ matrix.package_extension == 'deb' }} + name: Install packages + run: | + error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" + for package in ./*.deb; do + # If the debian package name ends with amd64 or arm64, we only install it if the tested architecture is the same, otherwise we skip it + if [[ $package == *amd64.deb && ${{ matrix.arch }} != "amd64" || $package == *arm64.deb && ${{ matrix.arch }} != "arm64" ]]; then + continue fi + echo "Installing package: $package" + # List dependencies + dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //' | sed 's/,//g' | sed 's/(\(.*\)//g') || { echo "$error_output" >> $error_log; echo "Error while listing dependencies of the package $package" >> $error_log; true; } + for dependency in $dependencies; do + # If the dependency exists in the Debian repository, don't check the local dependencies + dependency_info=$(apt-cache policy $dependency) + if [[ -n $dependency_info ]]; then + echo "Dependency $dependency exists in debian repository." + continue + else + # If the dependency has been built in the same workflow, install it + for dependency_package in $(find . -maxdepth 1 -regex "\.\/${dependency}_[0-9].*all\.deb" -o -regex "\.\/${dependency}_[0-9].*${{ matrix.arch }}\.deb"); do + echo "Installing dependency: $dependency_package" + error_output=$(apt-get install -y ./$dependency_package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } + done + fi + done + # Install package, then uninstall it with all his dependencies + echo "Package installation..." + error_output=$(apt-get install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } + echo "Package installation done." + echo "Package uninstallation..." + error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } + echo "Package uninstallation done." done # If the file error_log exists and is not empty, the workflow is in error if [[ -s $error_log ]]; then @@ -402,3 +663,51 @@ jobs: with: name: install_error_log_${{ matrix.distrib }}-${{ matrix.arch }} path: install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log + + deliver-packages: + needs: [get-environment, sign-rpm, download-and-cache-deb, test-packages] + if: | + needs.get-environment.outputs.skip_workflow == 'false' && + (contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) || ( needs.get-environment.outputs.stability == 'stable' && github.event_name != 'workflow_dispatch')) && + ! cancelled() && + ! contains(needs.*.result, 'failure') && + ! contains(needs.*.result, 'cancelled') + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + include: + - distrib: el8 + package_extension: rpm + - distrib: el9 + package_extension: rpm + - distrib: bullseye + package_extension: deb + - distrib: bookworm + package_extension: deb + - distrib: jammy + package_extension: deb + + name: deliver ${{ matrix.distrib }} + steps: + - name: Checkout sources + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + + - name: Delivery + uses: ./.github/actions/package-delivery + with: + module_name: perl-cpan-libraries + distrib: ${{ matrix.distrib }} + cache_key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} + stability: ${{ needs.get-environment.outputs.stability }} + release_type: ${{ needs.get-environment.outputs.release_type }} + artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} + + set-skip-label: + needs: [get-environment, deliver-packages] + if: | + needs.get-environment.outputs.skip_workflow == 'false' && + ! cancelled() && + ! contains(needs.*.result, 'failure') && + ! contains(needs.*.result, 'cancelled') + uses: ./.github/workflows/set-pull-request-skip-label.yml From c0249c6ed50fd26bf0594cf31250f5f1d3900aec Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Thu, 26 Dec 2024 14:51:33 +0100 Subject: [PATCH 23/35] Cleaning installation of tools/libs already in the docker image --- .../Dockerfile.packaging-plugins-bullseye | 3 +- .github/workflows/perl-cpan-libraries.yml | 37 ++++++------------- .github/workflows/test-cpan-libraries.yml | 9 ----- 3 files changed, 13 insertions(+), 36 deletions(-) diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-bullseye b/.github/docker/packaging/Dockerfile.packaging-plugins-bullseye index 39881c897f..388d9ac570 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-bullseye +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-bullseye @@ -38,7 +38,6 @@ apt-get install -y \ libapp-fatpacker-perl \ libcurl4-openssl-dev \ libczmq-dev \ - libczmq-dev\ libfile-copy-recursive-perl \ libjson-perl \ libmodule-build-tiny-perl \ @@ -58,6 +57,8 @@ cpanm Crypt::OpenSSL::Guess 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") echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list apt-get update diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 7b3e82beb3..abbcf320ed 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -6,17 +6,17 @@ concurrency: on: workflow_dispatch: - pull_request: - paths: - - ".github/workflows/perl-cpan-libraries.yml" - push: - branches: - - develop - - dev-[2-9][0-9].[0-9][0-9].x - - master - - "[2-9][0-9].[0-9][0-9].x" - paths: - - ".github/workflows/perl-cpan-libraries.yml" +# pull_request: +# paths: +# - ".github/workflows/perl-cpan-libraries.yml" +# push: +# branches: +# - develop +# - dev-[2-9][0-9].[0-9][0-9].x +# - master +# - "[2-9][0-9].[0-9][0-9].x" +# paths: +# - ".github/workflows/perl-cpan-libraries.yml" jobs: get-environment: @@ -411,9 +411,6 @@ jobs: name: Get package version id: package-version run: | - apt-get update - apt-get install -y cpanminus - if [ -z "${{ matrix.version }}" ]; then CPAN_PACKAGE_VERSION=$(cpanm --info ${{ matrix.name }} | sed 's/\.tar\.gz$//' | sed 's/.*\-//' | sed 's/v//') @@ -447,8 +444,6 @@ jobs: - if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.use_dh_make_perl == 'false' }} run: | - apt-get install -y ruby libcurl4-openssl-dev libssh-dev uuid-dev libczmq-dev - if [ -z "${{ matrix.deb_dependencies }}" ]; then PACKAGE_DEPENDENCIES="" else @@ -461,21 +456,11 @@ jobs: PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --no-auto-depends" fi - cpanm Module::Build::Tiny - cpanm Module::Install - - 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 ${{ 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' }} run: | - 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 }}${{ steps.parse-distrib.outputs.package_distrib_separator }}${{ steps.parse-distrib.outputs.package_distrib_name }} --cpan ${{ matrix.name }} shell: bash diff --git a/.github/workflows/test-cpan-libraries.yml b/.github/workflows/test-cpan-libraries.yml index b633bada26..7d33f9b7f0 100644 --- a/.github/workflows/test-cpan-libraries.yml +++ b/.github/workflows/test-cpan-libraries.yml @@ -389,9 +389,6 @@ jobs: name: Get package version id: package-version run: | - apt-get update - apt-get install -y cpanminus - if [ -z "${{ matrix.version }}" ]; then CPAN_PACKAGE_VERSION=$(cpanm --info ${{ matrix.name }} | sed 's/\.tar\.gz$//' | sed 's/.*\-//' | sed 's/v//') @@ -425,8 +422,6 @@ jobs: - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} run: | - apt-get install -y ruby libcurl4-openssl-dev libssh-dev uuid-dev libczmq-dev - if [ -z "${{ matrix.deb_dependencies }}" ]; then PACKAGE_DEPENDENCIES="" else @@ -439,10 +434,6 @@ jobs: PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --no-auto-depends" fi - cpanm Module::Build::Tiny - cpanm Module::Install - - 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") From 4c8d634883370098a6a1aa424eaf648464fd1a3e Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Fri, 27 Dec 2024 19:32:36 +0100 Subject: [PATCH 24/35] update packages existence checking + dependencies after cpan build --- .../Dockerfile.packaging-plugins-bullseye | 3 --- .github/workflows/perl-cpan-libraries.yml | 6 +++++ .github/workflows/test-cpan-libraries.yml | 25 +++++++++++-------- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-bullseye b/.github/docker/packaging/Dockerfile.packaging-plugins-bullseye index 388d9ac570..1acb04043c 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-bullseye +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-bullseye @@ -57,9 +57,6 @@ cpanm Crypt::OpenSSL::Guess 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") - echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list apt-get update apt-get install -y nfpm=2.41.0 diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index abbcf320ed..9514c0f40c 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -568,6 +568,7 @@ jobs: image: ${{ matrix.image }} name: Test perl CPAN libs packages on ${{ matrix.package_extension }} ${{ matrix.distrib }} ${{ matrix.arch }} + steps: - if: ${{ matrix.package_extension == 'rpm' }} name: Install zstd, perl and Centreon repositories @@ -580,6 +581,7 @@ jobs: curl -sSL $GPG_KEY_URL -o RPM-GPG-KEY-CES rpm --import RPM-GPG-KEY-CES shell: bash + - if: ${{ matrix.package_extension == 'deb' }} name: Install zstd, perl and Centreon repositories run: | @@ -589,12 +591,14 @@ jobs: wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1 apt-get update shell: bash + - name: Restore packages from cache uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 with: path: ./*.${{ matrix.package_extension }} key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} fail-on-cache-miss: true + - if: ${{ matrix.package_extension == 'rpm' }} name: Install packages run: | @@ -632,6 +636,7 @@ jobs: exit 1 fi shell: bash + - if: ${{ matrix.package_extension == 'deb' }} name: Install packages run: | @@ -672,6 +677,7 @@ jobs: exit 1 fi shell: bash + - name: Upload error log if: failure() uses: actions/upload-artifact@v4 diff --git a/.github/workflows/test-cpan-libraries.yml b/.github/workflows/test-cpan-libraries.yml index 7d33f9b7f0..6abf1f7974 100644 --- a/.github/workflows/test-cpan-libraries.yml +++ b/.github/workflows/test-cpan-libraries.yml @@ -364,6 +364,8 @@ jobs: - name: "Statistics::Regression" build_distribs: "bullseye" version: "0.53" + - name: "WWW::Selenium" + deb_dependencies: "libcarp-always-perl libdata-dumper-compact-perl libexporter-tiny-perl libhttp-headers-fast-perl libhttp-request-ascgi-perl libio-socket-ssl-perl liblwp-useragent-determined-perl libtest-simple-perl libtest-more-utf8-perl liburi-escape-xs-perl libclass-base-perl" - name: "ZMQ::LibZMQ4" version: "0.01" deb_dependencies: "libzmq5" @@ -389,38 +391,41 @@ jobs: name: Get package version id: package-version run: | + cpan_info=$(cpanm --info ${{ matrix.name }}) if [ -z "${{ matrix.version }}" ]; then - CPAN_PACKAGE_VERSION=$(cpanm --info ${{ matrix.name }} | sed 's/\.tar\.gz$//' | sed 's/.*\-//' | sed 's/v//') - + CPAN_PACKAGE_VERSION=$(echo $cpan_info | sed 's/\.tar\.gz$//' | sed 's/.*\-//' | sed 's/v//') if [[ ! $CPAN_PACKAGE_VERSION =~ ^[0-9]+\.[0-9]+ ]]; then echo "::error::Invalid version number: ${CPAN_PACKAGE_VERSION}" exit 1 fi - PACKAGE_VERSION="${CPAN_PACKAGE_VERSION}" else PACKAGE_VERSION="${{ matrix.version }}" fi - echo "package_version=$(echo $PACKAGE_VERSION)" >> $GITHUB_OUTPUT + CPAN_PACKAGE_NAME=$(echo $cpan_info | sed 's/.*\///g' | sed 's/-[0-9\.]*\.tar\.gz//g' | tr '[:upper:]' '[:lower:]') + PACKAGE_NAME="lib$CPAN_PACKAGE_NAME-perl" + echo "package_name=$(echo $PACKAGE_NAME)" >> $GITHUB_OUTPUT shell: bash - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} name: Check if package already exists + id: check-package-existance run: | - package_name=$(echo "lib${{ matrix.name }}-perl" | sed 's/::/-/g' | tr '[:upper:]' '[:lower:]') - package_info=$(apt-cache policy $package_name) + package_info=$(apt-cache policy ${{ steps.package-version.outputs.package_name }}) + do_not_build="false" if [[ -n $package_info ]]; then echo "Package already exists in the repository." candidate_version=$(echo "$package_info" | grep 'Candidate:' | awk '{print $2}') if [[ "$candidate_version" == "${{ steps.package-version.outputs.package_version }}"* ]]; then echo "Package already exists in the repository with the same version." - exit 0 + do_not_build="true" fi fi + echo "do_not_build=$do_not_build" >> $GITHUB_OUTPUT shell: bash - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) }} run: | if [ -z "${{ matrix.deb_dependencies }}" ]; then PACKAGE_DEPENDENCIES="" @@ -440,7 +445,7 @@ jobs: 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) }} + - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) }} name: Replace '::' with - in the feature path id: package-name run: | @@ -450,7 +455,7 @@ jobs: echo "name_with_dash=$name_with_dash" >> $GITHUB_OUTPUT shell: bash - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) }} uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: packages-${{ matrix.package_extension }}-${{ matrix.distrib }}-${{ matrix.arch }}-${{ steps.package-name.outputs.name_with_dash}} From 403ff59be20a2aa0004ced9ff2eb1f6c8903bc4d Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Mon, 30 Dec 2024 17:39:38 +0100 Subject: [PATCH 25/35] update action --- .github/workflows/perl-cpan-libraries.yml | 60 ++++++++++++----------- .github/workflows/test-cpan-libraries.yml | 6 +-- 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 9514c0f40c..aebadeee72 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -6,17 +6,17 @@ concurrency: on: workflow_dispatch: -# pull_request: -# paths: -# - ".github/workflows/perl-cpan-libraries.yml" -# push: -# branches: -# - develop -# - dev-[2-9][0-9].[0-9][0-9].x -# - master -# - "[2-9][0-9].[0-9][0-9].x" -# paths: -# - ".github/workflows/perl-cpan-libraries.yml" + pull_request: + paths: + - ".github/workflows/perl-cpan-libraries.yml" + push: + branches: + - develop + - dev-[2-9][0-9].[0-9][0-9].x + - master + - "[2-9][0-9].[0-9][0-9].x" + paths: + - ".github/workflows/perl-cpan-libraries.yml" jobs: get-environment: @@ -408,41 +408,44 @@ jobs: distrib: ${{ matrix.distrib }} - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} - name: Get package version - id: package-version + name: Get package infos + id: package-infos run: | + cpan_info=$(cpanm --info ${{ matrix.name }}) if [ -z "${{ matrix.version }}" ]; then - CPAN_PACKAGE_VERSION=$(cpanm --info ${{ matrix.name }} | sed 's/\.tar\.gz$//' | sed 's/.*\-//' | sed 's/v//') - + CPAN_PACKAGE_VERSION=$(echo $cpan_info | sed 's/\.tar\.gz$//' | sed 's/.*\-//' | sed 's/v//') if [[ ! $CPAN_PACKAGE_VERSION =~ ^[0-9]+\.[0-9]+ ]]; then echo "::error::Invalid version number: ${CPAN_PACKAGE_VERSION}" exit 1 fi - PACKAGE_VERSION="${CPAN_PACKAGE_VERSION}" else PACKAGE_VERSION="${{ matrix.version }}" fi - echo "package_version=$(echo $PACKAGE_VERSION)" >> $GITHUB_OUTPUT + CPAN_PACKAGE_NAME=$(echo $cpan_info | sed 's/.*\///g' | sed 's/-[0-9\.]*\.tar\.gz//g' | tr '[:upper:]' '[:lower:]') + PACKAGE_NAME="lib$CPAN_PACKAGE_NAME-perl" + echo "package_name=$(echo $PACKAGE_NAME)" >> $GITHUB_OUTPUT shell: bash - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} name: Check if package already exists + id: check-package-existance run: | - package_name=$(echo "lib${{ matrix.name }}-perl" | sed 's/::/-/g' | tr '[:upper:]' '[:lower:]') - package_info=$(apt-cache policy $package_name) + package_info=$(apt-cache policy ${{ steps.package-infos.outputs.package_name }}) + do_not_build="false" if [[ -n $package_info ]]; then echo "Package already exists in the repository." candidate_version=$(echo "$package_info" | grep 'Candidate:' | awk '{print $2}') - if [[ "$candidate_version" == "${{ steps.package-version.outputs.package_version }}"* ]]; then + if [[ "$candidate_version" == "${{ steps.package-infos.outputs.package_version }}"* ]]; then echo "Package already exists in the repository with the same version." - exit 0 + do_not_build="true" fi fi + echo "do_not_build=$do_not_build" >> $GITHUB_OUTPUT shell: bash - - if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.use_dh_make_perl == 'false' }} + - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) && matrix.use_dh_make_perl == 'false' }} run: | if [ -z "${{ matrix.deb_dependencies }}" ]; then PACKAGE_DEPENDENCIES="" @@ -456,15 +459,15 @@ jobs: PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --no-auto-depends" fi - 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 }} + 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-infos.outputs.package_version }} ${{ matrix.name }} shell: bash - - if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.use_dh_make_perl == 'true' }} + - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) && matrix.use_dh_make_perl == 'true' }} run: | - 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 }} + DEB_BUILD_OPTIONS="nocheck nodocs notest" dh-make-perl make --dist ${{ matrix.distrib }} --build --version ${{ steps.package-infos.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) }} + - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) }} name: Replace '::' with - in the feature path id: package-name run: | @@ -474,7 +477,7 @@ jobs: echo "name_with_dash=$name_with_dash" >> $GITHUB_OUTPUT shell: bash - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) }} uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: packages-${{ matrix.package_extension }}-${{ matrix.distrib }}-${{ matrix.arch }}-${{ steps.package-name.outputs.name_with_dash}} @@ -568,7 +571,6 @@ jobs: image: ${{ matrix.image }} name: Test perl CPAN libs packages on ${{ matrix.package_extension }} ${{ matrix.distrib }} ${{ matrix.arch }} - steps: - if: ${{ matrix.package_extension == 'rpm' }} name: Install zstd, perl and Centreon repositories @@ -668,7 +670,7 @@ jobs: error_output=$(dpkg -i $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } echo "Package installation done." echo "Package uninstallation..." - error_output=$(apt autoremove --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } + error_output=$(apt autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } echo "Package uninstallation done." done # If the file error_log exists and is not empty, the workflow is in error diff --git a/.github/workflows/test-cpan-libraries.yml b/.github/workflows/test-cpan-libraries.yml index 6abf1f7974..2076c6a4aa 100644 --- a/.github/workflows/test-cpan-libraries.yml +++ b/.github/workflows/test-cpan-libraries.yml @@ -6,9 +6,9 @@ concurrency: on: workflow_dispatch: - pull_request: - paths: - - ".github/workflows/test-cpan-libraries.yml" +# pull_request: +# paths: +# - ".github/workflows/test-cpan-libraries.yml" jobs: get-environment: From 83bc15d8cd4cc700eb181d25225898a8ecb0b48b Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Mon, 30 Dec 2024 21:46:00 +0100 Subject: [PATCH 26/35] Add warning messages for existing libs in official debian repos --- .github/workflows/perl-cpan-libraries.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index aebadeee72..b3ac5e02d6 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -435,11 +435,13 @@ jobs: package_info=$(apt-cache policy ${{ steps.package-infos.outputs.package_name }}) do_not_build="false" if [[ -n $package_info ]]; then - echo "Package already exists in the repository." candidate_version=$(echo "$package_info" | grep 'Candidate:' | awk '{print $2}') if [[ "$candidate_version" == "${{ steps.package-infos.outputs.package_version }}"* ]]; then - echo "Package already exists in the repository with the same version." + echo "::warning::Package ${{ steps.package-infos.outputs.package_name }} already exists in the official ${{ matrix.distrib }} repository with the same version." do_not_build="true" + else + echo "::warning::Package ${{ steps.package-infos.outputs.package_name }} exists in the official ${{ matrix.distrib }} repository with a different version." + do_not_build="false" fi fi echo "do_not_build=$do_not_build" >> $GITHUB_OUTPUT @@ -454,11 +456,9 @@ jobs: PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --depends $PACKAGE_DEPENDENCY" done fi - if [ ! -z "${{ matrix.no-auto-depends }}" ]; then PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --no-auto-depends" fi - 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-infos.outputs.package_version }} ${{ matrix.name }} shell: bash From d643e3fbb4c08b2a932a0dbd5d39eb6adac34df6 Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Mon, 30 Dec 2024 21:56:46 +0100 Subject: [PATCH 27/35] Removing unnecessary debian libraries --- .github/workflows/perl-cpan-libraries.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index b3ac5e02d6..ef7614f11c 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -318,7 +318,6 @@ jobs: name: [ "ARGV::Struct", - "Authen::SCRAM::Client", "Config::AWS", "Convert::EBCDIC", "Crypt::Blowfish_PP", @@ -338,10 +337,8 @@ jobs: "Net::FTPSSL", "Net::HTTPTunnel", "Net::MQTT::Simple", - "Net::SMTP_auth", "Paws", "Statistics::Regression", - "WWW::Selenium", "ZMQ::Constants", "ZMQ::LibZMQ4" ] From 946321939b0f287e4079dbcff0571f29573bf2a9 Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Tue, 31 Dec 2024 16:05:10 +0100 Subject: [PATCH 28/35] Move installations in docker image + check package existence for rpms --- .../Dockerfile.packaging-plugins-alma8 | 14 ++++- .../Dockerfile.packaging-plugins-alma9 | 14 ++++- .github/workflows/perl-cpan-libraries.yml | 52 +++++++------------ 3 files changed, 45 insertions(+), 35 deletions(-) diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-alma8 b/.github/docker/packaging/Dockerfile.packaging-plugins-alma8 index e9fe67b494..c320444449 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-alma8 +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-alma8 @@ -10,10 +10,22 @@ baseurl=https://repo.goreleaser.com/yum/ enabled=1 gpgcheck=0' | tee /etc/yum.repos.d/goreleaser.repo -dnf -y install gcc git gettext rpm-build dos2unix python3 epel-release nfpm-2.41.0 openssl-devel jq zstd selinux-policy-devel +dnf -y install gcc git gettext rpm-build dos2unix python3 epel-release nfpm-2.41.0 openssl-devel jq zstd selinux-policy-devel yum-utils +dnf config-manager --set-enabled powertools dnf -y install perl-App-cpanminus perl-JSON cpanm App::FatPacker cpanm File::Copy::Recursive + +# For cpan libs +dnf install -y libcurl-devel libssh-devel expat-devel libuuid-devel zeromq-devel libxml2-devel libffi-devel perl-DBI perl-Net-Pcap freetds freetds-devel perl-Module-Build-Tiny +cpanm Module::Build::Tiny +cpanm Module::Install +# Install fpm (ruby 3 is required) +dnf module reset -y ruby +dnf module enable -y ruby:3.1 +dnf install -y ruby ruby-devel +gem install fpm + dnf clean all EOF diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-alma9 b/.github/docker/packaging/Dockerfile.packaging-plugins-alma9 index 23bd219eb5..18db17cdcb 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-alma9 +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-alma9 @@ -10,10 +10,22 @@ baseurl=https://repo.goreleaser.com/yum/ enabled=1 gpgcheck=0' | tee /etc/yum.repos.d/goreleaser.repo -dnf -y install gcc git gettext rpm-build dos2unix python3 epel-release nfpm-2.41.0 openssl-devel jq zstd selinux-policy-devel +dnf -y install gcc git gettext rpm-build dos2unix python3 epel-release nfpm-2.41.0 openssl-devel jq zstd selinux-policy-devel yum-utils +dnf config-manager --set-enabled crb dnf -y install perl-App-cpanminus perl-JSON cpanm App::FatPacker cpanm File::Copy::Recursive + +# For cpan libs +dnf install -y libcurl-devel libssh-devel expat-devel libuuid-devel zeromq-devel libxml2-devel libffi-devel perl-DBI perl-Net-Pcap freetds freetds-devel perl-Module-Build-Tiny +cpanm Module::Build::Tiny +cpanm Module::Install +# Install fpm (ruby 3 is required) +dnf module reset -y ruby +dnf module enable -y ruby:3.1 +dnf install -y ruby ruby-devel +gem install fpm + dnf clean all EOF diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index ef7614f11c..39450fc457 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -149,35 +149,25 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + name: Check if package already exists + id: check-package-existance run: | - yum install -y yum-utils epel-release git - yum config-manager --set-enabled crb || true # alma 9 - yum config-manager --set-enabled powertools || true # alma 8 - yum install -y cpanminus rpm-build libcurl-devel libssh-devel expat-devel gcc libuuid-devel zeromq-devel libxml2-devel libffi-devel perl-DBI perl-Net-Pcap freetds freetds-devel perl-Module-Build-Tiny - - dnf module reset -y ruby - dnf module enable -y ruby:3.1 - dnf install -y ruby ruby-devel - shell: bash - - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - repository: kduret/fpm - ref: fix-rpm-perl-dependency-name-unchanged - path: fpm - - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} - name: Build and install fpm # waiting https://github.com/jordansissel/fpm/pull/2066 - run: | - dnf install -y bsdtar - cd fpm - gem install bundler - bundle install - make install + package_info=$(dnf provides 'perl(${{ matrix.name }})' 2>&1 || true) + do_not_build="false" + if [[ ! $package_info =~ "No Matches found" ]]; then + package_version=$(echo $package_info | grep -oP 'perl\(${{ matrix.name }}\) = \K[0-9]+\.[0-9]+') + if [[ -z "${{ matrix.version }}" || "$package_version" == "${{ matrix.version }}" ]]; then + echo "::warning::Package ${{ matrix.name }} already exists in the official ${{ matrix.distrib }} repository with the same version." + do_not_build="true" + else + echo "::warning::Package ${{ matrix.name }} exists in the official ${{ matrix.distrib }} repository with a different version." + do_not_build="false" + fi + fi + echo "do_not_build=$do_not_build" >> $GITHUB_OUTPUT shell: bash - - if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file == '' }} + - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file == '' }} run: | if [ -z "${{ matrix.version }}" ]; then PACKAGE_VERSION="" @@ -205,15 +195,12 @@ jobs: done fi - cpanm Module::Build::Tiny - cpanm Module::Install - export SYBASE="/usr" fpm -s cpan -t ${{ matrix.package_extension }} --rpm-dist ${{ matrix.distrib }} --verbose --cpan-verbose --no-cpan-test$PACKAGE_DEPENDENCIES$PACKAGE_PROVIDES$PACKAGE_VERSION ${{ matrix.name }} shell: bash - - if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file != '' }} + - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file != '' }} run: | mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} @@ -222,7 +209,7 @@ jobs: cp -r ~/rpmbuild/RPMS/noarch/*.rpm . shell: bash - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) }} name: Replace '::' with - in the feature path id: package-name run: | @@ -232,7 +219,7 @@ jobs: echo "name_with_dash=$name_with_dash" >> $GITHUB_OUTPUT shell: bash - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) }} uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: packages-${{ matrix.package_extension }}-${{ matrix.distrib }}-${{ steps.package-name.outputs.name_with_dash }} @@ -350,7 +337,6 @@ jobs: - rpm_provides: "" - version: "" - use_dh_make_perl: "true" - - spec_file: "" - distrib: bullseye package_extension: deb image: packaging-plugins-bullseye From c38ade546b84d2042a509e6427a898322d8d373d Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Tue, 31 Dec 2024 17:17:11 +0100 Subject: [PATCH 29/35] fix for el9 --- .github/workflows/perl-cpan-libraries.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 39450fc457..a634678bba 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -152,9 +152,9 @@ jobs: name: Check if package already exists id: check-package-existance run: | - package_info=$(dnf provides 'perl(${{ matrix.name }})' 2>&1 || true) + package_info=$(dnf provides 'perl(${{ matrix.name }})' 2>&1 | tr '[:upper:]' '[:lower:]' || true) do_not_build="false" - if [[ ! $package_info =~ "No Matches found" ]]; then + if [[ ! $package_info =~ "no matches found" ]]; then package_version=$(echo $package_info | grep -oP 'perl\(${{ matrix.name }}\) = \K[0-9]+\.[0-9]+') if [[ -z "${{ matrix.version }}" || "$package_version" == "${{ matrix.version }}" ]]; then echo "::warning::Package ${{ matrix.name }} already exists in the official ${{ matrix.distrib }} repository with the same version." From 3f1bd2fd315353c9d187c4d2f2cf23a563ca097f Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Tue, 31 Dec 2024 17:52:37 +0100 Subject: [PATCH 30/35] update --- .github/workflows/perl-cpan-libraries.yml | 20 +- .github/workflows/test-cpan-libraries.yml | 709 ---------------------- 2 files changed, 10 insertions(+), 719 deletions(-) delete mode 100644 .github/workflows/test-cpan-libraries.yml diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index a634678bba..7a3e2b22a2 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -150,7 +150,7 @@ jobs: - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} name: Check if package already exists - id: check-package-existance + id: check-package-existence run: | package_info=$(dnf provides 'perl(${{ matrix.name }})' 2>&1 | tr '[:upper:]' '[:lower:]' || true) do_not_build="false" @@ -167,7 +167,7 @@ jobs: echo "do_not_build=$do_not_build" >> $GITHUB_OUTPUT shell: bash - - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file == '' }} + - if: ${{ steps.check-package-existence.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file == '' }} run: | if [ -z "${{ matrix.version }}" ]; then PACKAGE_VERSION="" @@ -200,7 +200,7 @@ jobs: fpm -s cpan -t ${{ matrix.package_extension }} --rpm-dist ${{ matrix.distrib }} --verbose --cpan-verbose --no-cpan-test$PACKAGE_DEPENDENCIES$PACKAGE_PROVIDES$PACKAGE_VERSION ${{ matrix.name }} shell: bash - - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file != '' }} + - if: ${{ steps.check-package-existence.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file != '' }} run: | mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} @@ -209,7 +209,7 @@ jobs: cp -r ~/rpmbuild/RPMS/noarch/*.rpm . shell: bash - - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) }} + - if: ${{ steps.check-package-existence.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) }} name: Replace '::' with - in the feature path id: package-name run: | @@ -219,7 +219,7 @@ jobs: echo "name_with_dash=$name_with_dash" >> $GITHUB_OUTPUT shell: bash - - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) }} + - if: ${{ steps.check-package-existence.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) }} uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: packages-${{ matrix.package_extension }}-${{ matrix.distrib }}-${{ steps.package-name.outputs.name_with_dash }} @@ -413,7 +413,7 @@ jobs: - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} name: Check if package already exists - id: check-package-existance + id: check-package-existence run: | package_info=$(apt-cache policy ${{ steps.package-infos.outputs.package_name }}) do_not_build="false" @@ -430,7 +430,7 @@ jobs: echo "do_not_build=$do_not_build" >> $GITHUB_OUTPUT shell: bash - - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) && matrix.use_dh_make_perl == 'false' }} + - if: ${{ steps.check-package-existence.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) && matrix.use_dh_make_perl == 'false' }} run: | if [ -z "${{ matrix.deb_dependencies }}" ]; then PACKAGE_DEPENDENCIES="" @@ -445,12 +445,12 @@ jobs: 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-infos.outputs.package_version }} ${{ matrix.name }} shell: bash - - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) && matrix.use_dh_make_perl == 'true' }} + - if: ${{ steps.check-package-existence.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) && matrix.use_dh_make_perl == 'true' }} run: | DEB_BUILD_OPTIONS="nocheck nodocs notest" dh-make-perl make --dist ${{ matrix.distrib }} --build --version ${{ steps.package-infos.outputs.package_version }}${{ steps.parse-distrib.outputs.package_distrib_separator }}${{ steps.parse-distrib.outputs.package_distrib_name }} --cpan ${{ matrix.name }} shell: bash - - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) }} + - if: ${{ steps.check-package-existence.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) }} name: Replace '::' with - in the feature path id: package-name run: | @@ -460,7 +460,7 @@ jobs: echo "name_with_dash=$name_with_dash" >> $GITHUB_OUTPUT shell: bash - - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) }} + - if: ${{ steps.check-package-existence.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) }} uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: packages-${{ matrix.package_extension }}-${{ matrix.distrib }}-${{ matrix.arch }}-${{ steps.package-name.outputs.name_with_dash}} diff --git a/.github/workflows/test-cpan-libraries.yml b/.github/workflows/test-cpan-libraries.yml deleted file mode 100644 index 2076c6a4aa..0000000000 --- a/.github/workflows/test-cpan-libraries.yml +++ /dev/null @@ -1,709 +0,0 @@ -name: test-cpan-libraries - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -on: - workflow_dispatch: -# pull_request: -# paths: -# - ".github/workflows/test-cpan-libraries.yml" - -jobs: - get-environment: - uses: ./.github/workflows/get-environment.yml - - package-rpm: - needs: [get-environment] - if: | - needs.get-environment.outputs.skip_workflow == 'false' && - needs.get-environment.outputs.stability != 'stable' - - runs-on: ubuntu-24.04 - strategy: - fail-fast: false - matrix: - distrib: [el8, el9] - name: - [ - "ARGV::Struct", - "Authen::SASL::SASLprep", - "Authen::SCRAM::Client", - "BSON", - "BSON::XS", - "Config::AWS", - "Convert::Binary::C", - "Convert::EBCDIC", - "Crypt::Blowfish_PP", - "Crypt::OpenSSL::AES", - "DataStruct::Flat", - "DateTime::Format::Duration::ISO8601", - "DBD::Sybase", - "Device::Modbus", - "Device::Modbus::RTU::Client", - "Device::Modbus::TCP::Client", - "Email::Send::SMTP::Gmail", - "FFI::CheckLib", - "FFI::Platypus", - "File::SearchPath", - "HTTP::ProxyPAC", - "JMX::Jmx4Perl", - "Mojo::IOLoop::Signal", - "MongoDB", - "MooseX::ClassAttribute", - "Net::Amazon::Signature::V4", - "Net::DHCP", - "Net::FTPSSL", - "Net::HTTPTunnel", - "Net::NTP", - "Net::SMTPS", - "Net::SMTP_auth", - "Net::Subnet", - "Net::TFTP", - "Paws", - "PBKDF2::Tiny", - "Statistics::Descriptive", - "Statistics::Regression", - "Term::Clui", - "Unicode::Stringprep", - "URI::Template", - "URL::Encode", - "URL::Encode::XS", - "UUID", - "UUID::URandom", - "WWW::Selenium", - "XML::LibXML::Simple", - "ZMQ::Constants", - "ZMQ::FFI", - "ZMQ::LibZMQ4" - ] - include: - - build_distribs: "el8,el9" - - rpm_dependencies: "" - - rpm_provides: "" - - version: "" - - no-auto-depends: false - - distrib: el8 - package_extension: rpm - image: packaging-plugins-alma8 - - distrib: el9 - package_extension: rpm - image: packaging-plugins-alma9 - - name: "BSON" - rpm_provides: "perl(BSON::Bytes) perl(BSON::Code) perl(BSON::DBRef) perl(BSON::OID) perl(BSON::Raw) perl(BSON::Regex) perl(BSON::Time) perl(BSON::Timestamp) perl(BSON::Types) perl(BSON)" - - name: "DateTime::Format::Duration::ISO8601" - rpm_provides: "perl(DateTime-Format-Duration-ISO8601)" - - name: "Device::Modbus::RTU::Client" - version: "0.022" - - name: "Device::Modbus::TCP::Client" - version: "0.026" - - name: "FFI::CheckLib" - rpm_dependencies: "perl(Env)" - - name: "FFI::Platypus" - rpm_provides: "perl(FFI::Platypus::Buffer) perl(FFI::Platypus::Memory)" - rpm_dependencies: "perl(Capture::Tiny) perl(FFI::CheckLib) perl(File::Spec::Functions) perl(IPC::Cmd) perl(JSON::PP) perl(List::Util) perl(autodie) perl(constant) perl(parent)" - no-auto-depends: true - - name: "Mojo::IOLoop::Signal" - rpm_dependencies: "perl-Mojolicious" - rpm_provides: "perl(Mojo::IOLoop::Signal)" - no-auto-depends: true - - name: "Net::DHCP" - rpm_provides: "perl(Net::DHCP::Constants) perl(Net::DHCP::Packet)" - - name: "Net::SMTPS" - build_distribs: el9 - - name: "Statistics::Descriptive" - build_distribs: el9 - - name: "Statistics::Regression" - version: "0.53" - - name: "URL::Encode::XS" - build_distribs: el9 - - name: "UUID" - version: "0.31" - - name: "ZMQ::Constants" - build_distribs: "el9" - - name: "ZMQ::FFI" - rpm_dependencies: "zeromq" - - name: "ZMQ::LibZMQ4" - version: "0.01" - rpm_dependencies: "zeromq" - - name: package ${{ matrix.distrib }} ${{ matrix.name }} - container: - image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest - credentials: - username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }} - password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }} - - steps: - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} - run: | - yum install -y yum-utils epel-release git - yum config-manager --set-enabled crb || true # alma 9 - yum config-manager --set-enabled powertools || true # alma 8 - yum install -y cpanminus rpm-build libcurl-devel libssh-devel expat-devel gcc libuuid-devel zeromq-devel libxml2-devel libffi-devel perl-DBI perl-Net-Pcap freetds freetds-devel perl-Module-Build-Tiny - - dnf module reset -y ruby - dnf module enable -y ruby:3.1 - dnf install -y ruby ruby-devel - shell: bash - - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - repository: kduret/fpm - ref: fix-rpm-perl-dependency-name-unchanged - path: fpm - - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} - name: Build and install fpm # waiting https://github.com/jordansissel/fpm/pull/2066 - run: | - dnf install -y bsdtar - cd fpm - gem install bundler - bundle install - make install - shell: bash - - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} - run: | - if [ -z "${{ matrix.version }}" ]; then - PACKAGE_VERSION="" - else - PACKAGE_VERSION=" -v ${{ matrix.version }}" - fi - - if [ -z "${{ matrix.rpm_dependencies }}" ]; then - PACKAGE_DEPENDENCIES="" - else - for PACKAGE_DEPENDENCY in `echo "${{ matrix.rpm_dependencies }}"`; do - PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --depends "$PACKAGE_DEPENDENCY"" - done - fi - - if [ ! -z "${{ matrix.no-auto-depends }}" ]; then - PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --no-auto-depends" - fi - - if [ -z "${{ matrix.rpm_provides }}" ]; then - PACKAGE_PROVIDES="" - else - for PACKAGE_PROVIDE in `echo "${{ matrix.rpm_provides }}"`; do - PACKAGE_PROVIDES="$PACKAGE_PROVIDES --provides $PACKAGE_PROVIDE" - done - fi - - cpanm Module::Build::Tiny - cpanm Module::Install - - export SYBASE="/usr" - - fpm -s cpan -t ${{ matrix.package_extension }} --rpm-dist ${{ matrix.distrib }} --verbose --cpan-verbose --no-cpan-test$PACKAGE_DEPENDENCIES$PACKAGE_PROVIDES$PACKAGE_VERSION ${{ matrix.name }} - shell: bash - - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} - name: Replace '::' with - in the feature path - id: package-name - run: | - name="${{ matrix.name }}" - name_with_dash="${name//::/-}" - echo "Modified Name: $name_with_dash" - echo "name_with_dash=$name_with_dash" >> $GITHUB_OUTPUT - shell: bash - - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: packages-${{ matrix.package_extension }}-${{ matrix.distrib }}-${{ steps.package-name.outputs.name_with_dash }} - path: ./*.${{ matrix.package_extension }} - retention-days: 1 - - merge-package-rpm-artifacts: - needs: [get-environment, package-rpm] - if: | - needs.get-environment.outputs.skip_workflow == 'false' && - needs.get-environment.outputs.stability != 'stable' - runs-on: ubuntu-24.04 - strategy: - matrix: - distrib: [el8, el9] - - steps: - - name: Merge Artifacts - uses: actions/upload-artifact/merge@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: packages-rpm-${{ matrix.distrib }} - pattern: packages-rpm-${{ matrix.distrib }}-* - delete-merged: false # cannot be set to true due to random fails: Failed to DeleteArtifact: Unable to make request: ECONNRESET - retention-days: 1 - - - name: Delete merged artifacts - uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5.1.0 - with: - name: packages-rpm-${{ matrix.distrib }}-* - failOnError: false - - sign-rpm: - needs: [get-environment, merge-package-rpm-artifacts] - if: | - needs.get-environment.outputs.skip_workflow == 'false' && - needs.get-environment.outputs.stability != 'stable' - - runs-on: ubuntu-24.04 - strategy: - matrix: - distrib: [el8, el9] - name: sign rpm ${{ matrix.distrib }} - container: - image: docker.centreon.com/centreon-private/rpm-signing:latest - options: -t - credentials: - username: ${{ secrets.HARBOR_RPM_GPG_SIGNING_REPO_USERNAME }} - password: ${{ secrets.HARBOR_RPM_GPG_SIGNING_REPO_TOKEN }} - - steps: - - run: apt-get install -y zstd - shell: bash - - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: packages-rpm-${{ matrix.distrib }} - path: ./ - - - run: echo "HOME=/root" >> $GITHUB_ENV - shell: bash - - - run: rpmsign --addsign ./*.rpm - shell: bash - - - uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 - with: - path: ./*.rpm - key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }} - - package-deb: - needs: [get-environment] - if: | - needs.get-environment.outputs.skip_workflow == 'false' && - needs.get-environment.outputs.stability != 'stable' - - runs-on: ${{ matrix.runner_name }} - strategy: - fail-fast: false - matrix: - image: [packaging-plugins-bullseye, packaging-plugins-bookworm, packaging-plugins-jammy, packaging-plugins-bullseye-arm64] - name: - [ - "ARGV::Struct", - "Authen::SCRAM::Client", - "Config::AWS", - "Convert::EBCDIC", - "Crypt::Blowfish_PP", - "Crypt::OpenSSL::AES", - "DataStruct::Flat", - "DateTime::Format::Duration::ISO8601", - "Device::Modbus", - "Device::Modbus::RTU::Client", - "Device::Modbus::TCP::Client", - "Digest::SHA1", - "Email::Send::SMTP::Gmail", - "Hash::Ordered", - "HTTP::ProxyPAC", - "JMX::Jmx4Perl", - "Mojo::IOLoop::Signal", - "Net::Amazon::Signature::V4", - "Net::FTPSSL", - "Net::HTTPTunnel", - "Net::MQTT::Simple", - "Net::SMTP_auth", - "Paws", - "Statistics::Regression", - "WWW::Selenium", - "ZMQ::Constants", - "ZMQ::LibZMQ4" - ] - include: - - runner_name: ubuntu-24.04 - - arch: amd64 - - build_distribs: "bullseye,bookworm,jammy" - - deb_dependencies: "" - - rpm_provides: "" - - version: "" - - distrib: bullseye - package_extension: deb - image: packaging-plugins-bullseye - - distrib: bookworm - package_extension: deb - image: packaging-plugins-bookworm - - distrib: jammy - package_extension: deb - image: packaging-plugins-jammy - - distrib: bullseye - package_extension: deb - image: packaging-plugins-bullseye-arm64 - arch: arm64 - runner_name: ["self-hosted", "collect-arm64"] - - name: "Device::Modbus::RTU::Client" - build_distribs: "bookworm" - - name: "Device::Modbus::TCP::Client" - build_distribs: "bookworm" - - name: "Digest::SHA1" - build_distribs: "jammy" - - name: "Net::Amazon::Signature::V4" - build_distribs: ["bullseye", "jammy"] - - name: "Net::MQTT::Simple" - version: "1.29" - - name: "Paws" - deb_dependencies: "libmoose-perl libmoosex-classattribute-perl libjson-maybexs-perl liburl-encode-perl libargv-struct-perl libmoo-perl libtype-tiny-perl libdatastruct-flat-perl libmodule-find-perl libthrowable-perl liburi-template-perl libnet-amazon-signature-v4-perl" - no-auto-depends: true - - name: "Statistics::Regression" - build_distribs: "bullseye" - version: "0.53" - - name: "WWW::Selenium" - deb_dependencies: "libcarp-always-perl libdata-dumper-compact-perl libexporter-tiny-perl libhttp-headers-fast-perl libhttp-request-ascgi-perl libio-socket-ssl-perl liblwp-useragent-determined-perl libtest-simple-perl libtest-more-utf8-perl liburi-escape-xs-perl libclass-base-perl" - - name: "ZMQ::LibZMQ4" - version: "0.01" - deb_dependencies: "libzmq5" - name: package ${{ matrix.distrib }} ${{ matrix.arch }} ${{ matrix.name }} - container: - image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest - credentials: - username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }} - password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }} - - steps: - - 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 - run: | - cpan_info=$(cpanm --info ${{ matrix.name }}) - if [ -z "${{ matrix.version }}" ]; then - CPAN_PACKAGE_VERSION=$(echo $cpan_info | sed 's/\.tar\.gz$//' | sed 's/.*\-//' | sed 's/v//') - if [[ ! $CPAN_PACKAGE_VERSION =~ ^[0-9]+\.[0-9]+ ]]; then - echo "::error::Invalid version number: ${CPAN_PACKAGE_VERSION}" - exit 1 - fi - PACKAGE_VERSION="${CPAN_PACKAGE_VERSION}" - else - PACKAGE_VERSION="${{ matrix.version }}" - fi - echo "package_version=$(echo $PACKAGE_VERSION)" >> $GITHUB_OUTPUT - CPAN_PACKAGE_NAME=$(echo $cpan_info | sed 's/.*\///g' | sed 's/-[0-9\.]*\.tar\.gz//g' | tr '[:upper:]' '[:lower:]') - PACKAGE_NAME="lib$CPAN_PACKAGE_NAME-perl" - echo "package_name=$(echo $PACKAGE_NAME)" >> $GITHUB_OUTPUT - shell: bash - - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} - name: Check if package already exists - id: check-package-existance - run: | - package_info=$(apt-cache policy ${{ steps.package-version.outputs.package_name }}) - do_not_build="false" - if [[ -n $package_info ]]; then - echo "Package already exists in the repository." - candidate_version=$(echo "$package_info" | grep 'Candidate:' | awk '{print $2}') - if [[ "$candidate_version" == "${{ steps.package-version.outputs.package_version }}"* ]]; then - echo "Package already exists in the repository with the same version." - do_not_build="true" - fi - fi - echo "do_not_build=$do_not_build" >> $GITHUB_OUTPUT - shell: bash - - - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) }} - run: | - if [ -z "${{ matrix.deb_dependencies }}" ]; then - PACKAGE_DEPENDENCIES="" - else - for PACKAGE_DEPENDENCY in `echo ${{ matrix.deb_dependencies }}`; do - PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --depends $PACKAGE_DEPENDENCY" - done - fi - - if [ ! -z "${{ matrix.no-auto-depends }}" ]; then - PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --no-auto-depends" - fi - - # 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 ${{ 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: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) }} - name: Replace '::' with - in the feature path - id: package-name - run: | - name="${{ matrix.name }}" - name_with_dash="${name//::/-}" - echo "Modified Name: $name_with_dash" - echo "name_with_dash=$name_with_dash" >> $GITHUB_OUTPUT - shell: bash - - - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) }} - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: packages-${{ matrix.package_extension }}-${{ matrix.distrib }}-${{ matrix.arch }}-${{ steps.package-name.outputs.name_with_dash}} - path: ./*.${{ matrix.package_extension }} - retention-days: 1 - - merge-package-deb-artifacts: - needs: [get-environment, package-deb] - if: | - needs.get-environment.outputs.skip_workflow == 'false' && - needs.get-environment.outputs.stability != 'stable' - runs-on: ubuntu-24.04 - strategy: - matrix: - distrib: [bullseye, bookworm, jammy] - - steps: - - name: Merge Artifacts - uses: actions/upload-artifact/merge@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: packages-deb-${{ matrix.distrib }} - pattern: packages-deb-${{ matrix.distrib }}-* - delete-merged: false # cannot be set to true due to random fails: Failed to DeleteArtifact: Unable to make request: ECONNRESET - retention-days: 1 - - - name: Delete merged artifacts - uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5.1.0 - with: - name: packages-deb-${{ matrix.distrib }}-* - failOnError: false - - download-and-cache-deb: - needs: [get-environment, merge-package-deb-artifacts] - if: | - needs.get-environment.outputs.skip_workflow == 'false' && - needs.get-environment.outputs.stability != 'stable' - runs-on: ubuntu-24.04 - strategy: - matrix: - distrib: [bullseye, bookworm, jammy] - steps: - - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: packages-deb-${{ matrix.distrib }} - path: ./ - - - uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 - with: - path: ./*.deb - key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.distrib }} - - test-packages: - needs: [get-environment, sign-rpm, download-and-cache-deb] - strategy: - fail-fast: false - matrix: - include: - - package_extension: rpm - image: almalinux:8 - distrib: el8 - arch: amd64 - runner_name: ubuntu-24.04 - - package_extension: rpm - image: almalinux:9 - distrib: el9 - arch: amd64 - runner_name: ubuntu-24.04 - - package_extension: deb - image: debian:bullseye - distrib: bullseye - arch: amd64 - runner_name: ubuntu-24.04 - - package_extension: deb - image: debian:bookworm - distrib: bookworm - arch: amd64 - runner_name: ubuntu-24.04 - - package_extension: deb - image: ubuntu:jammy - distrib: jammy - arch: amd64 - runner_name: ubuntu-24.04 - - package_extension: deb - image: arm64v8/debian:bullseye - distrib: bullseye - arch: arm64 - runner_name: ["self-hosted", "collect-arm64"] - - runs-on: ${{ matrix.runner_name }} - container: - image: ${{ matrix.image }} - - name: Test perl CPAN libs packages on ${{ matrix.package_extension }} ${{ matrix.distrib }} ${{ matrix.arch }} - steps: - - if: ${{ matrix.package_extension == 'rpm' }} - name: Install zstd, perl and Centreon repositories - run: | - dnf install -y zstd perl epel-release 'dnf-command(config-manager)' - dnf config-manager --set-enabled powertools || true # alma 8 - dnf config-manager --set-enabled crb || true # alma 9 - # Import Centreon GPG key - GPG_KEY_URL="https://yum-gpg.centreon.com/RPM-GPG-KEY-CES" - curl -sSL $GPG_KEY_URL -o RPM-GPG-KEY-CES - rpm --import RPM-GPG-KEY-CES - shell: bash - - if: ${{ matrix.package_extension == 'deb' }} - name: Install zstd, perl and Centreon repositories - run: | - export DEBIAN_FRONTEND=noninteractive - apt-get update - apt-get install -y zstd perl wget gpg apt-utils procps - wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1 - apt-get update - shell: bash - - name: Restore packages from cache - uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 - with: - path: ./*.${{ matrix.package_extension }} - key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} - fail-on-cache-miss: true - - if: ${{ matrix.package_extension == 'rpm' }} - name: Install packages - run: | - error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" - for package in ./*.rpm; do - echo "Installing package: $package" - # List dependencies, and remove version and comparison operators - dependencies=$(rpm -qpR $package | sed 's/ [0-9.-]*\(\s\|$\)/ /g' | sed 's/ [<>!=]*\(\s\|$\)/ /g') - for dependency in $dependencies; do - # Skip non-perl dependencies - if [[ $dependency != perl* ]]; then - continue - else - echo "Check dependency: $dependency" - # Update the dependency name to match the package name - dependency=$(echo $dependency | sed 's/(/-/g' | sed 's/)//g' | sed 's/::/-/g') - fi - # If the dependency has been built in the same workflow, install it - if [[ -n $(find . -maxdepth 1 -regex "\.\/$dependency-[0-9v].*\.rpm") ]]; then - echo "Installing dependency: $dependency" - error_output=$(dnf install -y ./$dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } - fi - done - # Install package, then uninstall it with all his dependencies - echo "Package installation..." - error_output=$(dnf install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } - echo "Package installation done." - echo "Package uninstallation..." - error_output=$(dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } - echo "Package uninstallation done." - done - # If the file error_log exists and is not empty, the workflow is in error - if [[ -s $error_log ]]; then - cat $error_log - exit 1 - fi - shell: bash - - if: ${{ matrix.package_extension == 'deb' }} - name: Install packages - run: | - error_log="install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log" - for package in ./*.deb; do - # If the debian package name ends with amd64 or arm64, we only install it if the tested architecture is the same, otherwise we skip it - if [[ $package == *amd64.deb && ${{ matrix.arch }} != "amd64" || $package == *arm64.deb && ${{ matrix.arch }} != "arm64" ]]; then - continue - fi - echo "Installing package: $package" - # List dependencies - dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //' | sed 's/,//g' | sed 's/(\(.*\)//g') || { echo "$error_output" >> $error_log; echo "Error while listing dependencies of the package $package" >> $error_log; true; } - for dependency in $dependencies; do - # If the dependency exists in the Debian repository, don't check the local dependencies - dependency_info=$(apt-cache policy $dependency) - if [[ -n $dependency_info ]]; then - echo "Dependency $dependency exists in debian repository." - continue - else - # If the dependency has been built in the same workflow, install it - for dependency_package in $(find . -maxdepth 1 -regex "\.\/${dependency}_[0-9].*all\.deb" -o -regex "\.\/${dependency}_[0-9].*${{ matrix.arch }}\.deb"); do - echo "Installing dependency: $dependency_package" - error_output=$(apt-get install -y ./$dependency_package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } - done - fi - done - # Install package, then uninstall it with all his dependencies - echo "Package installation..." - error_output=$(apt-get install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } - echo "Package installation done." - echo "Package uninstallation..." - error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } - echo "Package uninstallation done." - done - # If the file error_log exists and is not empty, the workflow is in error - if [[ -s $error_log ]]; then - cat $error_log - exit 1 - fi - shell: bash - - name: Upload error log - if: failure() - uses: actions/upload-artifact@v4 - with: - name: install_error_log_${{ matrix.distrib }}-${{ matrix.arch }} - path: install_error_${{ matrix.distrib }}_${{ matrix.arch }}.log - - deliver-packages: - needs: [get-environment, sign-rpm, download-and-cache-deb, test-packages] - if: | - needs.get-environment.outputs.skip_workflow == 'false' && - (contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) || ( needs.get-environment.outputs.stability == 'stable' && github.event_name != 'workflow_dispatch')) && - ! cancelled() && - ! contains(needs.*.result, 'failure') && - ! contains(needs.*.result, 'cancelled') - runs-on: ubuntu-24.04 - strategy: - fail-fast: false - matrix: - include: - - distrib: el8 - package_extension: rpm - - distrib: el9 - package_extension: rpm - - distrib: bullseye - package_extension: deb - - distrib: bookworm - package_extension: deb - - distrib: jammy - package_extension: deb - - name: deliver ${{ matrix.distrib }} - steps: - - name: Checkout sources - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Delivery - uses: ./.github/actions/package-delivery - with: - module_name: perl-cpan-libraries - distrib: ${{ matrix.distrib }} - cache_key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} - stability: ${{ needs.get-environment.outputs.stability }} - release_type: ${{ needs.get-environment.outputs.release_type }} - artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} - - set-skip-label: - needs: [get-environment, deliver-packages] - if: | - needs.get-environment.outputs.skip_workflow == 'false' && - ! cancelled() && - ! contains(needs.*.result, 'failure') && - ! contains(needs.*.result, 'cancelled') - uses: ./.github/workflows/set-pull-request-skip-label.yml From 771fc2a1959478d30c58a7c5c03c0d7dba00aaf5 Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Thu, 2 Jan 2025 12:05:18 +0100 Subject: [PATCH 31/35] Update for CPAN libs names with '_' --- .github/workflows/perl-cpan-libraries.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 7a3e2b22a2..8e84881b3d 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -416,6 +416,9 @@ jobs: id: check-package-existence run: | package_info=$(apt-cache policy ${{ steps.package-infos.outputs.package_name }}) + if [[ -n $package_info && ${{ steps.package-infos.outputs.package_name }} ~= _ ]]; then + package_info=$(apt-cache policy $(echo ${{ steps.package-infos.outputs.package_name }} | sed 's/_//g')) + fi do_not_build="false" if [[ -n $package_info ]]; then candidate_version=$(echo "$package_info" | grep 'Candidate:' | awk '{print $2}') From 818b1966e172b0b8e1fc0d5ff1b45ea058ad2e4f Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Thu, 2 Jan 2025 15:23:54 +0100 Subject: [PATCH 32/35] fix condition --- .github/workflows/perl-cpan-libraries.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 8e84881b3d..081dfb616a 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -416,7 +416,7 @@ jobs: id: check-package-existence run: | package_info=$(apt-cache policy ${{ steps.package-infos.outputs.package_name }}) - if [[ -n $package_info && ${{ steps.package-infos.outputs.package_name }} ~= _ ]]; then + if [[ -n $package_info && "${{ steps.package-infos.outputs.package_name }}" =~ "_" ]]; then package_info=$(apt-cache policy $(echo ${{ steps.package-infos.outputs.package_name }} | sed 's/_//g')) fi do_not_build="false" From c275b2549719405da340501384e71a2d8625161a Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Fri, 3 Jan 2025 17:18:26 +0100 Subject: [PATCH 33/35] Add a package test just after his creation --- .../packaging/Dockerfile.packaging-plugins-alma8 | 2 +- .../packaging/Dockerfile.packaging-plugins-alma9 | 2 +- .../Dockerfile.packaging-plugins-bookworm | 6 ++++++ .../Dockerfile.packaging-plugins-bullseye | 4 ++++ .../packaging/Dockerfile.packaging-plugins-jammy | 4 ++++ .github/workflows/perl-cpan-libraries.yml | 16 +++++++++++++--- 6 files changed, 29 insertions(+), 5 deletions(-) diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-alma8 b/.github/docker/packaging/Dockerfile.packaging-plugins-alma8 index c320444449..620a7b3cc3 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-alma8 +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-alma8 @@ -17,7 +17,7 @@ cpanm App::FatPacker cpanm File::Copy::Recursive # For cpan libs -dnf install -y libcurl-devel libssh-devel expat-devel libuuid-devel zeromq-devel libxml2-devel libffi-devel perl-DBI perl-Net-Pcap freetds freetds-devel perl-Module-Build-Tiny +dnf install -y cpio libcurl-devel libssh-devel expat-devel libuuid-devel zeromq-devel libxml2-devel libffi-devel perl-DBI perl-Net-Pcap freetds freetds-devel perl-Module-Build-Tiny cpanm Module::Build::Tiny cpanm Module::Install # Install fpm (ruby 3 is required) diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-alma9 b/.github/docker/packaging/Dockerfile.packaging-plugins-alma9 index 18db17cdcb..a3086c8181 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-alma9 +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-alma9 @@ -17,7 +17,7 @@ cpanm App::FatPacker cpanm File::Copy::Recursive # For cpan libs -dnf install -y libcurl-devel libssh-devel expat-devel libuuid-devel zeromq-devel libxml2-devel libffi-devel perl-DBI perl-Net-Pcap freetds freetds-devel perl-Module-Build-Tiny +dnf install -y cpio libcurl-devel libssh-devel expat-devel libuuid-devel zeromq-devel libxml2-devel libffi-devel perl-DBI perl-Net-Pcap freetds freetds-devel perl-Module-Build-Tiny cpanm Module::Build::Tiny cpanm Module::Install # Install fpm (ruby 3 is required) diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-bookworm b/.github/docker/packaging/Dockerfile.packaging-plugins-bookworm index 9b7f90b073..ec18679707 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-bookworm +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-bookworm @@ -55,6 +55,8 @@ apt-get install -y \ cpanm Module::Build::Tiny cpanm Module::Install +cpanm Crypt::OpenSSL::Guess + gem install fpm echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list @@ -64,3 +66,7 @@ apt-get install -y nfpm=2.41.0 apt-get clean EOF + +COPY .github/patch/fpm-deb.rb.diff /tmp/fpm-deb.rb.diff +# Patch to apply fpm fix for debian package generation while waiting for the official fix to be released (https://github.com/jordansissel/fpm/pull/1947). +RUN patch -i /tmp/fpm-deb.rb.diff $(find / -type f -name "deb.rb") diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-bullseye b/.github/docker/packaging/Dockerfile.packaging-plugins-bullseye index 1acb04043c..2d18a5e331 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-bullseye +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-bullseye @@ -64,3 +64,7 @@ apt-get install -y nfpm=2.41.0 apt-get clean EOF + +COPY .github/patch/fpm-deb.rb.diff /tmp/fpm-deb.rb.diff +# Patch to apply fpm fix for debian package generation while waiting for the official fix to be released (https://github.com/jordansissel/fpm/pull/1947). +RUN patch -i /tmp/fpm-deb.rb.diff $(find / -type f -name "deb.rb") diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-jammy b/.github/docker/packaging/Dockerfile.packaging-plugins-jammy index ddd4f993b8..8133e7c779 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-jammy +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-jammy @@ -66,3 +66,7 @@ apt-get install -y nfpm=2.41.0 apt-get clean EOF + +COPY .github/patch/fpm-deb.rb.diff /tmp/fpm-deb.rb.diff +# Patch to apply fpm fix for debian package generation while waiting for the official fix to be released (https://github.com/jordansissel/fpm/pull/1947). +RUN patch -i /tmp/fpm-deb.rb.diff $(find / -type f -name "deb.rb") diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 081dfb616a..5e9ab1f7ed 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -197,7 +197,10 @@ jobs: export SYBASE="/usr" - fpm -s cpan -t ${{ matrix.package_extension }} --rpm-dist ${{ matrix.distrib }} --verbose --cpan-verbose --no-cpan-test$PACKAGE_DEPENDENCIES$PACKAGE_PROVIDES$PACKAGE_VERSION ${{ matrix.name }} + temp_file=$(mktemp) + created_package=$(fpm -s cpan -t ${{ matrix.package_extension }} --rpm-dist ${{ matrix.distrib }} --verbose --cpan-verbose --no-cpan-test$PACKAGE_DEPENDENCIES$PACKAGE_PROVIDES$PACKAGE_VERSION ${{ matrix.name }} | tee "$temp_file" | grep "Created package" | grep -oP '(?<=:path=>").*?(?=")') + # Check rpm + rpm2cpio $created_package | cpio -t shell: bash - if: ${{ steps.check-package-existence.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file != '' }} @@ -445,12 +448,19 @@ jobs: if [ ! -z "${{ matrix.no-auto-depends }}" ]; then PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --no-auto-depends" fi - 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-infos.outputs.package_version }} ${{ matrix.name }} + + temp_file=$(mktemp) + created_package=$(fpm -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-infos.outputs.package_version }} ${{ matrix.name }} | tee "$temp_file" | grep "Created package" | grep -oP '(?<=:path=>").*?(?=")') + # Check deb + dpkg-deb --contents $created_package shell: bash - if: ${{ steps.check-package-existence.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) && matrix.use_dh_make_perl == 'true' }} run: | - DEB_BUILD_OPTIONS="nocheck nodocs notest" dh-make-perl make --dist ${{ matrix.distrib }} --build --version ${{ steps.package-infos.outputs.package_version }}${{ steps.parse-distrib.outputs.package_distrib_separator }}${{ steps.parse-distrib.outputs.package_distrib_name }} --cpan ${{ matrix.name }} + temp_file=$(mktemp) + created_package=$(DEB_BUILD_OPTIONS="nocheck nodocs notest" dh-make-perl make --dist ${{ matrix.distrib }} --build --version ${{ steps.package-infos.outputs.package_version }}${{ steps.parse-distrib.outputs.package_distrib_separator }}${{ steps.parse-distrib.outputs.package_distrib_name }} --cpan ${{ matrix.name }} | tee "$temp_file" | grep "building package" | grep -oP "(?<=in '..\/).*.deb(?=')") + # Check deb + dpkg-deb --contents $created_package shell: bash - if: ${{ steps.check-package-existence.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) }} From 2097942f12592d27af88d2ce7bd4fee068851b8b Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Fri, 3 Jan 2025 23:25:11 +0100 Subject: [PATCH 34/35] fix for Crypt::OpenSSL::AES on Debian --- .github/workflows/perl-cpan-libraries.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 5e9ab1f7ed..beab0e9e04 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -329,6 +329,7 @@ jobs: "Net::MQTT::Simple", "Paws", "Statistics::Regression", + "XS::Loader", "ZMQ::Constants", "ZMQ::LibZMQ4" ] @@ -354,6 +355,10 @@ jobs: image: packaging-plugins-bullseye-arm64 arch: arm64 runner_name: ["self-hosted", "collect-arm64"] + - name: "Crypt::OpenSSL::AES" + use_dh_make_perl: "false" + deb_dependencies: "libexporter-tiny-perl libxs-install-perl" + no-auto-depends: true - name: "Device::Modbus::RTU::Client" build_distribs: "bookworm" - name: "Device::Modbus::TCP::Client" @@ -397,6 +402,7 @@ jobs: name: Get package infos id: package-infos run: | + apt-get update cpan_info=$(cpanm --info ${{ matrix.name }}) if [ -z "${{ matrix.version }}" ]; then CPAN_PACKAGE_VERSION=$(echo $cpan_info | sed 's/\.tar\.gz$//' | sed 's/.*\-//' | sed 's/v//') From 7098b0a4a9f2d6cf0cd64a1bc80cc34d7958c2de Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Mon, 13 Jan 2025 18:49:43 +0100 Subject: [PATCH 35/35] add errors --- .github/workflows/perl-cpan-libraries.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index beab0e9e04..fa3486feba 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -456,17 +456,17 @@ jobs: fi temp_file=$(mktemp) - created_package=$(fpm -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-infos.outputs.package_version }} ${{ matrix.name }} | tee "$temp_file" | grep "Created package" | grep -oP '(?<=:path=>").*?(?=")') + created_package=$(fpm -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-infos.outputs.package_version }} ${{ matrix.name }} | tee "$temp_file" | grep "Created package" | grep -oP '(?<=:path=>").*?(?=")') || { echo "Error: fpm command failed"; exit 1; } # Check deb - dpkg-deb --contents $created_package + dpkg-deb --contents $created_package || { echo "Error: dpkg-deb failed for package $created_package"; exit 1; } shell: bash - if: ${{ steps.check-package-existence.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) && matrix.use_dh_make_perl == 'true' }} run: | temp_file=$(mktemp) - created_package=$(DEB_BUILD_OPTIONS="nocheck nodocs notest" dh-make-perl make --dist ${{ matrix.distrib }} --build --version ${{ steps.package-infos.outputs.package_version }}${{ steps.parse-distrib.outputs.package_distrib_separator }}${{ steps.parse-distrib.outputs.package_distrib_name }} --cpan ${{ matrix.name }} | tee "$temp_file" | grep "building package" | grep -oP "(?<=in '..\/).*.deb(?=')") + created_package=$(DEB_BUILD_OPTIONS="nocheck nodocs notest" dh-make-perl make --dist ${{ matrix.distrib }} --build --version ${{ steps.package-infos.outputs.package_version }}${{ steps.parse-distrib.outputs.package_distrib_separator }}${{ steps.parse-distrib.outputs.package_distrib_name }} --cpan ${{ matrix.name }} | tee "$temp_file" | grep "building package" | grep -oP "(?<=in '..\/).*.deb(?=')") || { echo "Error: dh-make-perl command failed"; exit 1; } # Check deb - dpkg-deb --contents $created_package + dpkg-deb --contents $created_package || { echo "Error: dpkg-deb failed for package $created_package"; exit 1; } shell: bash - if: ${{ steps.check-package-existence.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) }}