Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions .github/actions/test-packages/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
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
cache_key:
description: "The cache key to restore packages"
required: true

runs:
using: "composite"
steps:

- if: ${{ inputs.package_extension == 'rpm' }}
name: Install zstd and Centreon GPG key
run: |
dnf install -y zstd
# 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 and Centreon GPG key
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y zstd wget gpg
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@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ./*.${{ inputs.package_extension }}
key: ${{ inputs.cache_key }}
fail-on-cache-miss: true

- if: ${{ inputs.package_extension == 'rpm' }}
name: Check packages installation / uninstallation
run: |
error_log="install_error_${{ inputs.distrib }}.log"
for package in ./*.rpm; do
echo "Installing package: $package"
# 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."
pack_name=$(echo $package | sed 's/\.\///' | sed 's/-[0-9\.-]*.el[0-9]*..*.rpm//')
if [[ -f ./tests/packaging/$pack_name.lua ]]; then
echo "Testing package..."
error_output=$(lua tests/packaging/$pack_name.lua 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 $pack_name 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 }}.log"
for package in ./*.deb; do
echo "Installing package: $package"
# 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."
pack_name=$(echo $package | sed 's/\.\///' | sed 's/_[0-9\.-]*~[a-z]*_.*\.deb//')
if [[ -f ./tests/packaging/$pack_name.lua ]]; then
echo "Testing package..."
error_output=$(lua tests/packaging/$pack_name.lua 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 $pack_name 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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG REGISTRY_URL
ARG REGISTRY_URL=docker.io
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the initial url is this https://github.com/centreon/centreon-stream-connector-scripts/blob/d1287cb06b89d96b420d3cff47b77e4ed69f1e67/.github/workflows/docker-packaging.yml#L48C11-L48C75

to avoid reaching the http calls quota at docker official registry, we may want to keep using the internal proxy
if this is to avoid the ARG error message, use the proxy url instead of docker official url


FROM ${REGISTRY_URL}/almalinux:8

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG REGISTRY_URL
ARG REGISTRY_URL=docker.io

FROM ${REGISTRY_URL}/almalinux:9

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG REGISTRY_URL
ARG REGISTRY_URL=docker.centreon.com/centreon

FROM ${REGISTRY_URL}/debian:bookworm

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG REGISTRY_URL
ARG REGISTRY_URL=docker.centreon.com/centreon

FROM ${REGISTRY_URL}/debian:bullseye

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG REGISTRY_URL
ARG REGISTRY_URL=docker.centreon.com/centreon

FROM ${REGISTRY_URL}/ubuntu:jammy

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

dockerize:
needs: [dependency-scan]
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

strategy:
matrix:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/get-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

get-environment:
needs: [dependency-scan]
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
outputs:
stability: ${{ steps.get_environment.outputs.stability }}

Expand Down
66 changes: 57 additions & 9 deletions .github/workflows/lua-cffi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ on:
workflow_dispatch:
pull_request:
paths:
- dependencies/lua-cffi/**
- '.github/workflows/lua-cffi.yml'
- 'dependencies/lua-cffi/**'
push:
branches:
- develop
- master
paths:
- dependencies/lua-cffi/**
- '.github/workflows/lua-cffi.yml'
- 'dependencies/lua-cffi/**'

jobs:
get-environment:
Expand Down Expand Up @@ -44,7 +46,7 @@ jobs:
image: packaging-stream-connectors-nfpm-jammy
distrib: jammy

runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

container:
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest
Expand All @@ -65,10 +67,10 @@ jobs:
else
apt-get update
apt-get install -y make gcc g++ meson cmake libffi-dev
if [ "${{ matrix.distrib }}" = "bookworm" ]; then
apt-get install -y libffi8
else
if [ "${{ matrix.distrib }}" = "bullseye" ]; then
apt-get install -y libffi7
else
apt-get install -y libffi8
fi
fi
shell: bash
Expand All @@ -85,7 +87,7 @@ jobs:
cd cffi-lua-src
mkdir build
cd build
if [ "${{ matrix.distrib }}" = "el9" ]; then
if [[ "${{ matrix.distrib }}" = "el9" ]]; then
meson .. -Dlua_version=5.4
else
meson .. -Dlua_version=5.3
Expand All @@ -111,11 +113,57 @@ jobs:
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 }}
artifact_name: "package-lua-cffi-${{ matrix.distrib }}"

test-packages:
needs: [get-environment, package]
strategy:
fail-fast: false
matrix:
include:
- package_extension: rpm
image: almalinux:8
distrib: el8
- package_extension: rpm
image: almalinux:9
distrib: el9
- package_extension: deb
image: debian:bullseye
distrib: bullseye
- package_extension: deb
image: debian:bookworm
distrib: bookworm
- package_extension: deb
image: ubuntu:jammy
distrib: jammy

runs-on: ubuntu-24.04
container:
image: ${{ matrix.image }}

name: Test lua packages on ${{ matrix.package_extension }} ${{ matrix.distrib }}
steps:

- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Test packaged libs
uses: ./.github/actions/test-packages
with:
package_extension: ${{ matrix.package_extension }}
distrib: ${{ matrix.distrib }}
cache_key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-lua-cffi-${{ matrix.distrib }}

- name: Upload error log
if: failure()
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: install_error_log_${{ matrix.distrib }}
path: install_error_${{ matrix.distrib }}.log

deliver-rpm:
if: ${{ contains(fromJson('["unstable", "testing", "stable"]'), needs.get-environment.outputs.stability) }}
needs: [get-environment, package]
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
distrib: [el8, el9]
Expand All @@ -137,7 +185,7 @@ jobs:
deliver-deb:
if: ${{ contains(fromJson('["unstable", "testing", "stable"]'), needs.get-environment.outputs.stability) }}
needs: [get-environment, package]
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
distrib: [bullseye, bookworm, jammy]
Expand Down
43 changes: 41 additions & 2 deletions .github/workflows/lua-sql-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ on:
workflow_dispatch:
pull_request:
paths:
- dependencies/lua-sql-mysql/**
- '.github/workflows/lua-sql-mysql.yml'
- 'dependencies/lua-sql-mysql/**'
push:
branches:
- develop
- master
paths:
- dependencies/lua-sql-mysql/**
- '.github/workflows/lua-sql-mysql.yml'
- 'dependencies/lua-sql-mysql/**'

jobs:
get-environment:
Expand Down Expand Up @@ -87,6 +89,43 @@ jobs:
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 }}
artifact_name: "package-lua-sql-mysql-${{ matrix.distrib }}"

test-packages:
needs: [get-environment, package]
strategy:
fail-fast: false
matrix:
include:
- package_extension: rpm
image: almalinux:8
distrib: el8
- package_extension: rpm
image: almalinux:9
distrib: el9

runs-on: ubuntu-24.04
container:
image: ${{ matrix.image }}

name: Test lua packages on ${{ matrix.package_extension }} ${{ matrix.distrib }}
steps:

- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Test packaged libs
uses: ./.github/actions/test-packages
with:
package_extension: ${{ matrix.package_extension }}
distrib: ${{ matrix.distrib }}
cache_key: ${{ github.sha }}-${{ github.run_id }}-rpm-lua-sql-mysql-${{ matrix.distrib }}

- name: Upload error log
if: failure()
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: install_error_log_${{ matrix.distrib }}
path: install_error_${{ matrix.distrib }}.log

deliver-rpm:
if: ${{ contains(fromJson('["unstable", "testing", "stable"]'), needs.get-environment.outputs.stability) }}
Expand Down
Loading
Loading