Ctor 1018 perl json path dependencies issue (#5469)

Refs: CTOR-1018
This commit is contained in:
sdepassio 2025-03-05 09:20:04 +01:00 committed by GitHub
parent 1571d4ba18
commit 5a23b681ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 437 additions and 1177 deletions

View File

@ -0,0 +1,141 @@
name: "test-cpan-libs"
description: "Test packaged CPAN libraries"
inputs:
package_extension:
description: "The package extension (deb or rpm)"
required: true
distrib:
description: "The distribution name"
required: true
arch:
description: "The architecture (amd64 or arm64)"
required: true
runs:
using: "composite"
steps:
- if: ${{ inputs.package_extension == 'rpm' }}
name: Install zstd, perl and Centreon repositories
run: |
dnf install -y zstd perl epel-release 'dnf-command(config-manager)' perl-App-cpanminus
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: ${{ inputs.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 build-essential cpanminus
wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1
# Avoid apt to clean packages cache directory
rm -f /etc/apt/apt.conf.d/docker-clean
apt-get update
shell: bash
- name: Restore packages from cache
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ./*.${{ inputs.package_extension }}
key: ${{ github.sha }}-${{ github.run_id }}-${{ inputs.package_extension }}-${{ inputs.distrib }}
fail-on-cache-miss: true
- if: ${{ inputs.package_extension == 'rpm' }}
name: Check packages installation / uninstallation
run: |
error_log="install_error_${{ inputs.distrib }}_${{ inputs.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."
script_name=$(echo $package | tr '[:upper:]' '[:lower:]' | sed 's/\.\/perl-//' | sed 's/-[0-9\.-]*.el[0-9]..*.rpm//')
if [[ -f ./tests/cpan-libraries/$script_name.pl ]]; then
echo "Testing package..."
error_output=$(perl tests/cpan-libraries/$script_name.pl 2>&1) || { echo "$error_output" >> $error_log; echo "Error during the usage test of the package $package" >> $error_log; true; }
echo "Testing done."
else
echo "No test script found for the package $package"
fi
echo "Package uninstallation..."
error_output=$(dnf autoremove --setopt=keepcache=True -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: ${{ inputs.package_extension == 'deb' }}
name: Check packages installation / uninstallation
run: |
error_log="install_error_${{ inputs.distrib }}_${{ inputs.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 && ${{ inputs.arch }} != "amd64" || $package == *arm64.deb && ${{ inputs.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."
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].*${{ inputs.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."
script_name=$(echo $package | sed 's/.\/lib//' | sed 's/-perl_[0-9\.-]*-deb.*\.deb//')
if [[ -f ./tests/cpan-libraries/$script_name.pl ]]; then
echo "Testing package..."
error_output=$(perl tests/cpan-libraries/$script_name.pl 2>&1) || { echo "$error_output" >> $error_log; echo "Error during the usage test of the package $package" >> $error_log; true; }
echo "Testing done."
else
echo "No test script found for the package $package"
fi
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

View File

@ -43,6 +43,7 @@ jobs:
"Config::AWS",
"Convert::Binary::C",
"Convert::EBCDIC",
"Crypt::Argon2",
"Crypt::Blowfish_PP",
"Crypt::OpenSSL::AES",
"DataStruct::Flat",
@ -52,15 +53,20 @@ jobs:
"Device::Modbus::RTU::Client",
"Device::Modbus::TCP::Client",
"Email::Send::SMTP::Gmail",
"Exporter::Tiny", # Required by JSON::Path: the version available in the official repositories doesn't work with the last version of JSON::Path
"FFI::CheckLib",
"FFI::Platypus",
"File::SearchPath",
"HTTP::ProxyPAC",
"JMX::Jmx4Perl",
"JSON::Path",
"Libssh::Session",
"LV",
"Mojo::IOLoop::Signal",
"MongoDB",
"MooseX::ClassAttribute",
"Net::Amazon::Signature::V4",
"Net::Curl",
"Net::DHCP",
"Net::FTPSSL",
"Net::HTTPTunnel",
@ -93,6 +99,7 @@ jobs:
- version: ""
- spec_file: ""
- no-auto-depends: "false"
- preinstall_cpanlibs: ""
- distrib: el8
package_extension: rpm
image: packaging-plugins-alma8
@ -101,6 +108,8 @@ jobs:
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: "Crypt::Argon2"
preinstall_cpanlibs: "Dist::Build"
- name: "DateTime::Format::Duration::ISO8601"
rpm_provides: "perl(DateTime-Format-Duration-ISO8601)"
- name: "Device::Modbus::RTU::Client"
@ -113,10 +122,14 @@ 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: "Libssh::Session"
rpm_dependencies: "libssh"
- name: "Mojo::IOLoop::Signal"
rpm_dependencies: "perl-Mojolicious"
rpm_provides: "perl(Mojo::IOLoop::Signal)"
no-auto-depends: "true"
- name: "Net::Curl"
rpm_dependencies: "libcurl"
- name: "Net::DHCP"
rpm_provides: "perl(Net::DHCP::Constants) perl(Net::DHCP::Packet)"
- name: "Net::SMTPS"
@ -146,7 +159,28 @@ jobs:
steps:
- if: ${{ contains(matrix.build_distribs, matrix.distrib) }}
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- if: ${{ contains(matrix.build_distribs, matrix.distrib) }}
name: Get package infos
id: package-infos
run: |
cpan_info=$(cpanm --info ${{ matrix.name }})
if [ -z "${{ matrix.version }}" ]; then
CPAN_PACKAGE_VERSION=$(echo $cpan_info | sed 's/\.tar\.gz$//' | sed 's/.*\-//')
if [[ ! $CPAN_PACKAGE_VERSION =~ ^[v0-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')
PACKAGE_NAME="perl-$CPAN_PACKAGE_NAME"
echo "package_name=$(echo $PACKAGE_NAME)" >> $GITHUB_OUTPUT
shell: bash
- if: ${{ contains(matrix.build_distribs, matrix.distrib) }}
name: Check if package already exists
@ -155,8 +189,8 @@ jobs:
package_info=$(dnf provides 'perl(${{ matrix.name }})' 2>&1 | tr '[:upper:]' '[:lower:]' || 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
package_version=$(echo $package_info | grep -oP "perl\($(echo ${{ matrix.name }} | tr '[:upper:]' '[:lower:]')\) = \K[0-9]+\.[0-9]+")
if [[ "$package_version" == "${{ steps.package-infos.outputs.package_version }}" || "v$package_version" == "${{ steps.package-infos.outputs.package_version }}" ]]; then
echo "::warning::Package ${{ matrix.name }} already exists in the official ${{ matrix.distrib }} repository with the same version."
do_not_build="true"
else
@ -169,11 +203,7 @@ jobs:
- 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=""
else
PACKAGE_VERSION=" -v ${{ matrix.version }}"
fi
PACKAGE_VERSION=" -v ${{ steps.package-infos.outputs.package_version }}"
if [ -z "${{ matrix.rpm_dependencies }}" ]; then
PACKAGE_DEPENDENCIES=""
@ -195,9 +225,14 @@ jobs:
done
fi
for CPANLIB_PREINSTALL in `echo "${{ matrix.preinstall_cpanlibs }}"`; do
cpanm $CPANLIB_PREINSTALL
done
export SYBASE="/usr"
temp_file=$(mktemp)
echo "default.local" | tee /etc/mailname
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 package name
if [ -z "$created_package" ]; then
@ -281,7 +316,7 @@ jobs:
- run: apt-get install -y zstd
shell: bash
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
@ -315,6 +350,7 @@ jobs:
"ARGV::Struct",
"Config::AWS",
"Convert::EBCDIC",
"Crypt::Argon2",
"Crypt::Blowfish_PP",
"Crypt::OpenSSL::AES",
"DataStruct::Flat",
@ -327,8 +363,10 @@ jobs:
"Hash::Ordered",
"HTTP::ProxyPAC",
"JMX::Jmx4Perl",
"Libssh::Session",
"Mojo::IOLoop::Signal",
"Net::Amazon::Signature::V4",
"Net::Curl",
"Net::FTPSSL",
"Net::HTTPTunnel",
"Net::MQTT::Simple",
@ -346,6 +384,8 @@ jobs:
- rpm_provides: ""
- version: ""
- use_dh_make_perl: "true"
- no-auto-depends: "false"
- preinstall_cpanlibs: ""
- build_name: bullseye-amd64
distrib: bullseye
package_extension: deb
@ -364,6 +404,12 @@ jobs:
image: packaging-plugins-bullseye-arm64
arch: arm64
runner_name: centreon-collect-arm64
- name: "Crypt::Argon2"
build_names: "bullseye-amd64,jammy,bullseye-arm64"
preinstall_cpanlibs: "Dist::Build"
use_dh_make_perl: "false"
no-auto-depends: "true"
deb_dependencies: "libexporter-tiny-perl libtime-hires-perl libxsloader-perl"
- name: "Crypt::OpenSSL::AES"
use_dh_make_perl: "false"
deb_dependencies: "libexporter-tiny-perl libxs-install-perl"
@ -375,8 +421,18 @@ jobs:
build_names: "bookworm"
- name: "Digest::SHA1"
build_names: "jammy"
- name: "Libssh::Session"
use_dh_make_perl: "false"
build_names: "bullseye-amd64,bookworm,jammy,bullseye-arm64"
no-auto-depends: "true"
deb_dependencies: "libcarp-assert-perl libdynaloader-functions-perl libexporter-tiny-perl libdevel-overloadinfo-perl libssh-4 libc6"
- name: "Net::Amazon::Signature::V4"
build_names: ["bullseye-amd64", "jammy"]
- name: "Net::Curl"
use_dh_make_perl: "false"
build_names: "bullseye-amd64,bookworm,jammy,bullseye-arm64"
no-auto-depends: "true"
deb_dependencies: "libcarp-assert-perl libdynaloader-functions-perl libexporter-tiny-perl libdevel-overloadinfo-perl libcurl4"
- name: "Net::MQTT::Simple"
version: "1.29"
- name: "Paws"
@ -400,7 +456,7 @@ jobs:
steps:
- if: ${{ contains(matrix.build_names, matrix.build_name) }}
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- if: ${{ contains(matrix.build_names, matrix.build_name) }}
name: Parse distrib name
@ -416,8 +472,8 @@ jobs:
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//')
if [[ ! $CPAN_PACKAGE_VERSION =~ ^[0-9]+\.[0-9]+ ]]; then
CPAN_PACKAGE_VERSION=$(echo $cpan_info | sed 's/\.tar\.gz$//' | sed 's/.*\-//')
if [[ ! $CPAN_PACKAGE_VERSION =~ ^[v0-9]+\.[0-9]+ ]]; then
echo "::error::Invalid version number: ${CPAN_PACKAGE_VERSION}"
exit 1
fi
@ -442,7 +498,7 @@ jobs:
do_not_build="false"
if [[ -n $package_info ]]; then
candidate_version=$(echo "$package_info" | grep 'Candidate:' | awk '{print $2}')
if [[ "$candidate_version" == "${{ steps.package-infos.outputs.package_version }}"* ]]; then
if [[ "$candidate_version" == "${{ steps.package-infos.outputs.package_version }}"* || "v$candidate_version" == "${{ steps.package-infos.outputs.package_version }}"* ]]; then
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
@ -455,6 +511,10 @@ jobs:
- if: ${{ steps.check-package-existence.outputs.do_not_build == 'false' && contains(matrix.build_names, matrix.build_name) && matrix.use_dh_make_perl == 'false' }}
run: |
# Install needed cpan libs
for CPANLIB_PREINSTALL in `echo "${{ matrix.preinstall_cpanlibs }}"`; do
cpanm $CPANLIB_PREINSTALL
done
if [ -z "${{ matrix.deb_dependencies }}" ]; then
PACKAGE_DEPENDENCIES=""
else
@ -467,6 +527,7 @@ jobs:
fi
temp_file=$(mktemp)
echo "default.local" | tee /etc/mailname
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 package name
if [ -z "$created_package" ]; then
@ -479,11 +540,15 @@ jobs:
- if: ${{ steps.check-package-existence.outputs.do_not_build == 'false' && contains(matrix.build_names, matrix.build_name) && matrix.use_dh_make_perl == 'true' }}
run: |
# Install needed cpan libs
for CPANLIB_PREINSTALL in `echo "${{ matrix.preinstall_cpanlibs }}"`; do
cpanm $CPANLIB_PREINSTALL
done
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(?=')") || { echo "Error: dh-make-perl command failed"; exit 1; }
# Check package name
if [ -z "$created_package" ]; then
echo "Error: fpm command failed"
echo "Error: dh-make-perl command failed"
exit 1
fi
# Check deb
@ -595,114 +660,15 @@ jobs:
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
# Avoid apt to clean packages cache directory
rm -f /etc/apt/apt.conf.d/docker-clean
apt-get update
shell: bash
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Restore packages from cache
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
- name: Test packaged libs
uses: ./.github/actions/test-cpan-libs
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 --setopt=keepcache=True -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."
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
package_extension: ${{ matrix.package_extension }}
distrib: ${{ matrix.distrib }}
arch: ${{ matrix.arch }}
- name: Upload error log
if: failure()

View File

@ -1,201 +0,0 @@
name: perl-crypt-argon2
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
pull_request:
paths:
- "dependencies/perl-crypt-argon2/**"
push:
branches:
- develop
- dev-[2-9][0-9].[0-9][0-9].x
- master
- "[2-9][0-9].[0-9][0-9].x"
paths:
- "dependencies/perl-crypt-argon2/**"
tags:
- perl-crypt-argon2-*
jobs:
get-environment:
uses: ./.github/workflows/get-environment.yml
package:
needs: [get-environment]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
needs.get-environment.outputs.stability != 'stable'
strategy:
fail-fast: false
matrix:
include:
- image: packaging-plugins-alma8
distrib: el8
package_extension: rpm
runner: ubuntu-22.04
arch: amd64
- image: packaging-plugins-alma9
distrib: el9
package_extension: rpm
runner: ubuntu-22.04
arch: amd64
- image: packaging-plugins-bullseye
distrib: bullseye
package_extension: deb
runner: ubuntu-22.04
arch: amd64
- image: packaging-plugins-bookworm
distrib: bookworm
package_extension: deb
runner: ubuntu-22.04
arch: amd64
- image: packaging-plugins-jammy
distrib: jammy
package_extension: deb
runner: ubuntu-22.04
arch: amd64
- image: packaging-plugins-bullseye-arm64
distrib: bullseye
package_extension: deb
runner: centreon-collect-arm64
arch: arm64
runs-on: ${{ matrix.runner }}
container:
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest
credentials:
username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }}
password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }}
name: package ${{ matrix.distrib }} ${{ matrix.arch }}
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Install locally Crypt::Argon2
run: |
if [[ "${{ matrix.package_extension }}" == "deb" ]]; then
apt-get update
apt-get install -y cpanminus gcc
else
dnf install -y cpanminus gcc
fi
cpanm -v -l /tmp Crypt::Argon2@0.020
shell: bash
- name: Set package name and paths according to distrib
run: |
PERL_VERSION=$(perl -E "say $^V" | sed -E "s/v([0-9]+\.[0-9]+).+/\1/g")
echo "Perl version is $PERL_VERSION"
if [[ "${{ matrix.package_extension }}" == "deb" ]]; then
NAME="libcrypt-argon2-perl"
if [ "${{ matrix.arch }}" = "amd64" ]; then
PERL_VENDORARCH="/usr/lib/x86_64-linux-gnu/perl/$PERL_VERSION"
else
PERL_VENDORARCH="/usr/lib/aarch64-linux-gnu/perl/$PERL_VERSION"
fi
else
NAME="perl-Crypt-Argon2"
if [ "${{ matrix.distrib }}" = "el8" ]; then
PERL_VENDORARCH="/usr/local/lib64/perl5"
else
PERL_VENDORARCH="/usr/local/lib64/perl5/$PERL_VERSION"
fi
fi
sed -i "s/@NAME@/$NAME/g" dependencies/perl-crypt-argon2/perl-crypt-argon2.yaml
sed -i "s#@PERL_VENDORARCH@#$PERL_VENDORARCH#g" dependencies/perl-crypt-argon2/perl-crypt-argon2.yaml
cat dependencies/perl-crypt-argon2/perl-crypt-argon2.yaml
shell: bash
- name: Package
uses: ./.github/actions/package-nfpm
with:
nfpm_file_pattern: "dependencies/perl-crypt-argon2/perl-crypt-argon2.yaml"
distrib: ${{ matrix.distrib }}
package_extension: ${{ matrix.package_extension }}
arch: ${{ matrix.arch }}
release: 1
commit_hash: ${{ github.sha }}
cache_key: cache-${{ github.sha }}-${{ matrix.package_extension }}-perl-crypt-argon2-${{ matrix.distrib }}-${{ matrix.arch }}-${{ github.head_ref || github.ref_name }}
rpm_gpg_key: ${{ secrets.RPM_GPG_SIGNING_KEY }}
rpm_gpg_signing_key_id: ${{ secrets.RPM_GPG_SIGNING_KEY_ID }}
rpm_gpg_signing_passphrase: ${{ secrets.RPM_GPG_SIGNING_PASSPHRASE }}
stability: ${{ needs.get-environment.outputs.stability }}
# set condition to true if artifacts are needed
- if: ${{ false }}
name: Upload package artifacts
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: packages-${{ matrix.distrib }}-${{ matrix.arch }}
path: ./*.${{ matrix.package_extension}}
retention-days: 1
deliver-packages:
needs: [get-environment, package]
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
arch: amd64
- distrib: el9
package_extension: rpm
arch: amd64
- distrib: bullseye
package_extension: deb
arch: amd64
- distrib: bullseye
package_extension: deb
arch: arm64
- distrib: bookworm
package_extension: deb
arch: amd64
- distrib: jammy
package_extension: deb
arch: amd64
name: deliver ${{ matrix.distrib }} ${{ matrix.arch }}
steps:
- name: Checkout sources
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Delivery
uses: ./.github/actions/package-delivery
with:
module_name: perl-crypt-argon2-${{ matrix.arch }}
distrib: ${{ matrix.distrib }}
arch: ${{ matrix.arch }}
cache_key: cache-${{ github.sha }}-rpm-perl-crypt-argon2-${{ matrix.distrib }}-${{ matrix.arch }}-${{ github.head_ref || github.ref_name }}
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

View File

@ -1,177 +0,0 @@
name: perl-json-path
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
pull_request:
paths:
- "dependencies/perl-json-path/**"
- ".github/workflows/perl-json-path.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:
- "dependencies/perl-json-path/**"
- ".github/workflows/perl-json-path.yml"
jobs:
get-environment:
uses: ./.github/workflows/get-environment.yml
package:
needs: [get-environment]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
needs.get-environment.outputs.stability != 'stable'
strategy:
fail-fast: false
matrix:
include:
- image: packaging-plugins-alma8
distrib: el8
package_extension: rpm
- image: packaging-plugins-alma9
distrib: el9
package_extension: rpm
- image: packaging-plugins-bullseye
distrib: bullseye
package_extension: deb
- image: packaging-plugins-bookworm
distrib: bookworm
package_extension: deb
- image: packaging-plugins-jammy
distrib: jammy
package_extension: deb
runs-on: ubuntu-22.04
container:
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest
credentials:
username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }}
password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }}
name: package ${{ matrix.distrib }}
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Install locally JSON::Path
run: |
if [[ "${{ matrix.package_extension }}" == "deb" ]]; then
apt-get update
apt-get install -y cpanminus gcc
else
dnf install -y cpanminus gcc
fi
cpanm -v -l /tmp JSON::Path@1.0.4
shell: bash
- name: Set package name and paths according to distrib
run: |
VERSION="1.0.4"
PERL_VERSION=$(perl -E "say $^V" | sed -E "s/v([0-9]+\.[0-9]+).+/\1/g")
echo "Perl version is $PERL_VERSION"
if [[ "${{ matrix.package_extension }}" == "deb" ]]; then
NAME="libjson-path-perl"
PERL_VENDORLIB="/usr/share/perl5"
else
NAME="perl-JSON-Path"
if [ "${{ matrix.distrib }}" = "el8" ]; then
PERL_VENDORLIB="/usr/local/share/perl5"
else
PERL_VENDORLIB="/usr/local/share/perl5/$PERL_VERSION"
fi
fi
sed -i "s/@NAME@/$NAME/g" dependencies/perl-json-path/perl-json-path.yaml
sed -i "s/@VERSION@/$VERSION/g" dependencies/perl-json-path/perl-json-path.yaml
sed -i "s#@PERL_VENDORLIB@#$PERL_VENDORLIB#g" dependencies/perl-json-path/perl-json-path.yaml
cat dependencies/perl-json-path/perl-json-path.yaml
shell: bash
- name: Package
uses: ./.github/actions/package-nfpm
with:
nfpm_file_pattern: "dependencies/perl-json-path/perl-json-path.yaml"
distrib: ${{ matrix.distrib }}
package_extension: ${{ matrix.package_extension }}
release: 3
arch: all
commit_hash: ${{ github.sha }}
cache_key: cache-${{ github.sha }}-${{ matrix.package_extension }}-perl-json-path-${{ matrix.distrib }}-${{ github.head_ref || github.ref_name }}
rpm_gpg_key: ${{ secrets.RPM_GPG_SIGNING_KEY }}
rpm_gpg_signing_key_id: ${{ secrets.RPM_GPG_SIGNING_KEY_ID }}
rpm_gpg_signing_passphrase: ${{ secrets.RPM_GPG_SIGNING_PASSPHRASE }}
stability: ${{ needs.get-environment.outputs.stability }}
# set condition to true if artifacts are needed
- if: ${{ false }}
name: Upload package artifacts
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: packages-${{ matrix.distrib }}
path: ./*.${{ matrix.package_extension}}
retention-days: 1
deliver-packages:
needs: [get-environment, package]
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-json-path
distrib: ${{ matrix.distrib }}
cache_key: cache-${{ github.sha }}-${{ matrix.package_extension }}-perl-json-path-${{ matrix.distrib }}-${{ github.head_ref || github.ref_name }}
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

View File

@ -1,199 +0,0 @@
name: perl-libssh-session
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
pull_request:
paths:
- "dependencies/perl-libssh-session/**"
push:
branches:
- develop
- dev-[2-9][0-9].[0-9][0-9].x
- master
- "[2-9][0-9].[0-9][0-9].x"
paths:
- "dependencies/perl-libssh-session/**"
jobs:
get-environment:
uses: ./.github/workflows/get-environment.yml
package:
needs: [get-environment]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
needs.get-environment.outputs.stability != 'stable'
strategy:
fail-fast: false
matrix:
include:
- image: packaging-plugins-alma8
distrib: el8
package_extension: rpm
runner: ubuntu-22.04
arch: amd64
- image: packaging-plugins-alma9
distrib: el9
package_extension: rpm
runner: ubuntu-22.04
arch: amd64
- image: packaging-plugins-bullseye
distrib: bullseye
package_extension: deb
runner: ubuntu-22.04
arch: amd64
- image: packaging-plugins-bookworm
distrib: bookworm
package_extension: deb
runner: ubuntu-22.04
arch: amd64
- image: packaging-plugins-jammy
distrib: jammy
package_extension: deb
runner: ubuntu-22.04
arch: amd64
- image: packaging-plugins-bullseye-arm64
distrib: bullseye
package_extension: deb
runner: centreon-collect-arm64
arch: arm64
runs-on: ${{ matrix.runner }}
container:
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest
credentials:
username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }}
password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }}
name: package ${{ matrix.distrib }} ${{ matrix.arch }}
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Install locally Libssh::Session
run: |
if [[ "${{ matrix.package_extension }}" == "deb" ]]; then
apt-get update
apt-get install -y cpanminus gcc libssh-dev
else
dnf install -y cpanminus gcc libssh-devel
fi
cpanm -v -l /tmp Libssh::Session@0.8
shell: bash
- name: Set package name and paths according to distrib
run: |
PERL_VERSION=$(perl -E "say $^V" | sed -E "s/v([0-9]+\.[0-9]+).+/\1/g")
echo "Perl version is $PERL_VERSION"
if [[ "${{ matrix.package_extension }}" == "deb" ]]; then
NAME="libssh-session-perl"
if [ "${{ matrix.arch }}" = "amd64" ]; then
PERL_VENDORARCH="/usr/lib/x86_64-linux-gnu/perl/$PERL_VERSION"
else
PERL_VENDORARCH="/usr/lib/aarch64-linux-gnu/perl/$PERL_VERSION"
fi
else
NAME="perl-Libssh-Session"
if [ "${{ matrix.distrib }}" = "el8" ]; then
PERL_VENDORARCH="/usr/local/lib64/perl5"
else
PERL_VENDORARCH="/usr/local/lib64/perl5/$PERL_VERSION"
fi
fi
sed -i "s/@NAME@/$NAME/g" dependencies/perl-libssh-session/perl-libssh-session.yaml
sed -i "s#@PERL_VENDORARCH@#$PERL_VENDORARCH#g" dependencies/perl-libssh-session/perl-libssh-session.yaml
cat dependencies/perl-libssh-session/perl-libssh-session.yaml
shell: bash
- name: Package
uses: ./.github/actions/package-nfpm
with:
nfpm_file_pattern: "dependencies/perl-libssh-session/perl-libssh-session.yaml"
distrib: ${{ matrix.distrib }}
package_extension: ${{ matrix.package_extension }}
arch: ${{ matrix.arch }}
release: 5
commit_hash: ${{ github.sha }}
cache_key: cache-${{ github.sha }}-${{ matrix.package_extension }}-perl-libssh-session-${{ matrix.distrib }}-${{ matrix.arch }}-${{ github.head_ref || github.ref_name }}
rpm_gpg_key: ${{ secrets.RPM_GPG_SIGNING_KEY }}
rpm_gpg_signing_key_id: ${{ secrets.RPM_GPG_SIGNING_KEY_ID }}
rpm_gpg_signing_passphrase: ${{ secrets.RPM_GPG_SIGNING_PASSPHRASE }}
stability: ${{ needs.get-environment.outputs.stability }}
# set condition to true if artifacts are needed
- if: ${{ false }}
name: Upload package artifacts
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: packages-${{ matrix.distrib }}-${{ matrix.arch }}
path: ./*.${{ matrix.package_extension}}
retention-days: 1
deliver-packages:
needs: [get-environment, package]
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
arch: amd64
- distrib: el9
package_extension: rpm
arch: amd64
- distrib: bullseye
package_extension: deb
arch: amd64
- distrib: bullseye
package_extension: deb
arch: arm64
- distrib: bookworm
package_extension: deb
arch: amd64
- distrib: jammy
package_extension: deb
arch: amd64
name: deliver ${{ matrix.distrib }} ${{ matrix.arch }}
steps:
- name: Checkout sources
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Delivery
uses: ./.github/actions/package-delivery
with:
module_name: perl-libssh-session-${{ matrix.arch }}
distrib: ${{ matrix.distrib }}
arch: ${{ matrix.arch }}
cache_key: cache-${{ github.sha }}-${{ matrix.package_extension }}-perl-libssh-session-${{ matrix.distrib }}-${{ matrix.arch }}-${{ github.head_ref || github.ref_name }}
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

View File

@ -1,199 +0,0 @@
name: perl-net-curl
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
pull_request:
paths:
- "dependencies/perl-net-curl/**"
push:
branches:
- develop
- dev-[2-9][0-9].[0-9][0-9].x
- master
- "[2-9][0-9].[0-9][0-9].x"
paths:
- "dependencies/perl-net-curl/**"
jobs:
get-environment:
uses: ./.github/workflows/get-environment.yml
package:
needs: [get-environment]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
needs.get-environment.outputs.stability != 'stable'
strategy:
fail-fast: false
matrix:
include:
- image: packaging-plugins-alma8
distrib: el8
package_extension: rpm
runner: ubuntu-22.04
arch: amd64
- image: packaging-plugins-alma9
distrib: el9
package_extension: rpm
runner: ubuntu-22.04
arch: amd64
- image: packaging-plugins-bullseye
distrib: bullseye
package_extension: deb
runner: ubuntu-22.04
arch: amd64
- image: packaging-plugins-bookworm
distrib: bookworm
package_extension: deb
runner: ubuntu-22.04
arch: amd64
- image: packaging-plugins-jammy
distrib: jammy
package_extension: deb
runner: ubuntu-22.04
arch: amd64
- image: packaging-plugins-bullseye-arm64
distrib: bullseye
package_extension: deb
runner: centreon-collect-arm64
arch: arm64
runs-on: ${{ matrix.runner }}
container:
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest
credentials:
username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }}
password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }}
name: package ${{ matrix.distrib }} ${{ matrix.arch }}
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Install locally Net::Curl
run: |
if [[ "${{ matrix.package_extension }}" == "deb" ]]; then
apt-get update
apt-get install -y libcurl4-openssl-dev cpanminus gcc
else
dnf install -y libcurl-devel cpanminus gcc
fi
cpanm -v -l /tmp Net::Curl@0.55
shell: bash
- name: Set package name and paths according to distrib
run: |
PERL_VERSION=$(perl -E "say $^V" | sed -E "s/v([0-9]+\.[0-9]+).+/\1/g")
echo "Perl version is $PERL_VERSION"
if [[ "${{ matrix.package_extension }}" == "deb" ]]; then
NAME="libnet-curl-perl"
if [ "${{ matrix.arch }}" = "amd64" ]; then
PERL_VENDORARCH="/usr/lib/x86_64-linux-gnu/perl/$PERL_VERSION"
else
PERL_VENDORARCH="/usr/lib/aarch64-linux-gnu/perl/$PERL_VERSION"
fi
else
NAME="perl-Net-Curl"
if [ "${{ matrix.distrib }}" = "el8" ]; then
PERL_VENDORARCH="/usr/local/lib64/perl5"
else
PERL_VENDORARCH="/usr/local/lib64/perl5/$PERL_VERSION"
fi
fi
sed -i "s/@NAME@/$NAME/g" dependencies/perl-net-curl/perl-net-curl.yaml
sed -i "s#@PERL_VENDORARCH@#$PERL_VENDORARCH#g" dependencies/perl-net-curl/perl-net-curl.yaml
cat dependencies/perl-net-curl/perl-net-curl.yaml
shell: bash
- name: Package
uses: ./.github/actions/package-nfpm
with:
nfpm_file_pattern: "dependencies/perl-net-curl/perl-net-curl.yaml"
distrib: ${{ matrix.distrib }}
package_extension: ${{ matrix.package_extension }}
arch: ${{ matrix.arch }}
commit_hash: ${{ github.sha }}
release: 1
cache_key: cache-${{ github.sha }}-${{ matrix.package_extension }}-perl-net-curl-${{ matrix.distrib }}-${{ matrix.arch }}-${{ github.head_ref || github.ref_name }}
rpm_gpg_key: ${{ secrets.RPM_GPG_SIGNING_KEY }}
rpm_gpg_signing_key_id: ${{ secrets.RPM_GPG_SIGNING_KEY_ID }}
rpm_gpg_signing_passphrase: ${{ secrets.RPM_GPG_SIGNING_PASSPHRASE }}
stability: ${{ needs.get-environment.outputs.stability }}
# set condition to true if artifacts are needed
- if: ${{ false }}
name: Upload package artifacts
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: packages-${{ matrix.distrib }}-${{ matrix.arch }}
path: ./*.${{ matrix.package_extension }}
retention-days: 1
deliver-packages:
needs: [get-environment, package]
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
arch: amd64
- distrib: el9
package_extension: rpm
arch: amd64
- distrib: bullseye
package_extension: deb
arch: amd64
- distrib: bullseye
package_extension: deb
arch: arm64
- distrib: bookworm
package_extension: deb
arch: amd64
- distrib: jammy
package_extension: deb
arch: amd64
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-net-curl-${{ matrix.arch }}
distrib: ${{ matrix.distrib }}
arch: ${{ matrix.arch }}
cache_key: cache-${{ github.sha }}-${{ matrix.package_extension }}-perl-net-curl-${{ matrix.distrib }}-${{ matrix.arch }}-${{ github.head_ref || github.ref_name }}
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

View File

@ -1,77 +0,0 @@
name: "@NAME@"
arch: "${ARCH}"
platform: "linux"
version_schema: "none"
version: "0.020"
release: "${RELEASE}${DIST}"
section: "default"
priority: "optional"
maintainer: "Centreon <contact@centreon.com>"
description: |
This module implements the Argon2 key derivation function, which is suitable to convert any password into a cryptographic key.
This is most often used to for secure storage of passwords but can also be used to derive a encryption key from a password.
It offers variable time and memory costs as well as output size.
Commit: @COMMIT_HASH@
vendor: "Centreon"
homepage: "https://www.centreon.com"
license: "Apache-2.0"
contents:
- src: "/tmp/bin/argon2-calibrate"
dst: "/usr/local/bin/"
file_info:
mode: 0755
packager: rpm
- src: "/tmp/bin/argon2-calibrate"
dst: "/usr/bin/"
file_info:
mode: 0755
packager: deb
- src: "/tmp/lib/perl5/*/auto/Crypt/Argon2/"
dst: "@PERL_VENDORARCH@/auto/Crypt/Argon2/"
file_info:
mode: 0644
- src: "/tmp/lib/perl5/*/Crypt/Argon2.pm"
dst: "@PERL_VENDORARCH@/Crypt/"
file_info:
mode: 0644
- src: "/tmp/man/man3/Crypt::Argon2*"
dst: "/usr/share/man/man3/"
file_info:
mode: 0644
overrides:
rpm:
depends:
- perl(Exporter)
- perl(Time::HiRes)
- perl(XSLoader)
- perl(strict)
- perl(warnings)
conflicts:
- perl-Crypt-Argon2-debuginfo
replaces:
- perl-Crypt-Argon2-debuginfo
provides:
- perl-Crypt-Argon2-debuginfo
- perl(Crypt::Argon2)
deb:
depends:
- perl
- libc6
conflicts:
- libcrypt-argon2-perl-dbgsym
replaces:
- libcrypt-argon2-perl-dbgsym
provides:
- libcrypt-argon2-perl-dbgsym
rpm:
summary: Perl interface to the Argon2 key derivation functions
compression: zstd
signature:
key_file: ${RPM_SIGNING_KEY_FILE}
key_id: ${RPM_SIGNING_KEY_ID}

View File

@ -1,63 +0,0 @@
name: "@NAME@"
arch: "${ARCH}"
platform: "linux"
version_schema: "none"
version: "@VERSION@"
release: "${RELEASE}${DIST}"
section: "default"
priority: "optional"
maintainer: "Centreon <contact@centreon.com>"
description: |
This module implements JSONPath, an XPath-like language for searching JSON-like structures.
JSONPath is described at http://goessner.net/articles/JsonPath/.
Commit: @COMMIT_HASH@
vendor: "Centreon"
homepage: "https://www.centreon.com"
license: "Apache-2.0"
contents:
- src: "/tmp/lib/perl5/JSON/Path.pm"
dst: "@PERL_VENDORLIB@/JSON/"
file_info:
mode: 0644
- src: "/tmp/lib/perl5/JSON/Path/"
dst: "@PERL_VENDORLIB@/JSON/Path/"
file_info:
mode: 0644
- src: "/tmp/man/man3/JSON::Path*"
dst: "/usr/share/man/man3/"
file_info:
mode: 0644
overrides:
rpm:
depends:
- perl(Carp::Assert)
- perl(Exporter::Tiny)
- perl(JSON::MaybeXS)
- perl(JSON::Parse)
- perl(LV)
- perl(List::Util)
- perl(Readonly)
- perl(Tie::IxHash)
- perl(Try::Tiny)
provides:
- perl(JSON::Path)
deb:
depends:
- libcarp-assert-perl
- libexporter-tiny-perl
- libjson-parse-perl
- liblv-perl
- libreadonly-perl
- libtie-ixhash-perl
- libtry-tiny-perl
rpm:
summary: This module implements JSONPath, an XPath-like language for searching JSON-like structures
compression: zstd
signature:
key_file: ${RPM_SIGNING_KEY_FILE}
key_id: ${RPM_SIGNING_KEY_ID}

View File

@ -1,64 +0,0 @@
name: "@NAME@"
arch: "${ARCH}"
platform: "linux"
version_schema: "none"
version: "0.8"
release: "${RELEASE}${DIST}"
section: "default"
priority: "optional"
maintainer: "Centreon <contact@centreon.com>"
description: |
Perl interface to the libssh library
Commit: @COMMIT_HASH@
vendor: "Centreon"
homepage: "https://www.centreon.com"
license: "Apache-2.0"
contents:
- src: "/tmp/lib/perl5/*/auto/Libssh/Session/Session.so"
dst: "@PERL_VENDORARCH@/auto/Libssh/Session/"
file_info:
mode: 0644
- src: "/tmp/lib/perl5/*/Libssh/"
dst: "@PERL_VENDORARCH@/Libssh/"
file_info:
mode: 0644
- src: "/tmp/man/man3/Libssh::*"
dst: "/usr/share/man/man3/"
file_info:
mode: 0644
overrides:
rpm:
depends:
- perl-interpreter
- libssh
conflicts:
- perl-Libssh-Session-debuginfo
replaces:
- perl-Libssh-Session-debuginfo
provides:
- perl-Libssh-Session-debuginfo
- perl(Libssh::Session)
- perl(Libssh::Sftp)
deb:
depends:
- perl
- libc6
- libssh-4
conflicts:
- libssh-session-perl-dbgsym
replaces:
- libssh-session-perl-dbgsym
provides:
- libssh-session-perl-dbgsym
- libssh-session-sftp
rpm:
summary: Perl interface to the libssh library
compression: zstd
signature:
key_file: ${RPM_SIGNING_KEY_FILE}
key_id: ${RPM_SIGNING_KEY_ID}

View File

@ -1,78 +0,0 @@
name: "@NAME@"
arch: "${ARCH}"
platform: "linux"
version_schema: "none"
version: "0.55"
release: "${RELEASE}${DIST}"
section: "default"
priority: "optional"
maintainer: "Centreon <contact@centreon.com>"
description: |
Net::Curl provides a Perl interface to libcurl created with object-oriented implementations in mind.
This documentation contains Perl-specific details and quirks.
For more information consult libcurl man pages and documentation at http://curl.haxx.se.
Commit: @COMMIT_HASH@
vendor: "Centreon"
homepage: "https://www.centreon.com"
license: "Apache-2.0"
contents:
- src: "/tmp/lib/perl5/*/auto/Net/Curl/Curl.so"
dst: "@PERL_VENDORARCH@/auto/Net/Curl/"
file_info:
mode: 0644
- src: "/tmp/lib/perl5/*/Net/Curl.pm"
dst: "@PERL_VENDORARCH@/Net/"
file_info:
mode: 0644
- src: "/tmp/lib/perl5/*/Net/Curl/"
dst: "@PERL_VENDORARCH@/Net/Curl/"
file_info:
mode: 0644
- src: "/tmp/man/man3/Net::Curl*"
dst: "/usr/share/man/man3/"
file_info:
mode: 0644
overrides:
rpm:
depends:
- perl-interpreter
- libcurl
conflicts:
- perl-Net-Curl-debuginfo
replaces:
- perl-Net-Curl-debuginfo
provides:
- perl-Net-Curl-debuginfo
- perl(Net::Curl)
- perl(Net::Curl::Compat)
- perl(Net::Curl::Easy)
- perl(Net::Curl::Form)
- perl(Net::Curl::Share)
- perl(Net::Curl::Multi)
deb:
depends:
- perl
- libcurl4
conflicts:
- libnet-curl-perl-dbgsym
replaces:
- libnet-curl-perl-dbgsym
provides:
- libnet-curl-perl-dbgsym
- libnet-curl-compat-perl
- libnet-curl-easy-perl
- libnet-curl-form-perl
- libnet-curl-share-perl
- libnet-curl-multi-perl
rpm:
summary: Perl interface for libcurl
compression: zstd
signature:
key_file: ${RPM_SIGNING_KEY_FILE}
key_id: ${RPM_SIGNING_KEY_ID}

View File

@ -0,0 +1,41 @@
#!/usr/bin/perl
use strict;
use warnings;
use Crypt::Argon2 qw/argon2d_raw argon2i_raw argon2id_raw argon2_pass argon2_verify/;
# Password to hash
my $password = 'my_secure_password';
my $salt = 'random_salt';
my $iterations = 3;
my $memory_cost = 32 * 1024; # in KB
my $parallelism = 1;
my $hash_length = 32;
# Hash with Argon2d
my $argon2d_hash = argon2d_raw($password, $salt, $iterations, $memory_cost, $parallelism, $hash_length);
print("Argon2d hash: " . unpack("H*", $argon2d_hash) . "\n");
# Hash with Argon2i
my $argon2i_hash = argon2i_raw($password, $salt, $iterations, $memory_cost, $parallelism, $hash_length);
print("Argon2i hash: " . unpack("H*", $argon2i_hash) . "\n");
# Hash with Argon2id
my $argon2id_hash = argon2id_raw($password, $salt, $iterations, $memory_cost, $parallelism, $hash_length);
print("Argon2id hash: " . unpack("H*", $argon2id_hash) . "\n");
# Encode password with Argon2d
my $argon2d_encoded = argon2_pass('argon2d', $password, $salt, $iterations, $memory_cost, $parallelism, $hash_length);
print "Argon2d encoded: $argon2d_encoded\n";
# Encode password with Argon2i
my $argon2i_encoded = argon2_pass('argon2i', $password, $salt, $iterations, $memory_cost, $parallelism, $hash_length);
print "Argon2i encoded: $argon2i_encoded\n";
# Encode password with Argon2id
my $argon2id_encoded = argon2_pass('argon2id', $password, $salt, $iterations, $memory_cost, $parallelism, $hash_length);
print "Argon2id encoded: $argon2id_encoded\n";
# Verify password with Argon2d
# print argon2d_verify($argon2d_encoded1, $password) ? "Argon2d password is correct.\n" : "Argon2d password is incorrect.\n";
argon2_verify($argon2d_encoded, $password) ? print "Argon2d password is correct.\n" : exit(1);
# Verify password with Argon2i
argon2_verify($argon2i_encoded, $password) ? print "Argon2i password is correct.\n" : exit(1);
# Verify password with Argon2id
argon2_verify($argon2id_encoded, $password) ? print "Argon2id password is correct.\n" : exit(1);

View File

@ -0,0 +1,32 @@
#!/usr/bin/perl
use strict;
use warnings;
use JSON::Path;
# Sample Perl data structure
my $data = {
store => {
book => [
{ category => "reference", author => "Nigel Rees", title => "Sayings of the Century", price => 8.95 },
{ category => "fiction", author => "Evelyn Waugh", title => "Sword of Honour", price => 12.99 },
{ category => "fiction", author => "Herman Melville", title => "Moby Dick", isbn => "0-553-21311-3", price => 8.99 },
{ category => "fiction", author => "J. R. R. Tolkien", title => "The Lord of the Rings", isbn => "0-395-19395-8", price => 22.99 }
],
bicycle => {
color => "red",
price => 19.95
}
}
};
# Create a JSON::Path object
my $jpath = JSON::Path->new('$.store.book[*].author');
# Find all authors
my @authors = $jpath->values($data);
# Print authors
print "Authors:\n";
foreach my $author (@authors) {
print "$author\n";
}

View File

@ -0,0 +1,111 @@
#!/usr/bin/perl
use strict;
use warnings;
use Libssh::Session qw(:all);
use POSIX qw(WIFEXITED WEXITSTATUS);
# Install SSH server
if (-f "/etc/debian_version") {
system("apt-get update") == 0
or die "apt-update failed: $?";
system("apt-get install -y openssh-server") == 0
or die "Installation failed: $?";
} elsif (-f "/etc/redhat-release") {
system("dnf install -y openssh-server") == 0
or die "Installation failed: $?";
} else {
die "Unsupported operating system";
}
mkdir("/var/run/sshd") unless -d "/var/run/sshd";
system("ssh-keygen -A") == 0
or die "SSH keys generation failed: $?";
if (getpwnam("testuser")) {
print "User testuser already exists\n";
} else {
system("useradd -m testuser") == 0
or die "User creation failed: $?";
}
system("echo 'testuser:testpassword' | chpasswd") == 0
or die "Password configuration failed: $?";
# SSH configuration
open(my $fh, '>', '/etc/ssh/sshd_config')
or die "Cannot open sshd_config: $!";
print $fh "Port 2222\n";
print $fh "PermitRootLogin no\n";
print $fh "AllowUsers testuser\n";
print $fh "PasswordAuthentication yes\n";
close($fh);
# Start SSH server
my $pid = fork();
die "Fork failed: $!" unless defined $pid;
if ($pid == 0) {
exec("/usr/sbin/sshd", "-D")
or die "Cannot start SSH server: $!";
}
# Wait and check the port
sleep(5);
# Check the port with Perl
use IO::Socket::INET;
my $sock = IO::Socket::INET->new(
PeerAddr => '127.0.0.1',
PeerPort => 2222,
Proto => 'tcp'
);
die "Port SSH 2222 is not listening" unless $sock;
$sock->close();
# Connection test with Libssh::Session
eval {
my $session = Libssh::Session->new();
$session->options(
host => "127.0.0.1",
port => 2222,
user => "testuser",
LogVerbosity => 1,
PrintError => 1,
Timeout => 10
);
print "Trying to connect...\n";
$session->connect() == SSH_OK or die "Connection failed: " . $session->get_error();
print "Trying to authenticate...\n";
$session->auth_password(password => "testpassword") == SSH_AUTH_SUCCESS or die "Authentification failed: " . $session->get_error();
print "SSH connection test succeeded\n";
$session->disconnect();
};
if ($@) {
kill 'TERM', $pid;
die "Test failed: $@";
}
# Cleaning
kill 'TERM', $pid;
waitpid($pid, 0);
# Uninstall SSH server
if (-f "/etc/debian_version") {
system("apt-get autoremove -y --purge openssh-server") == 0
or die "Uninstallation failed: $?";
} elsif (-f "/etc/redhat-release") {
system("dnf autoremove --setopt=keepcache=True -y openssh-server") == 0
or die "Uninstallation failed: $?";
} else {
die "Unsupported operating system";
}
system("userdel -r testuser") == 0
or die "Cannot delete user: $?";
print "Test and cleanup succeeded\n";

View File

@ -0,0 +1,27 @@
#!/usr/bin/perl
use strict;
use warnings;
use Net::Curl::Easy qw(:constants);
# URL to fetch
my $url = 'https://www.centreon.com';
# Create a new Curl object
my $curl = Net::Curl::Easy->new();
# Prepare the request
$curl->setopt(CURLOPT_URL, $url);
my $response_body;
$curl->setopt(CURLOPT_WRITEDATA, \$response_body);
# Perform the request
eval {
$curl->perform();
};
die "Unable to fetch URL $url: $@" if $@;
# Print the response body
print "Response body:\n$response_body\n";
print "Test completed successfully.\n";