From e0b5852a88023cd100f1c9fb91c2bab183976475 Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Fri, 27 Dec 2024 19:32:36 +0100 Subject: [PATCH] update packages existence checking + dependencies after cpan build --- .../packaging/Dockerfile.packaging-plugins-bullseye | 3 --- .github/workflows/perl-cpan-libraries.yml | 6 ++++++ .github/workflows/test-cpan-libraries.yml | 13 +++++++------ 3 files changed, 13 insertions(+), 9 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..145335d993 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" @@ -390,26 +392,25 @@ jobs: id: package-version run: | if [ -z "${{ matrix.version }}" ]; then - CPAN_PACKAGE_VERSION=$(cpanm --info ${{ matrix.name }} | sed 's/\.tar\.gz$//' | sed 's/.*\-//' | sed 's/v//') - + cpan_info=$(cpanm --info ${{ matrix.name }}) + CPAN_PACKAGE_VERSION=$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=$cpan_info | sed 's/.*\///g' | sed 's/-[0-9\.]*\.tar\.gz//g' | tr '[:upper:]' '[:lower:]') + echo "package_name=$(echo $CPAN_PACKAGE_NAME)" >> $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) + package_info=$(apt-cache policy ${{ steps.package-version.outputs.package_name }}) if [[ -n $package_info ]]; then echo "Package already exists in the repository." candidate_version=$(echo "$package_info" | grep 'Candidate:' | awk '{print $2}')