From bd5b1c1df03e47e0e48f92ce3e13172863c16102 Mon Sep 17 00:00:00 2001 From: Evan Adam Date: Wed, 3 Apr 2024 16:02:34 +0200 Subject: [PATCH 01/11] feat(plugin/tests) add new dockerfile for testing purpose FIX:CTOR-474 --- .github/actions/plugins-tests/action.yml | 70 ++++++++++++++++++ .../Dockerfile.packaging-plugins-alma8 | 0 .../Dockerfile.packaging-plugins-alma9 | 0 .../Dockerfile.packaging-plugins-bookworm | 0 .../Dockerfile.packaging-plugins-bullseye | 0 .../Dockerfile.packaging-plugins-centos7 | 0 .../Dockerfile.packaging-plugins-jammy | 0 .../testing/Dockerfile.testing-plugins-alma8 | 69 ++++++++++++++++++ .../testing/Dockerfile.testing-plugins-alma9 | 69 ++++++++++++++++++ .../Dockerfile.testing-plugins-bookworm | 47 ++++++++++++ .../Dockerfile.testing-plugins-bullseye | 47 ++++++++++++ .../testing/Dockerfile.testing-plugins-jammy | 45 ++++++++++++ .../docker-builder-packaging-plugins.yml | 6 +- .../docker-builder-testing-plugins.yml | 73 +++++++++++++++++++ .github/workflows/plugins.yml | 61 +++++++++++++++- .github/workflows/tests-functional.yml | 23 ++---- src/centreon/plugins/dbi.pm | 1 + src/os/linux/local/plugin.pm | 1 + src/storage/datacore/restapi/plugin.pm | 1 + 19 files changed, 491 insertions(+), 22 deletions(-) create mode 100644 .github/actions/plugins-tests/action.yml rename .github/docker/{ => packaging}/Dockerfile.packaging-plugins-alma8 (100%) rename .github/docker/{ => packaging}/Dockerfile.packaging-plugins-alma9 (100%) rename .github/docker/{ => packaging}/Dockerfile.packaging-plugins-bookworm (100%) rename .github/docker/{ => packaging}/Dockerfile.packaging-plugins-bullseye (100%) rename .github/docker/{ => packaging}/Dockerfile.packaging-plugins-centos7 (100%) rename .github/docker/{ => packaging}/Dockerfile.packaging-plugins-jammy (100%) create mode 100644 .github/docker/testing/Dockerfile.testing-plugins-alma8 create mode 100644 .github/docker/testing/Dockerfile.testing-plugins-alma9 create mode 100644 .github/docker/testing/Dockerfile.testing-plugins-bookworm create mode 100644 .github/docker/testing/Dockerfile.testing-plugins-bullseye create mode 100644 .github/docker/testing/Dockerfile.testing-plugins-jammy create mode 100644 .github/workflows/docker-builder-testing-plugins.yml diff --git a/.github/actions/plugins-tests/action.yml b/.github/actions/plugins-tests/action.yml new file mode 100644 index 0000000000..e19bfaf487 --- /dev/null +++ b/.github/actions/plugins-tests/action.yml @@ -0,0 +1,70 @@ +name: "deb-delivery" +description: "Deliver DEB packages" +inputs: + cache-key: + description: "The plugin packaged cache key" + required: true + plugin-name: + description: "plugin name to install from the cache" + required: true + package-extension: + description: "either rpm or deb, used to install the plugin with the correct binary" + required: true + +runs: + using: "composite" + steps: + + - name: get plugin cached + uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 + with: + path: ./*.${{ inputs.package-extension }} + key: ${{ inputs.cache-key }} + fail-on-cache-miss: true + + - name: install plugin for deb distrib + if: ${{inputs.package-extension == 'deb' }} + shell: bash + run: | + apt update + pluginlowercase="${{inputs.plugin-name}}" + apt install -y ./${pluginlowercase,,}*.deb + # in bash ,, make the variable lowercase. + + - name: install plugin for rpm distrib + if: ${{inputs.package-extension == 'rpm' }} + shell: bash + run: dnf install -y ./${{inputs.plugin-name}}*.rpm + # deb and rpm file contain the version/date in the name, hence the wildcard in the name. + + - name: launch snmp simulator process to answer any snmp query. + shell: bash + run: | + useradd snmp + mkdir -p /var/lib/snmp/cert_indexes/ + # this folder seem needed to launch snmp plugins. I didn't reproduce in my env, but without it, + # the first snmp plugin launched by robot prepend the message "Created directory: /var/lib/snmp/cert_indexes". + chown snmp:snmp -R /var/lib/snmp/cert_indexes/ + snmpsim-command-responder --logging-method=null --agent-udpv4-endpoint=127.0.0.1:2024 --process-user=snmp --process-group=snmp --data-dir='./tests/robot' & + + - name: get list of robot file to launch from packagings configuration. + shell: bash + run: | + + string="" + while read i + do + testsname="./tests/robot/$i" + if [[ $i == *"/" && -e $testsname ]] + then + string="$string $testsname" + fi + done <<< $(jq -r '.files[]' ./packaging/${{inputs.plugin-name}}/pkg.json) + + echo string + if [[ ! -z "$string" ]] ; then + robot $string + else + exit 0 + # if no tests where found we quit. we still have tested the plugin is installable, tests will be added little by little. + fi diff --git a/.github/docker/Dockerfile.packaging-plugins-alma8 b/.github/docker/packaging/Dockerfile.packaging-plugins-alma8 similarity index 100% rename from .github/docker/Dockerfile.packaging-plugins-alma8 rename to .github/docker/packaging/Dockerfile.packaging-plugins-alma8 diff --git a/.github/docker/Dockerfile.packaging-plugins-alma9 b/.github/docker/packaging/Dockerfile.packaging-plugins-alma9 similarity index 100% rename from .github/docker/Dockerfile.packaging-plugins-alma9 rename to .github/docker/packaging/Dockerfile.packaging-plugins-alma9 diff --git a/.github/docker/Dockerfile.packaging-plugins-bookworm b/.github/docker/packaging/Dockerfile.packaging-plugins-bookworm similarity index 100% rename from .github/docker/Dockerfile.packaging-plugins-bookworm rename to .github/docker/packaging/Dockerfile.packaging-plugins-bookworm diff --git a/.github/docker/Dockerfile.packaging-plugins-bullseye b/.github/docker/packaging/Dockerfile.packaging-plugins-bullseye similarity index 100% rename from .github/docker/Dockerfile.packaging-plugins-bullseye rename to .github/docker/packaging/Dockerfile.packaging-plugins-bullseye diff --git a/.github/docker/Dockerfile.packaging-plugins-centos7 b/.github/docker/packaging/Dockerfile.packaging-plugins-centos7 similarity index 100% rename from .github/docker/Dockerfile.packaging-plugins-centos7 rename to .github/docker/packaging/Dockerfile.packaging-plugins-centos7 diff --git a/.github/docker/Dockerfile.packaging-plugins-jammy b/.github/docker/packaging/Dockerfile.packaging-plugins-jammy similarity index 100% rename from .github/docker/Dockerfile.packaging-plugins-jammy rename to .github/docker/packaging/Dockerfile.packaging-plugins-jammy diff --git a/.github/docker/testing/Dockerfile.testing-plugins-alma8 b/.github/docker/testing/Dockerfile.testing-plugins-alma8 new file mode 100644 index 0000000000..80e408f2d8 --- /dev/null +++ b/.github/docker/testing/Dockerfile.testing-plugins-alma8 @@ -0,0 +1,69 @@ +ARG REGISTRY_URL + +FROM ${REGISTRY_URL}/almalinux:8 + +RUN bash -e <> /etc/yum.repos.d/centreon-plugins.repo + +mkdir -p /var/lib/centreon/centplugins/ +chmod 777 /var/lib/centreon/centplugins/ + +dnf clean all + +EOF + +WORKDIR /tests \ No newline at end of file diff --git a/.github/docker/testing/Dockerfile.testing-plugins-alma9 b/.github/docker/testing/Dockerfile.testing-plugins-alma9 new file mode 100644 index 0000000000..1f2501dbdc --- /dev/null +++ b/.github/docker/testing/Dockerfile.testing-plugins-alma9 @@ -0,0 +1,69 @@ +ARG REGISTRY_URL + +FROM ${REGISTRY_URL}/almalinux:9 + +RUN bash -e <> /etc/yum.repos.d/centreon-plugins.repo + +mkdir -p /var/lib/centreon/centplugins/ +chmod 777 /var/lib/centreon/centplugins/ + +dnf clean all + +EOF + +WORKDIR /tests diff --git a/.github/docker/testing/Dockerfile.testing-plugins-bookworm b/.github/docker/testing/Dockerfile.testing-plugins-bookworm new file mode 100644 index 0000000000..ac631a3dd8 --- /dev/null +++ b/.github/docker/testing/Dockerfile.testing-plugins-bookworm @@ -0,0 +1,47 @@ +ARG REGISTRY_URL + +FROM ${REGISTRY_URL}/debian:bookworm + +ENV DEBIAN_FRONTEND noninteractive + +# fix locale +RUN bash -e < /dev/null 2>&1 +apt-get update + +mkdir -p /var/lib/centreon/centplugins/ +chmod 777 /var/lib/centreon/centplugins/ + +apt-get clean + +EOF diff --git a/.github/docker/testing/Dockerfile.testing-plugins-bullseye b/.github/docker/testing/Dockerfile.testing-plugins-bullseye new file mode 100644 index 0000000000..a8485968db --- /dev/null +++ b/.github/docker/testing/Dockerfile.testing-plugins-bullseye @@ -0,0 +1,47 @@ +ARG REGISTRY_URL + +FROM ${REGISTRY_URL}/debian:bullseye + +ENV DEBIAN_FRONTEND noninteractive + +# fix locale +RUN bash -e < /dev/null 2>&1 +apt-get update + +mkdir -p /var/lib/centreon/centplugins/ +chmod 777 /var/lib/centreon/centplugins/ + +apt-get clean + + +EOF diff --git a/.github/docker/testing/Dockerfile.testing-plugins-jammy b/.github/docker/testing/Dockerfile.testing-plugins-jammy new file mode 100644 index 0000000000..46d8041cb3 --- /dev/null +++ b/.github/docker/testing/Dockerfile.testing-plugins-jammy @@ -0,0 +1,45 @@ +ARG REGISTRY_URL + +FROM ${REGISTRY_URL}/ubuntu:jammy + +ENV DEBIAN_FRONTEND noninteractive + +# fix locale +RUN bash -e < /dev/null 2>&1 +apt-get update + +mkdir -p /var/lib/centreon/centplugins/ +chmod 777 /var/lib/centreon/centplugins/ + +apt-get clean + +EOF diff --git a/.github/workflows/docker-builder-packaging-plugins.yml b/.github/workflows/docker-builder-packaging-plugins.yml index f55989d4b5..99cdb0da5e 100644 --- a/.github/workflows/docker-builder-packaging-plugins.yml +++ b/.github/workflows/docker-builder-packaging-plugins.yml @@ -11,11 +11,11 @@ on: - develop paths: - ".github/workflows/docker-builder-packaging-plugins.yml" - - ".github/docker/*" + - ".github/docker/packaging/*" pull_request: paths: - ".github/workflows/docker-builder-packaging-plugins.yml" - - ".github/docker/*" + - ".github/docker/packaging/*" jobs: create-and-push-docker: @@ -68,7 +68,7 @@ jobs: - uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 with: - file: .github/docker/Dockerfile.${{ matrix.dockerfile }} + file: .github/docker/packaging/Dockerfile.${{ matrix.dockerfile }} context: . build-args: "REGISTRY_URL=${{ vars.DOCKER_PROXY_REGISTRY_URL }}" pull: true diff --git a/.github/workflows/docker-builder-testing-plugins.yml b/.github/workflows/docker-builder-testing-plugins.yml new file mode 100644 index 0000000000..9ffc0aaf87 --- /dev/null +++ b/.github/workflows/docker-builder-testing-plugins.yml @@ -0,0 +1,73 @@ +name: docker-builder-testing-plugins + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +on: + workflow_dispatch: + push: + branches: + - develop + paths: + - ".github/workflows/docker-builder-testing-plugins.yml" + - ".github/docker/testing/*" + pull_request: + paths: + - ".github/workflows/docker-builder-testing-plugins.yml" + - ".github/docker/testing/*" + +jobs: + create-and-push-docker: + strategy: + matrix: + include: + - runner: ubuntu-22.04 + dockerfile: alma8 + image: alma8 + - runner: ubuntu-22.04 + dockerfile: alma9 + image: alma9 + - runner: ubuntu-22.04 + dockerfile: bullseye + image: bullseye + - runner: ["self-hosted", "collect-arm64"] + dockerfile: bullseye + image: bullseye-arm64 + - runner: ubuntu-22.04 + dockerfile: bookworm + image: bookworm + - runner: ubuntu-22.04 + dockerfile: jammy + image: jammy + + runs-on: ${{ matrix.runner }} + + steps: + - name: Checkout sources + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Login to Registry + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 + with: + registry: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }} + username: ${{ secrets.DOCKER_REGISTRY_ID }} + password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} + + - name: Login to proxy registry + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 + with: + registry: ${{ vars.DOCKER_PROXY_REGISTRY_URL }} + username: ${{ secrets.DOCKER_REGISTRY_ID }} + password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} + + - uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 + + - uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 + with: + file: .github/docker/testing/Dockerfile.testing-plugins-${{ matrix.dockerfile }} + context: . + build-args: "REGISTRY_URL=${{ vars.DOCKER_PROXY_REGISTRY_URL }}" + pull: true + push: true + tags: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/testing-plugins-${{ matrix.image }}:latest diff --git a/.github/workflows/plugins.yml b/.github/workflows/plugins.yml index c5d579dfd6..402c2f929f 100644 --- a/.github/workflows/plugins.yml +++ b/.github/workflows/plugins.yml @@ -28,6 +28,7 @@ jobs: runs-on: ubuntu-22.04 outputs: plugins: ${{ steps.get_plugins.outputs.plugins }} + pluginslist: ${{ steps.get_plugins_list.outputs.pluginslist }} steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: @@ -76,15 +77,26 @@ jobs: PLUGINS="$(python3 .github/scripts/process-plugins.py '${{ steps.filter.outputs.common == 'true' }}')" echo "plugins=$(echo $PLUGINS)" >> $GITHUB_OUTPUT - + echo $PLUGINS if [ "$PLUGINS" == '' ]; then echo "::notice::There are no modifications to the plugins packages" fi + + shell: bash + - name: Get plugins for tests matrix + id: get_plugins_list + run: | + pluginsarray=() + for f in ${{ steps.get_plugins.outputs.plugins }}; do + pluginsarray+=($f) + done + echo "pluginslist=$(jq -cn '$ARGS.positional' --args ${pluginsarray[@]})" >> $GITHUB_OUTPUT + shell: bash fatpacker: - if: ${{ needs.get-plugins.outputs.plugins != '' }} - needs: [get-environment, get-plugins] + if: ${{needs.get-plugins.outputs.plugins != ''}} + needs: [ get-environment, get-plugins ] runs-on: ubuntu-22.04 steps: - name: Checkout sources @@ -109,6 +121,7 @@ jobs: path: ./build/ key: fatpacked-plugins-${{ github.sha }}-${{ github.run_id }} + package: runs-on: ubuntu-22.04 needs: [get-environment, get-plugins, fatpacker] @@ -243,8 +256,48 @@ jobs: rpm_gpg_signing_passphrase: ${{ secrets.RPM_GPG_SIGNING_PASSPHRASE }} stability: ${{ needs.get-environment.outputs.stability }} + test-plugins: + needs: [get-environment, get-plugins, package] + strategy: + fail-fast: false + matrix: + plugin-name: ${{fromJson(needs.get-plugins.outputs.pluginslist) }} + distrib: [el8, el9, jammy, bullseye, bookworm] + include: + - package_extension: rpm + image: testing-plugins-alma8 + distrib: el8 + - package_extension: rpm + image: testing-plugins-alma9 + distrib: el9 + - package_extension: deb + image: testing-plugins-bullseye + distrib: bullseye + - package_extension: deb + image: testing-plugins-bookworm + distrib: bookworm + - package_extension: deb + image: testing-plugins-jammy + distrib: jammy + + runs-on: ubuntu-22.04 + container: + image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }} + credentials: + username: ${{ secrets.DOCKER_REGISTRY_ID }} + password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} + steps: + - name: Checkout sources + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - uses: ./.github/actions/plugins-tests + with: + cache-key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} + package-extension: ${{ matrix.package_extension }} + plugin-name: ${{ matrix.plugin-name }} + deliver: - needs: [get-environment, package] + needs: [ get-environment, package ] if: ${{ contains(fromJson('["stable", "testing", "unstable"]'), needs.get-environment.outputs.stability) }} uses: ./.github/workflows/plugin-delivery.yml with: diff --git a/.github/workflows/tests-functional.yml b/.github/workflows/tests-functional.yml index b604dc57c0..77527d9033 100644 --- a/.github/workflows/tests-functional.yml +++ b/.github/workflows/tests-functional.yml @@ -1,19 +1,16 @@ name: functional-tests +on: + workflow_call: + inputs: + plugin-cache: + description: The plugin packaged cache name + type: string + required: true concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true -on: - workflow_dispatch: - pull_request: - paths: - - '.github/workflows/tests-functional.yml' - - 'src/**' - - 'tests/functional/**' - - 'tests/resources/mockoon/**' - - 'tests/resources/snmp/**' - jobs: functional-tests-with-robot: runs-on: ubuntu-22.04 @@ -67,10 +64,6 @@ jobs: - name: Run Robot Framework tests run: | - sudo mkdir -p /var/lib/centreon/centplugins/ - sudo chmod 777 /var/lib/centreon/centplugins/ sudo useradd snmp - sudo mkdir -p /usr/snmpsim/data - sudo cp -r tests/robot/* /usr/snmpsim/data/ - snmpsimd --logging-method=null --agent-udpv4-endpoint=127.0.0.1:2024 --process-user=snmp --process-group=snmp & + snmpsimd --logging-method=null --agent-udpv4-endpoint=127.0.0.1:2024 --process-user=snmp --process-group=snmp --data-dir='./tests/robot'& robot tests/robot diff --git a/src/centreon/plugins/dbi.pm b/src/centreon/plugins/dbi.pm index 3c1ec57f5f..8821c44356 100644 --- a/src/centreon/plugins/dbi.pm +++ b/src/centreon/plugins/dbi.pm @@ -26,6 +26,7 @@ use DBI; use Digest::MD5 qw(md5_hex); use POSIX qw(:signal_h); + my %handlers = ( ALRM => {} ); sub new { diff --git a/src/os/linux/local/plugin.pm b/src/os/linux/local/plugin.pm index fc59a8685b..3c4cf36a18 100644 --- a/src/os/linux/local/plugin.pm +++ b/src/os/linux/local/plugin.pm @@ -18,6 +18,7 @@ # limitations under the License. # + package os::linux::local::plugin; use strict; diff --git a/src/storage/datacore/restapi/plugin.pm b/src/storage/datacore/restapi/plugin.pm index 98aed2f641..d24745ed91 100644 --- a/src/storage/datacore/restapi/plugin.pm +++ b/src/storage/datacore/restapi/plugin.pm @@ -23,5 +23,6 @@ sub new { 1; =head1 PLUGIN DESCRIPTION + Check Datacore using rest API. From 4c04e00749a9aa124baaac2f40e2d53b15840579 Mon Sep 17 00:00:00 2001 From: Evan Adam Date: Mon, 8 Apr 2024 11:18:01 +0200 Subject: [PATCH 02/11] fix packaging path wrong and fix used on it FIX:CTOR-474 historically, nfpm configuration (pkg.json) where in a directory named after the plugin package name. some dir where wrongly named, and a fix was made in the code to manage this case. I fixed every packages dir name. --- .github/scripts/process-plugins.py | 2 +- .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 52 files changed, 1 insertion(+), 1 deletion(-) rename packaging/{centreon-plugin-Applications-Antivirus-Clamav-Ssh => centreon-plugin-Applications-Clamav-Ssh}/deb.json (100%) rename packaging/{centreon-plugin-Applications-Antivirus-Clamav-Ssh => centreon-plugin-Applications-Clamav-Ssh}/pkg.json (100%) rename packaging/{centreon-plugin-Applications-Antivirus-Clamav-Ssh => centreon-plugin-Applications-Clamav-Ssh}/rpm.json (100%) rename packaging/{centreon-plugin-Applications-Databases-Cassandra-Jmx => centreon-plugin-Applications-Database-Cassandra-Jmx}/deb.json (100%) rename packaging/{centreon-plugin-Applications-Databases-Cassandra-Jmx => centreon-plugin-Applications-Database-Cassandra-Jmx}/pkg.json (100%) rename packaging/{centreon-plugin-Applications-Databases-Cassandra-Jmx => centreon-plugin-Applications-Database-Cassandra-Jmx}/rpm.json (100%) rename packaging/{centreon-plugin-Applications-Databases-Couchdb-Restapi => centreon-plugin-Applications-Database-Couchdb-Restapi}/deb.json (100%) rename packaging/{centreon-plugin-Applications-Databases-Couchdb-Restapi => centreon-plugin-Applications-Database-Couchdb-Restapi}/pkg.json (100%) rename packaging/{centreon-plugin-Applications-Databases-Couchdb-Restapi => centreon-plugin-Applications-Database-Couchdb-Restapi}/rpm.json (100%) rename packaging/{centreon-plugin-Applications-Netbackup-SSH => centreon-plugin-Applications-Netbackup-Ssh}/deb.json (100%) rename packaging/{centreon-plugin-Applications-Netbackup-SSH => centreon-plugin-Applications-Netbackup-Ssh}/pkg.json (100%) rename packaging/{centreon-plugin-Applications-Netbackup-SSH => centreon-plugin-Applications-Netbackup-Ssh}/rpm.json (100%) rename packaging/{centreon-plugin-Applications-Pacemaker-SSH => centreon-plugin-Applications-Pacemaker-Ssh}/deb.json (100%) rename packaging/{centreon-plugin-Applications-Pacemaker-SSH => centreon-plugin-Applications-Pacemaker-Ssh}/pkg.json (100%) rename packaging/{centreon-plugin-Applications-Pacemaker-SSH => centreon-plugin-Applications-Pacemaker-Ssh}/rpm.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-DataFactory-Factory-Api => centreon-plugin-Cloud-Azure-DataFactory-Factories-Api}/deb.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-DataFactory-Factory-Api => centreon-plugin-Cloud-Azure-DataFactory-Factories-Api}/pkg.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-DataFactory-Factory-Api => centreon-plugin-Cloud-Azure-DataFactory-Factories-Api}/rpm.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Database-Mariadb-Api => centreon-plugin-Cloud-Azure-Database-MariaDB-Api}/deb.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Database-Mariadb-Api => centreon-plugin-Cloud-Azure-Database-MariaDB-Api}/pkg.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Database-Mariadb-Api => centreon-plugin-Cloud-Azure-Database-MariaDB-Api}/rpm.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Database-Mysql-Api => centreon-plugin-Cloud-Azure-Database-MySQL-Api}/deb.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Database-Mysql-Api => centreon-plugin-Cloud-Azure-Database-MySQL-Api}/pkg.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Database-Mysql-Api => centreon-plugin-Cloud-Azure-Database-MySQL-Api}/rpm.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Database-SqlManagedInstance => centreon-plugin-Cloud-Azure-Database-SqlManagedInstance-Api}/deb.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Database-SqlManagedInstance => centreon-plugin-Cloud-Azure-Database-SqlManagedInstance-Api}/pkg.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Database-SqlManagedInstance => centreon-plugin-Cloud-Azure-Database-SqlManagedInstance-Api}/rpm.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Devtools-Appconfiguration => centreon-plugin-Cloud-Azure-DevTools-AppConfiguration-Api}/deb.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Devtools-Appconfiguration => centreon-plugin-Cloud-Azure-DevTools-AppConfiguration-Api}/pkg.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Devtools-Appconfiguration => centreon-plugin-Cloud-Azure-DevTools-AppConfiguration-Api}/rpm.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Integration-Eventgrid-Api => centreon-plugin-Cloud-Azure-Integration-EventGrid-Api}/deb.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Integration-Eventgrid-Api => centreon-plugin-Cloud-Azure-Integration-EventGrid-Api}/pkg.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Integration-Eventgrid-Api => centreon-plugin-Cloud-Azure-Integration-EventGrid-Api}/rpm.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Network-TrafficManager => centreon-plugin-Cloud-Azure-Network-TrafficManager-Api}/deb.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Network-TrafficManager => centreon-plugin-Cloud-Azure-Network-TrafficManager-Api}/pkg.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Network-TrafficManager => centreon-plugin-Cloud-Azure-Network-TrafficManager-Api}/rpm.json (100%) rename packaging/{centreon-plugin-Hardware-Sensors-Rittal-Cmc3-Snmp => centreon-plugin-Hardware-Sensors-Rittal-Cmc-Snmp}/deb.json (100%) rename packaging/{centreon-plugin-Hardware-Sensors-Rittal-Cmc3-Snmp => centreon-plugin-Hardware-Sensors-Rittal-Cmc-Snmp}/pkg.json (100%) rename packaging/{centreon-plugin-Hardware-Sensors-Rittal-Cmc3-Snmp => centreon-plugin-Hardware-Sensors-Rittal-Cmc-Snmp}/rpm.json (100%) rename packaging/{centreon-plugin-Network-Switchs-Dell-Os10-Snmp => centreon-plugin-Network-Dell-Os10-Snmp}/deb.json (100%) rename packaging/{centreon-plugin-Network-Switchs-Dell-Os10-Snmp => centreon-plugin-Network-Dell-Os10-Snmp}/pkg.json (100%) rename packaging/{centreon-plugin-Network-Switchs-Dell-Os10-Snmp => centreon-plugin-Network-Dell-Os10-Snmp}/rpm.json (100%) rename packaging/{centreon-plugin-Network-Switchs-Dell-Xseries-Snmp => centreon-plugin-Network-Dell-Xseries-Snmp}/deb.json (100%) rename packaging/{centreon-plugin-Network-Switchs-Dell-Xseries-Snmp => centreon-plugin-Network-Dell-Xseries-Snmp}/pkg.json (100%) rename packaging/{centreon-plugin-Network-Switchs-Dell-Xseries-Snmp => centreon-plugin-Network-Dell-Xseries-Snmp}/rpm.json (100%) rename packaging/{centreon-plugin-Network-Firewalls-Juniper-Mag-Snmp => centreon-plugin-Network-Juniper-Mag-Snmp}/deb.json (100%) rename packaging/{centreon-plugin-Network-Firewalls-Juniper-Mag-Snmp => centreon-plugin-Network-Juniper-Mag-Snmp}/pkg.json (100%) rename packaging/{centreon-plugin-Network-Firewalls-Juniper-Mag-Snmp => centreon-plugin-Network-Juniper-Mag-Snmp}/rpm.json (100%) rename packaging/{centreon-plugin-Network-Sonus-Sbc-Snmp => centreon-plugin-Network-Sonus-SBC-Snmp}/deb.json (100%) rename packaging/{centreon-plugin-Network-Sonus-Sbc-Snmp => centreon-plugin-Network-Sonus-SBC-Snmp}/pkg.json (100%) rename packaging/{centreon-plugin-Network-Sonus-Sbc-Snmp => centreon-plugin-Network-Sonus-SBC-Snmp}/rpm.json (100%) diff --git a/.github/scripts/process-plugins.py b/.github/scripts/process-plugins.py index f4c80badbd..336ccd4353 100644 --- a/.github/scripts/process-plugins.py +++ b/.github/scripts/process-plugins.py @@ -43,7 +43,7 @@ packaging_path = re.search('.*\/(centreon-plugin-.*)\/pkg.json', filepath).group(1) if not packaging_path == packaging["pkg_name"]: - packaging_path = packaging_path + "=>" + packaging["pkg_name"] + packaging_path = packaging["pkg_name"] directory_path = re.search('^(.+)\/pkg.json', filepath).group(1) diff --git a/packaging/centreon-plugin-Applications-Antivirus-Clamav-Ssh/deb.json b/packaging/centreon-plugin-Applications-Clamav-Ssh/deb.json similarity index 100% rename from packaging/centreon-plugin-Applications-Antivirus-Clamav-Ssh/deb.json rename to packaging/centreon-plugin-Applications-Clamav-Ssh/deb.json diff --git a/packaging/centreon-plugin-Applications-Antivirus-Clamav-Ssh/pkg.json b/packaging/centreon-plugin-Applications-Clamav-Ssh/pkg.json similarity index 100% rename from packaging/centreon-plugin-Applications-Antivirus-Clamav-Ssh/pkg.json rename to packaging/centreon-plugin-Applications-Clamav-Ssh/pkg.json diff --git a/packaging/centreon-plugin-Applications-Antivirus-Clamav-Ssh/rpm.json b/packaging/centreon-plugin-Applications-Clamav-Ssh/rpm.json similarity index 100% rename from packaging/centreon-plugin-Applications-Antivirus-Clamav-Ssh/rpm.json rename to packaging/centreon-plugin-Applications-Clamav-Ssh/rpm.json diff --git a/packaging/centreon-plugin-Applications-Databases-Cassandra-Jmx/deb.json b/packaging/centreon-plugin-Applications-Database-Cassandra-Jmx/deb.json similarity index 100% rename from packaging/centreon-plugin-Applications-Databases-Cassandra-Jmx/deb.json rename to packaging/centreon-plugin-Applications-Database-Cassandra-Jmx/deb.json diff --git a/packaging/centreon-plugin-Applications-Databases-Cassandra-Jmx/pkg.json b/packaging/centreon-plugin-Applications-Database-Cassandra-Jmx/pkg.json similarity index 100% rename from packaging/centreon-plugin-Applications-Databases-Cassandra-Jmx/pkg.json rename to packaging/centreon-plugin-Applications-Database-Cassandra-Jmx/pkg.json diff --git a/packaging/centreon-plugin-Applications-Databases-Cassandra-Jmx/rpm.json b/packaging/centreon-plugin-Applications-Database-Cassandra-Jmx/rpm.json similarity index 100% rename from packaging/centreon-plugin-Applications-Databases-Cassandra-Jmx/rpm.json rename to packaging/centreon-plugin-Applications-Database-Cassandra-Jmx/rpm.json diff --git a/packaging/centreon-plugin-Applications-Databases-Couchdb-Restapi/deb.json b/packaging/centreon-plugin-Applications-Database-Couchdb-Restapi/deb.json similarity index 100% rename from packaging/centreon-plugin-Applications-Databases-Couchdb-Restapi/deb.json rename to packaging/centreon-plugin-Applications-Database-Couchdb-Restapi/deb.json diff --git a/packaging/centreon-plugin-Applications-Databases-Couchdb-Restapi/pkg.json b/packaging/centreon-plugin-Applications-Database-Couchdb-Restapi/pkg.json similarity index 100% rename from packaging/centreon-plugin-Applications-Databases-Couchdb-Restapi/pkg.json rename to packaging/centreon-plugin-Applications-Database-Couchdb-Restapi/pkg.json diff --git a/packaging/centreon-plugin-Applications-Databases-Couchdb-Restapi/rpm.json b/packaging/centreon-plugin-Applications-Database-Couchdb-Restapi/rpm.json similarity index 100% rename from packaging/centreon-plugin-Applications-Databases-Couchdb-Restapi/rpm.json rename to packaging/centreon-plugin-Applications-Database-Couchdb-Restapi/rpm.json diff --git a/packaging/centreon-plugin-Applications-Netbackup-SSH/deb.json b/packaging/centreon-plugin-Applications-Netbackup-Ssh/deb.json similarity index 100% rename from packaging/centreon-plugin-Applications-Netbackup-SSH/deb.json rename to packaging/centreon-plugin-Applications-Netbackup-Ssh/deb.json diff --git a/packaging/centreon-plugin-Applications-Netbackup-SSH/pkg.json b/packaging/centreon-plugin-Applications-Netbackup-Ssh/pkg.json similarity index 100% rename from packaging/centreon-plugin-Applications-Netbackup-SSH/pkg.json rename to packaging/centreon-plugin-Applications-Netbackup-Ssh/pkg.json diff --git a/packaging/centreon-plugin-Applications-Netbackup-SSH/rpm.json b/packaging/centreon-plugin-Applications-Netbackup-Ssh/rpm.json similarity index 100% rename from packaging/centreon-plugin-Applications-Netbackup-SSH/rpm.json rename to packaging/centreon-plugin-Applications-Netbackup-Ssh/rpm.json diff --git a/packaging/centreon-plugin-Applications-Pacemaker-SSH/deb.json b/packaging/centreon-plugin-Applications-Pacemaker-Ssh/deb.json similarity index 100% rename from packaging/centreon-plugin-Applications-Pacemaker-SSH/deb.json rename to packaging/centreon-plugin-Applications-Pacemaker-Ssh/deb.json diff --git a/packaging/centreon-plugin-Applications-Pacemaker-SSH/pkg.json b/packaging/centreon-plugin-Applications-Pacemaker-Ssh/pkg.json similarity index 100% rename from packaging/centreon-plugin-Applications-Pacemaker-SSH/pkg.json rename to packaging/centreon-plugin-Applications-Pacemaker-Ssh/pkg.json diff --git a/packaging/centreon-plugin-Applications-Pacemaker-SSH/rpm.json b/packaging/centreon-plugin-Applications-Pacemaker-Ssh/rpm.json similarity index 100% rename from packaging/centreon-plugin-Applications-Pacemaker-SSH/rpm.json rename to packaging/centreon-plugin-Applications-Pacemaker-Ssh/rpm.json diff --git a/packaging/centreon-plugin-Cloud-Azure-DataFactory-Factory-Api/deb.json b/packaging/centreon-plugin-Cloud-Azure-DataFactory-Factories-Api/deb.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-DataFactory-Factory-Api/deb.json rename to packaging/centreon-plugin-Cloud-Azure-DataFactory-Factories-Api/deb.json diff --git a/packaging/centreon-plugin-Cloud-Azure-DataFactory-Factory-Api/pkg.json b/packaging/centreon-plugin-Cloud-Azure-DataFactory-Factories-Api/pkg.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-DataFactory-Factory-Api/pkg.json rename to packaging/centreon-plugin-Cloud-Azure-DataFactory-Factories-Api/pkg.json diff --git a/packaging/centreon-plugin-Cloud-Azure-DataFactory-Factory-Api/rpm.json b/packaging/centreon-plugin-Cloud-Azure-DataFactory-Factories-Api/rpm.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-DataFactory-Factory-Api/rpm.json rename to packaging/centreon-plugin-Cloud-Azure-DataFactory-Factories-Api/rpm.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Database-Mariadb-Api/deb.json b/packaging/centreon-plugin-Cloud-Azure-Database-MariaDB-Api/deb.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Database-Mariadb-Api/deb.json rename to packaging/centreon-plugin-Cloud-Azure-Database-MariaDB-Api/deb.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Database-Mariadb-Api/pkg.json b/packaging/centreon-plugin-Cloud-Azure-Database-MariaDB-Api/pkg.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Database-Mariadb-Api/pkg.json rename to packaging/centreon-plugin-Cloud-Azure-Database-MariaDB-Api/pkg.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Database-Mariadb-Api/rpm.json b/packaging/centreon-plugin-Cloud-Azure-Database-MariaDB-Api/rpm.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Database-Mariadb-Api/rpm.json rename to packaging/centreon-plugin-Cloud-Azure-Database-MariaDB-Api/rpm.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Database-Mysql-Api/deb.json b/packaging/centreon-plugin-Cloud-Azure-Database-MySQL-Api/deb.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Database-Mysql-Api/deb.json rename to packaging/centreon-plugin-Cloud-Azure-Database-MySQL-Api/deb.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Database-Mysql-Api/pkg.json b/packaging/centreon-plugin-Cloud-Azure-Database-MySQL-Api/pkg.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Database-Mysql-Api/pkg.json rename to packaging/centreon-plugin-Cloud-Azure-Database-MySQL-Api/pkg.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Database-Mysql-Api/rpm.json b/packaging/centreon-plugin-Cloud-Azure-Database-MySQL-Api/rpm.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Database-Mysql-Api/rpm.json rename to packaging/centreon-plugin-Cloud-Azure-Database-MySQL-Api/rpm.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance/deb.json b/packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance-Api/deb.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance/deb.json rename to packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance-Api/deb.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance/pkg.json b/packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance-Api/pkg.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance/pkg.json rename to packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance-Api/pkg.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance/rpm.json b/packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance-Api/rpm.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance/rpm.json rename to packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance-Api/rpm.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Devtools-Appconfiguration/deb.json b/packaging/centreon-plugin-Cloud-Azure-DevTools-AppConfiguration-Api/deb.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Devtools-Appconfiguration/deb.json rename to packaging/centreon-plugin-Cloud-Azure-DevTools-AppConfiguration-Api/deb.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Devtools-Appconfiguration/pkg.json b/packaging/centreon-plugin-Cloud-Azure-DevTools-AppConfiguration-Api/pkg.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Devtools-Appconfiguration/pkg.json rename to packaging/centreon-plugin-Cloud-Azure-DevTools-AppConfiguration-Api/pkg.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Devtools-Appconfiguration/rpm.json b/packaging/centreon-plugin-Cloud-Azure-DevTools-AppConfiguration-Api/rpm.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Devtools-Appconfiguration/rpm.json rename to packaging/centreon-plugin-Cloud-Azure-DevTools-AppConfiguration-Api/rpm.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Integration-Eventgrid-Api/deb.json b/packaging/centreon-plugin-Cloud-Azure-Integration-EventGrid-Api/deb.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Integration-Eventgrid-Api/deb.json rename to packaging/centreon-plugin-Cloud-Azure-Integration-EventGrid-Api/deb.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Integration-Eventgrid-Api/pkg.json b/packaging/centreon-plugin-Cloud-Azure-Integration-EventGrid-Api/pkg.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Integration-Eventgrid-Api/pkg.json rename to packaging/centreon-plugin-Cloud-Azure-Integration-EventGrid-Api/pkg.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Integration-Eventgrid-Api/rpm.json b/packaging/centreon-plugin-Cloud-Azure-Integration-EventGrid-Api/rpm.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Integration-Eventgrid-Api/rpm.json rename to packaging/centreon-plugin-Cloud-Azure-Integration-EventGrid-Api/rpm.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager/deb.json b/packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager-Api/deb.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager/deb.json rename to packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager-Api/deb.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager/pkg.json b/packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager-Api/pkg.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager/pkg.json rename to packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager-Api/pkg.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager/rpm.json b/packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager-Api/rpm.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager/rpm.json rename to packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager-Api/rpm.json diff --git a/packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc3-Snmp/deb.json b/packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc-Snmp/deb.json similarity index 100% rename from packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc3-Snmp/deb.json rename to packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc-Snmp/deb.json diff --git a/packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc3-Snmp/pkg.json b/packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc-Snmp/pkg.json similarity index 100% rename from packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc3-Snmp/pkg.json rename to packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc-Snmp/pkg.json diff --git a/packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc3-Snmp/rpm.json b/packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc-Snmp/rpm.json similarity index 100% rename from packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc3-Snmp/rpm.json rename to packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc-Snmp/rpm.json diff --git a/packaging/centreon-plugin-Network-Switchs-Dell-Os10-Snmp/deb.json b/packaging/centreon-plugin-Network-Dell-Os10-Snmp/deb.json similarity index 100% rename from packaging/centreon-plugin-Network-Switchs-Dell-Os10-Snmp/deb.json rename to packaging/centreon-plugin-Network-Dell-Os10-Snmp/deb.json diff --git a/packaging/centreon-plugin-Network-Switchs-Dell-Os10-Snmp/pkg.json b/packaging/centreon-plugin-Network-Dell-Os10-Snmp/pkg.json similarity index 100% rename from packaging/centreon-plugin-Network-Switchs-Dell-Os10-Snmp/pkg.json rename to packaging/centreon-plugin-Network-Dell-Os10-Snmp/pkg.json diff --git a/packaging/centreon-plugin-Network-Switchs-Dell-Os10-Snmp/rpm.json b/packaging/centreon-plugin-Network-Dell-Os10-Snmp/rpm.json similarity index 100% rename from packaging/centreon-plugin-Network-Switchs-Dell-Os10-Snmp/rpm.json rename to packaging/centreon-plugin-Network-Dell-Os10-Snmp/rpm.json diff --git a/packaging/centreon-plugin-Network-Switchs-Dell-Xseries-Snmp/deb.json b/packaging/centreon-plugin-Network-Dell-Xseries-Snmp/deb.json similarity index 100% rename from packaging/centreon-plugin-Network-Switchs-Dell-Xseries-Snmp/deb.json rename to packaging/centreon-plugin-Network-Dell-Xseries-Snmp/deb.json diff --git a/packaging/centreon-plugin-Network-Switchs-Dell-Xseries-Snmp/pkg.json b/packaging/centreon-plugin-Network-Dell-Xseries-Snmp/pkg.json similarity index 100% rename from packaging/centreon-plugin-Network-Switchs-Dell-Xseries-Snmp/pkg.json rename to packaging/centreon-plugin-Network-Dell-Xseries-Snmp/pkg.json diff --git a/packaging/centreon-plugin-Network-Switchs-Dell-Xseries-Snmp/rpm.json b/packaging/centreon-plugin-Network-Dell-Xseries-Snmp/rpm.json similarity index 100% rename from packaging/centreon-plugin-Network-Switchs-Dell-Xseries-Snmp/rpm.json rename to packaging/centreon-plugin-Network-Dell-Xseries-Snmp/rpm.json diff --git a/packaging/centreon-plugin-Network-Firewalls-Juniper-Mag-Snmp/deb.json b/packaging/centreon-plugin-Network-Juniper-Mag-Snmp/deb.json similarity index 100% rename from packaging/centreon-plugin-Network-Firewalls-Juniper-Mag-Snmp/deb.json rename to packaging/centreon-plugin-Network-Juniper-Mag-Snmp/deb.json diff --git a/packaging/centreon-plugin-Network-Firewalls-Juniper-Mag-Snmp/pkg.json b/packaging/centreon-plugin-Network-Juniper-Mag-Snmp/pkg.json similarity index 100% rename from packaging/centreon-plugin-Network-Firewalls-Juniper-Mag-Snmp/pkg.json rename to packaging/centreon-plugin-Network-Juniper-Mag-Snmp/pkg.json diff --git a/packaging/centreon-plugin-Network-Firewalls-Juniper-Mag-Snmp/rpm.json b/packaging/centreon-plugin-Network-Juniper-Mag-Snmp/rpm.json similarity index 100% rename from packaging/centreon-plugin-Network-Firewalls-Juniper-Mag-Snmp/rpm.json rename to packaging/centreon-plugin-Network-Juniper-Mag-Snmp/rpm.json diff --git a/packaging/centreon-plugin-Network-Sonus-Sbc-Snmp/deb.json b/packaging/centreon-plugin-Network-Sonus-SBC-Snmp/deb.json similarity index 100% rename from packaging/centreon-plugin-Network-Sonus-Sbc-Snmp/deb.json rename to packaging/centreon-plugin-Network-Sonus-SBC-Snmp/deb.json diff --git a/packaging/centreon-plugin-Network-Sonus-Sbc-Snmp/pkg.json b/packaging/centreon-plugin-Network-Sonus-SBC-Snmp/pkg.json similarity index 100% rename from packaging/centreon-plugin-Network-Sonus-Sbc-Snmp/pkg.json rename to packaging/centreon-plugin-Network-Sonus-SBC-Snmp/pkg.json diff --git a/packaging/centreon-plugin-Network-Sonus-Sbc-Snmp/rpm.json b/packaging/centreon-plugin-Network-Sonus-SBC-Snmp/rpm.json similarity index 100% rename from packaging/centreon-plugin-Network-Sonus-Sbc-Snmp/rpm.json rename to packaging/centreon-plugin-Network-Sonus-SBC-Snmp/rpm.json From 79a45f4337728249c904e50e1f37adaf21cc6133 Mon Sep 17 00:00:00 2001 From: Evan Adam Date: Wed, 10 Apr 2024 13:35:43 +0200 Subject: [PATCH 03/11] New python script to install, test and remove all plugin passed as parameter. REF:CTOR-474 --- .github/actions/package-nfpm/action.yml | 2 +- .github/actions/plugins-tests/action.yml | 53 ++------- .github/scripts/test-all-plugins.py | 132 +++++++++++++++++++++++ .github/workflows/plugins.yml | 26 +---- 4 files changed, 142 insertions(+), 71 deletions(-) create mode 100644 .github/scripts/test-all-plugins.py diff --git a/.github/actions/package-nfpm/action.yml b/.github/actions/package-nfpm/action.yml index 515ce8644a..a727ce78d8 100644 --- a/.github/actions/package-nfpm/action.yml +++ b/.github/actions/package-nfpm/action.yml @@ -135,7 +135,7 @@ runs: key: ${{ inputs.cache_key }} # Update if condition to true to get packages as artifacts - - if: ${{ false }} + - if: ${{ true }} name: Upload package artifacts uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 with: diff --git a/.github/actions/plugins-tests/action.yml b/.github/actions/plugins-tests/action.yml index e19bfaf487..79b5a8aee4 100644 --- a/.github/actions/plugins-tests/action.yml +++ b/.github/actions/plugins-tests/action.yml @@ -4,8 +4,8 @@ inputs: cache-key: description: "The plugin packaged cache key" required: true - plugin-name: - description: "plugin name to install from the cache" + plugin-list: + description: "plugin names to install from the cache" required: true package-extension: description: "either rpm or deb, used to install the plugin with the correct binary" @@ -23,48 +23,9 @@ runs: fail-on-cache-miss: true - name: install plugin for deb distrib - if: ${{inputs.package-extension == 'deb' }} shell: bash - run: | - apt update - pluginlowercase="${{inputs.plugin-name}}" - apt install -y ./${pluginlowercase,,}*.deb - # in bash ,, make the variable lowercase. - - - name: install plugin for rpm distrib - if: ${{inputs.package-extension == 'rpm' }} - shell: bash - run: dnf install -y ./${{inputs.plugin-name}}*.rpm - # deb and rpm file contain the version/date in the name, hence the wildcard in the name. - - - name: launch snmp simulator process to answer any snmp query. - shell: bash - run: | - useradd snmp - mkdir -p /var/lib/snmp/cert_indexes/ - # this folder seem needed to launch snmp plugins. I didn't reproduce in my env, but without it, - # the first snmp plugin launched by robot prepend the message "Created directory: /var/lib/snmp/cert_indexes". - chown snmp:snmp -R /var/lib/snmp/cert_indexes/ - snmpsim-command-responder --logging-method=null --agent-udpv4-endpoint=127.0.0.1:2024 --process-user=snmp --process-group=snmp --data-dir='./tests/robot' & - - - name: get list of robot file to launch from packagings configuration. - shell: bash - run: | - - string="" - while read i - do - testsname="./tests/robot/$i" - if [[ $i == *"/" && -e $testsname ]] - then - string="$string $testsname" - fi - done <<< $(jq -r '.files[]' ./packaging/${{inputs.plugin-name}}/pkg.json) - - echo string - if [[ ! -z "$string" ]] ; then - robot $string - else - exit 0 - # if no tests where found we quit. we still have tested the plugin is installable, tests will be added little by little. - fi + run: | + echo "plugin list is : \n\n " + echo ${{inputs.plugin-list}} + echo "\n\n executing....\n\n" + python3 .github/scripts/test-all-plugins.py ${{inputs.package-extension}} ${{inputs.plugin-list}} diff --git a/.github/scripts/test-all-plugins.py b/.github/scripts/test-all-plugins.py new file mode 100644 index 0000000000..0af47f2ec2 --- /dev/null +++ b/.github/scripts/test-all-plugins.py @@ -0,0 +1,132 @@ +#!/usr/bin/env python3 +import subprocess +import sys +import os +import json + + +def get_tests_folders(plugin_name): + folder_list = [] + pkg_file = open("./packaging/" + plugin_name + "/pkg.json") + packaging = json.load(pkg_file) + for file in packaging["files"]: + if file.endswith("/") and os.path.exists("tests/robot/" + file): + folder_list.append("tests/robot/" + file) + return folder_list + + +def get_plugin_full_path(plugin_name): + pkg_file = open("./packaging/" + plugin_name + "/pkg.json") + packaging = json.load(pkg_file) + return "/usr/lib/centreon/plugins/" + packaging["plugin_name"] + + +def test_plugin(plugin_name): + print("\ntesting plugin") + folders_list = get_tests_folders(plugin_name) + print(f"{plugin_name} folders_list : {folders_list}") + if len(folders_list) == 0: + return 0 # no tests present at the moment, but we still have tested the plugin can be installed. + robot_results = subprocess.run("robot -v ''CENTREON_PLUGINS:" + get_plugin_full_path(plugin_name) + " " + " ".join(folders_list), + shell=True, check=False) + return robot_results.returncode + # robot_status = subprocess.run("robot ") + + +def try_command(cmd, error): + return_obj = subprocess.run(cmd, shell=True, check=False) + print(return_obj) + if return_obj.returncode != 0: + print(error) + sys.exit(1) + + +def launch_snmp_sim(): + subprocess.run("useradd snmp", shell=True, + check=False) # we don't want to quit if this fail because it often means the user already exist. + + # this folder seem needed to launch snmp plugins. I didn't reproduce in my env, but without it, + # the first snmp plugin launched by robot prepend the message "Created directory: /var/lib/snmp/cert_indexes". + try_command(cmd="mkdir -p /var/lib/snmp/cert_indexes/", error="can't create /var/lib/snmp/cert_indexes/ dir") + + try_command(cmd="chown snmp:snmp -R /var/lib/snmp/cert_indexes/", error="can't set cert_indexes folder permissions") + snmpsim_cmd = "snmpsim-command-responder --logging-method=null --agent-udpv4-endpoint=127.0.0.1:2024 --process-user=snmp --process-group=snmp --data-dir='./tests/robot' &" + try_command(cmd=snmpsim_cmd, error="can't launch snmp sim daemon.") + + +def install_plugin(plugin, archi): + output_status = 0 + if archi == "deb": + output_status = (subprocess.run( + "apt install -o 'Binary::apt::APT::Keep-Downloaded-Packages=1;' -y ./" + plugin.lower() + "*.deb", + shell=True, check=False)).returncode + elif archi == "rpm": + output_status = (subprocess.run("dnf install -y ./" + plugin + "*.rpm", shell=True, check=False)).returncode + else: + print(f"Unknown architecture, expected deb or rpm, got {archi}. Exiting.") + exit(1) + return output_status + + +def remove_plugin(plugin, archi): + output_status = 0 + if archi == "deb": + output_status = (subprocess.run( + "apt -o 'Binary::apt::APT::Keep-Downloaded-Packages=1;' autoremove -y " + plugin.lower(), + shell=True, check=False)).returncode + # -o 'Binary::apt::APT::Keep-Downloaded-Packages=1;' is an option to force apt to keep the package in + # /var/cache/apt/archives, so it do not re download them for every installation. + # 'autoremove', contrary to 'remove' all dependancy while removing the original package. + + elif archi == "rpm": + output_status = (subprocess.run("dnf remove -y " + plugin, shell=True, check=False)).returncode + else: + print(f"Unknown architecture, expected deb or rpm, got {archi}. Exiting.") + exit(1) + return output_status + + +if __name__ == '__main__': + print("starting program") + if len(sys.argv) < 2: + print("please provide list of plugin to test as arguments (one plugin name per argument, separated by space)") + sys.exit(1) + + launch_snmp_sim() + archi = sys.argv.pop(1) # expected either deb or rpm. + script_name = sys.argv.pop(0) # expected either deb or rpm. + print(f"archi is {archi}") + error_install = 0 + error_tests = 0 + error_purge = 0 + nb_plugins = 0 + list_plugin_error = [] + for plugin in sys.argv: + if nb_plugins % 10 == 0: + print( + f"{nb_plugins} plugins tested.\n there was {error_install} installation error, {error_tests} test " + f"errors, and {error_purge} removal error. list : {list_plugin_error}", ) + print("plugin : ", plugin) + nb_plugins += 1 + tmp = install_plugin(plugin, archi) + if tmp > 0: + list_plugin_error.append(plugin) + error_install += tmp + tmp = test_plugin(plugin) + if tmp > 0: + list_plugin_error.append(plugin) + error_tests += tmp + tmp = remove_plugin(plugin, archi) + if tmp > 0: + list_plugin_error.append(plugin) + error_purge += tmp + + print(f"{nb_plugins} plugins tested.\n there was {error_install} installation error, {error_tests} test " + f"errors, and {error_purge} removal error list of error : {list_plugin_error}",) + + if error_install != 0 or error_tests != 0 or error_purge != 0: + exit(1) + exit(0) + # the snmpsim daemon is still runing when we exit, as this script is mainly run in a docker on CI, it will be + # cleared up eventually. + # to clear it up manually, use ps -ax | grep snmpsim-command-respond | cut -dp -f1 | sudo xargs kill diff --git a/.github/workflows/plugins.yml b/.github/workflows/plugins.yml index 402c2f929f..1f6b4d3f7c 100644 --- a/.github/workflows/plugins.yml +++ b/.github/workflows/plugins.yml @@ -83,16 +83,6 @@ jobs: fi shell: bash - - name: Get plugins for tests matrix - id: get_plugins_list - run: | - pluginsarray=() - for f in ${{ steps.get_plugins.outputs.plugins }}; do - pluginsarray+=($f) - done - echo "pluginslist=$(jq -cn '$ARGS.positional' --args ${pluginsarray[@]})" >> $GITHUB_OUTPUT - - shell: bash fatpacker: if: ${{needs.get-plugins.outputs.plugins != ''}} @@ -130,24 +120,13 @@ jobs: fail-fast: false matrix: include: - - package_extension: rpm - image: packaging-plugins-centos7 - distrib: el7 - - package_extension: rpm - image: packaging-plugins-alma8 - distrib: el8 - package_extension: rpm image: packaging-plugins-alma9 distrib: el9 - package_extension: deb image: packaging-plugins-bullseye distrib: bullseye - - package_extension: deb - image: packaging-plugins-bookworm - distrib: bookworm - - package_extension: deb - image: packaging-plugins-jammy - distrib: jammy + container: image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }} @@ -261,7 +240,6 @@ jobs: strategy: fail-fast: false matrix: - plugin-name: ${{fromJson(needs.get-plugins.outputs.pluginslist) }} distrib: [el8, el9, jammy, bullseye, bookworm] include: - package_extension: rpm @@ -294,7 +272,7 @@ jobs: with: cache-key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} package-extension: ${{ matrix.package_extension }} - plugin-name: ${{ matrix.plugin-name }} + plugin-list: ${{needs.get-plugins.outputs.plugins}} deliver: needs: [ get-environment, package ] From 4d4c8d3872e488ae0697a4595d27e8ea2eae2694 Mon Sep 17 00:00:00 2001 From: Evan Adam Date: Fri, 12 Apr 2024 10:42:40 +0200 Subject: [PATCH 04/11] remove useless code, comment python script and indent everything REF:CTOR-474 --- .github/actions/package-nfpm/action.yml | 2 +- .github/actions/plugins-tests/action.yml | 11 ++-- .github/scripts/test-all-plugins.py | 25 ++++----- .github/workflows/plugins.yml | 21 +++++--- .github/workflows/tests-functional.yml | 69 ------------------------ src/centreon/plugins/dbi.pm | 1 - 6 files changed, 29 insertions(+), 100 deletions(-) delete mode 100644 .github/workflows/tests-functional.yml diff --git a/.github/actions/package-nfpm/action.yml b/.github/actions/package-nfpm/action.yml index a727ce78d8..515ce8644a 100644 --- a/.github/actions/package-nfpm/action.yml +++ b/.github/actions/package-nfpm/action.yml @@ -135,7 +135,7 @@ runs: key: ${{ inputs.cache_key }} # Update if condition to true to get packages as artifacts - - if: ${{ true }} + - if: ${{ false }} name: Upload package artifacts uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 with: diff --git a/.github/actions/plugins-tests/action.yml b/.github/actions/plugins-tests/action.yml index 79b5a8aee4..fd133ac361 100644 --- a/.github/actions/plugins-tests/action.yml +++ b/.github/actions/plugins-tests/action.yml @@ -1,5 +1,5 @@ -name: "deb-delivery" -description: "Deliver DEB packages" +name: "tests all plugins" +description: "test all plugin passed as parameter" inputs: cache-key: description: "The plugin packaged cache key" @@ -22,10 +22,7 @@ runs: key: ${{ inputs.cache-key }} fail-on-cache-miss: true - - name: install plugin for deb distrib + - name: install, test and remove plugin shell: bash - run: | - echo "plugin list is : \n\n " - echo ${{inputs.plugin-list}} - echo "\n\n executing....\n\n" + run: | python3 .github/scripts/test-all-plugins.py ${{inputs.package-extension}} ${{inputs.plugin-list}} diff --git a/.github/scripts/test-all-plugins.py b/.github/scripts/test-all-plugins.py index 0af47f2ec2..dc9ae0515d 100644 --- a/.github/scripts/test-all-plugins.py +++ b/.github/scripts/test-all-plugins.py @@ -9,8 +9,8 @@ def get_tests_folders(plugin_name): folder_list = [] pkg_file = open("./packaging/" + plugin_name + "/pkg.json") packaging = json.load(pkg_file) - for file in packaging["files"]: - if file.endswith("/") and os.path.exists("tests/robot/" + file): + for file in packaging["files"]: # loop on "files" array in pkg.json file. + if file.endswith("/") and os.path.exists("tests/robot/" + file): # if this is a directory and there is test for it. folder_list.append("tests/robot/" + file) return folder_list @@ -22,7 +22,6 @@ def get_plugin_full_path(plugin_name): def test_plugin(plugin_name): - print("\ntesting plugin") folders_list = get_tests_folders(plugin_name) print(f"{plugin_name} folders_list : {folders_list}") if len(folders_list) == 0: @@ -30,7 +29,6 @@ def test_plugin(plugin_name): robot_results = subprocess.run("robot -v ''CENTREON_PLUGINS:" + get_plugin_full_path(plugin_name) + " " + " ".join(folders_list), shell=True, check=False) return robot_results.returncode - # robot_status = subprocess.run("robot ") def try_command(cmd, error): @@ -42,20 +40,19 @@ def try_command(cmd, error): def launch_snmp_sim(): - subprocess.run("useradd snmp", shell=True, - check=False) # we don't want to quit if this fail because it often means the user already exist. + subprocess.run("useradd snmp", shell=True, check=False) + # we don't want to quit if this fail because it often means the user already exist. # this folder seem needed to launch snmp plugins. I didn't reproduce in my env, but without it, # the first snmp plugin launched by robot prepend the message "Created directory: /var/lib/snmp/cert_indexes". try_command(cmd="mkdir -p /var/lib/snmp/cert_indexes/", error="can't create /var/lib/snmp/cert_indexes/ dir") - try_command(cmd="chown snmp:snmp -R /var/lib/snmp/cert_indexes/", error="can't set cert_indexes folder permissions") + snmpsim_cmd = "snmpsim-command-responder --logging-method=null --agent-udpv4-endpoint=127.0.0.1:2024 --process-user=snmp --process-group=snmp --data-dir='./tests/robot' &" try_command(cmd=snmpsim_cmd, error="can't launch snmp sim daemon.") def install_plugin(plugin, archi): - output_status = 0 if archi == "deb": output_status = (subprocess.run( "apt install -o 'Binary::apt::APT::Keep-Downloaded-Packages=1;' -y ./" + plugin.lower() + "*.deb", @@ -69,7 +66,6 @@ def install_plugin(plugin, archi): def remove_plugin(plugin, archi): - output_status = 0 if archi == "deb": output_status = (subprocess.run( "apt -o 'Binary::apt::APT::Keep-Downloaded-Packages=1;' autoremove -y " + plugin.lower(), @@ -89,23 +85,20 @@ def remove_plugin(plugin, archi): if __name__ == '__main__': print("starting program") if len(sys.argv) < 2: - print("please provide list of plugin to test as arguments (one plugin name per argument, separated by space)") + print("please provide architecture (deb or rpm) and list of plugin to test as arguments (one plugin name per " + "argument, separated by space)") sys.exit(1) launch_snmp_sim() archi = sys.argv.pop(1) # expected either deb or rpm. - script_name = sys.argv.pop(0) # expected either deb or rpm. - print(f"archi is {archi}") + script_name = sys.argv.pop(0) + error_install = 0 error_tests = 0 error_purge = 0 nb_plugins = 0 list_plugin_error = [] for plugin in sys.argv: - if nb_plugins % 10 == 0: - print( - f"{nb_plugins} plugins tested.\n there was {error_install} installation error, {error_tests} test " - f"errors, and {error_purge} removal error. list : {list_plugin_error}", ) print("plugin : ", plugin) nb_plugins += 1 tmp = install_plugin(plugin, archi) diff --git a/.github/workflows/plugins.yml b/.github/workflows/plugins.yml index 1f6b4d3f7c..d34680c27d 100644 --- a/.github/workflows/plugins.yml +++ b/.github/workflows/plugins.yml @@ -28,7 +28,6 @@ jobs: runs-on: ubuntu-22.04 outputs: plugins: ${{ steps.get_plugins.outputs.plugins }} - pluginslist: ${{ steps.get_plugins_list.outputs.pluginslist }} steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: @@ -77,7 +76,6 @@ jobs: PLUGINS="$(python3 .github/scripts/process-plugins.py '${{ steps.filter.outputs.common == 'true' }}')" echo "plugins=$(echo $PLUGINS)" >> $GITHUB_OUTPUT - echo $PLUGINS if [ "$PLUGINS" == '' ]; then echo "::notice::There are no modifications to the plugins packages" fi @@ -86,7 +84,7 @@ jobs: fatpacker: if: ${{needs.get-plugins.outputs.plugins != ''}} - needs: [ get-environment, get-plugins ] + needs: [get-environment, get-plugins] runs-on: ubuntu-22.04 steps: - name: Checkout sources @@ -111,7 +109,6 @@ jobs: path: ./build/ key: fatpacked-plugins-${{ github.sha }}-${{ github.run_id }} - package: runs-on: ubuntu-22.04 needs: [get-environment, get-plugins, fatpacker] @@ -120,13 +117,24 @@ jobs: fail-fast: false matrix: include: + - package_extension: rpm + image: packaging-plugins-centos7 + distrib: el7 + - package_extension: rpm + image: packaging-plugins-alma8 + distrib: el8 - package_extension: rpm image: packaging-plugins-alma9 distrib: el9 - package_extension: deb image: packaging-plugins-bullseye distrib: bullseye - + - package_extension: deb + image: packaging-plugins-bookworm + distrib: bookworm + - package_extension: deb + image: packaging-plugins-jammy + distrib: jammy container: image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }} @@ -268,6 +276,7 @@ jobs: - name: Checkout sources uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: ./.github/actions/plugins-tests with: cache-key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} @@ -275,7 +284,7 @@ jobs: plugin-list: ${{needs.get-plugins.outputs.plugins}} deliver: - needs: [ get-environment, package ] + needs: [get-environment, package] if: ${{ contains(fromJson('["stable", "testing", "unstable"]'), needs.get-environment.outputs.stability) }} uses: ./.github/workflows/plugin-delivery.yml with: diff --git a/.github/workflows/tests-functional.yml b/.github/workflows/tests-functional.yml deleted file mode 100644 index 77527d9033..0000000000 --- a/.github/workflows/tests-functional.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: functional-tests -on: - workflow_call: - inputs: - plugin-cache: - description: The plugin packaged cache name - type: string - required: true - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - functional-tests-with-robot: - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Install libs - run: | - sudo apt update - sudo apt-get install -y libcurl4-openssl-dev - sudo apt-get install -qqy snmpsim - - - name: Install Node.js - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 - with: - node-version: 21 - - - name: Install Mockoon CLI - run: npm install -g -D @mockoon/cli@7.0.0 - - - name: Install perl dependencies - uses: shogo82148/actions-setup-perl@28eae78d12c2bba1163aec45d123f6d9228bc307 # v1.29.0 - with: - perl-version: '5.34' - install-modules-with: cpm - install-modules: | - Alien::SNMP - DateTime - Net::Curl::Easy - Paws - Net::SNMP - URI::Encode - XML::LibXML - DBI - DBD::mysql - POSIX - Time::HiRes - JSON::XS - - - name: Install Python - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 - with: - python-version: '3.11' - - - name: Install Robot Framework - run: | - pip3.11 install robotframework - pip3.11 install RobotFramework-Examples - shell: bash - - - name: Run Robot Framework tests - run: | - sudo useradd snmp - snmpsimd --logging-method=null --agent-udpv4-endpoint=127.0.0.1:2024 --process-user=snmp --process-group=snmp --data-dir='./tests/robot'& - robot tests/robot diff --git a/src/centreon/plugins/dbi.pm b/src/centreon/plugins/dbi.pm index 8821c44356..3c1ec57f5f 100644 --- a/src/centreon/plugins/dbi.pm +++ b/src/centreon/plugins/dbi.pm @@ -26,7 +26,6 @@ use DBI; use Digest::MD5 qw(md5_hex); use POSIX qw(:signal_h); - my %handlers = ( ALRM => {} ); sub new { From 28310303cda78b1e4c6335334e28fb51bebc2d7e Mon Sep 17 00:00:00 2001 From: Evan Adam Date: Mon, 29 Apr 2024 09:51:31 +0200 Subject: [PATCH 05/11] remove plugins modifications REF:CTOR-474 --- src/os/linux/local/plugin.pm | 1 - src/storage/datacore/restapi/plugin.pm | 1 - 2 files changed, 2 deletions(-) diff --git a/src/os/linux/local/plugin.pm b/src/os/linux/local/plugin.pm index 3c4cf36a18..fc59a8685b 100644 --- a/src/os/linux/local/plugin.pm +++ b/src/os/linux/local/plugin.pm @@ -18,7 +18,6 @@ # limitations under the License. # - package os::linux::local::plugin; use strict; diff --git a/src/storage/datacore/restapi/plugin.pm b/src/storage/datacore/restapi/plugin.pm index d24745ed91..98aed2f641 100644 --- a/src/storage/datacore/restapi/plugin.pm +++ b/src/storage/datacore/restapi/plugin.pm @@ -23,6 +23,5 @@ sub new { 1; =head1 PLUGIN DESCRIPTION - Check Datacore using rest API. From 0cfe80bb5eb9d23eefbcb640f24a3b22435e3ced Mon Sep 17 00:00:00 2001 From: Evan Adam Date: Mon, 29 Apr 2024 11:04:15 +0200 Subject: [PATCH 06/11] change after review REF:CTOR-474 --- .github/workflows/plugins.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/plugins.yml b/.github/workflows/plugins.yml index d34680c27d..f08bd6f494 100644 --- a/.github/workflows/plugins.yml +++ b/.github/workflows/plugins.yml @@ -83,7 +83,7 @@ jobs: shell: bash fatpacker: - if: ${{needs.get-plugins.outputs.plugins != ''}} + if: ${{ needs.get-plugins.outputs.plugins != '' }} needs: [get-environment, get-plugins] runs-on: ubuntu-22.04 steps: @@ -284,7 +284,7 @@ jobs: plugin-list: ${{needs.get-plugins.outputs.plugins}} deliver: - needs: [get-environment, package] + needs: [get-environment, package, test-plugins] if: ${{ contains(fromJson('["stable", "testing", "unstable"]'), needs.get-environment.outputs.stability) }} uses: ./.github/workflows/plugin-delivery.yml with: From e8eed30fd31ab187ed5d686b60e823fac103b5ba Mon Sep 17 00:00:00 2001 From: Evan Adam Date: Mon, 29 Apr 2024 17:54:34 +0200 Subject: [PATCH 07/11] ci(plugins-tests) Add apt/dnf logs as artifact. Change some descriptions REF:CTOR-474 --- .../action.yml | 14 ++--- .github/scripts/test-all-plugins.py | 54 +++++++++++-------- .github/workflows/plugins.yml | 10 +++- 3 files changed, 47 insertions(+), 31 deletions(-) rename .github/actions/{plugins-tests => test-plugins}/action.yml (57%) diff --git a/.github/actions/plugins-tests/action.yml b/.github/actions/test-plugins/action.yml similarity index 57% rename from .github/actions/plugins-tests/action.yml rename to .github/actions/test-plugins/action.yml index fd133ac361..74c6e20735 100644 --- a/.github/actions/plugins-tests/action.yml +++ b/.github/actions/test-plugins/action.yml @@ -1,28 +1,28 @@ -name: "tests all plugins" -description: "test all plugin passed as parameter" +name: "test-plugins" +description: "Test plugin that are passed as parameters" inputs: cache-key: - description: "The plugin packaged cache key" + description: "The packaged plugin's cache key" required: true plugin-list: - description: "plugin names to install from the cache" + description: "List of plugins to install from the cache" required: true package-extension: - description: "either rpm or deb, used to install the plugin with the correct binary" + description: "Either 'rpm' or 'deb'. Needed to determine the package manager command (dnf or apt-get)." required: true runs: using: "composite" steps: - - name: get plugin cached + - name: get the cached plugin uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 with: path: ./*.${{ inputs.package-extension }} key: ${{ inputs.cache-key }} fail-on-cache-miss: true - - name: install, test and remove plugin + - name: Install, test and remove plugin shell: bash run: | python3 .github/scripts/test-all-plugins.py ${{inputs.package-extension}} ${{inputs.plugin-list}} diff --git a/.github/scripts/test-all-plugins.py b/.github/scripts/test-all-plugins.py index dc9ae0515d..24bdb9c977 100644 --- a/.github/scripts/test-all-plugins.py +++ b/.github/scripts/test-all-plugins.py @@ -53,32 +53,40 @@ def launch_snmp_sim(): def install_plugin(plugin, archi): - if archi == "deb": - output_status = (subprocess.run( - "apt install -o 'Binary::apt::APT::Keep-Downloaded-Packages=1;' -y ./" + plugin.lower() + "*.deb", - shell=True, check=False)).returncode - elif archi == "rpm": - output_status = (subprocess.run("dnf install -y ./" + plugin + "*.rpm", shell=True, check=False)).returncode - else: - print(f"Unknown architecture, expected deb or rpm, got {archi}. Exiting.") - exit(1) + with open('/var/log/robot-plugins-installation-tests.log', "a") as outfile: + if archi == "deb": + outfile.write("apt install -o 'Binary::apt::APT::Keep-Downloaded-Packages=1;' -y ./" + plugin.lower() + "*.deb\n") + output_status = (subprocess.run( + "apt install -o 'Binary::apt::APT::Keep-Downloaded-Packages=1;' -y ./" + plugin.lower() + "*.deb", + shell=True, check=False, stderr=subprocess.STDOUT, stdout=outfile)).returncode + elif archi == "rpm": + outfile.write("dnf install -y ./" + plugin + "*.rpm\n") + output_status = (subprocess.run("dnf install -y ./" + plugin + "*.rpm", shell=True, check=False, + stderr=subprocess.STDOUT, stdout=outfile)).returncode + else: + print(f"Unknown architecture, expected deb or rpm, got {archi}. Exiting.") + exit(1) return output_status def remove_plugin(plugin, archi): - if archi == "deb": - output_status = (subprocess.run( - "apt -o 'Binary::apt::APT::Keep-Downloaded-Packages=1;' autoremove -y " + plugin.lower(), - shell=True, check=False)).returncode - # -o 'Binary::apt::APT::Keep-Downloaded-Packages=1;' is an option to force apt to keep the package in - # /var/cache/apt/archives, so it do not re download them for every installation. - # 'autoremove', contrary to 'remove' all dependancy while removing the original package. - - elif archi == "rpm": - output_status = (subprocess.run("dnf remove -y " + plugin, shell=True, check=False)).returncode - else: - print(f"Unknown architecture, expected deb or rpm, got {archi}. Exiting.") - exit(1) + with open('/var/log/robot-plugins-installation-tests.log', "a") as outfile: + if archi == "deb": + outfile.write("apt -o 'Binary::apt::APT::Keep-Downloaded-Packages=1;' autoremove -y " + plugin.lower() + "\n") + output_status = (subprocess.run( + "apt -o 'Binary::apt::APT::Keep-Downloaded-Packages=1;' autoremove -y " + plugin.lower(), + shell=True, check=False, stderr=subprocess.STDOUT, stdout=outfile)).returncode + # -o 'Binary::apt::APT::Keep-Downloaded-Packages=1;' is an option to force apt to keep the package in + # /var/cache/apt/archives, so it do not re download them for every installation. + # 'autoremove', contrary to 'remove' all dependancy while removing the original package. + + elif archi == "rpm": + outfile.write("dnf remove -y " + plugin + "\n") + output_status = (subprocess.run("dnf remove -y " + plugin, shell=True, check=False, + stderr=subprocess.STDOUT, stdout=outfile)).returncode + else: + print(f"Unknown architecture, expected deb or rpm, got {archi}. Exiting.") + exit(1) return output_status @@ -89,7 +97,7 @@ def remove_plugin(plugin, archi): "argument, separated by space)") sys.exit(1) - launch_snmp_sim() + # launch_snmp_sim() archi = sys.argv.pop(1) # expected either deb or rpm. script_name = sys.argv.pop(0) diff --git a/.github/workflows/plugins.yml b/.github/workflows/plugins.yml index f08bd6f494..b58755207f 100644 --- a/.github/workflows/plugins.yml +++ b/.github/workflows/plugins.yml @@ -277,12 +277,20 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: ./.github/actions/plugins-tests + - uses: ./.github/actions/test-plugins with: cache-key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} package-extension: ${{ matrix.package_extension }} plugin-list: ${{needs.get-plugins.outputs.plugins}} + - name: Upload apt/dnf logs as artifacts if tests failed. + if: failure() + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 + with: + name: plugin-installation-${{ matrix.distrib }} + path: /var/log/robot-plugins-installation-tests.log + retention-days: 1 + deliver: needs: [get-environment, package, test-plugins] if: ${{ contains(fromJson('["stable", "testing", "unstable"]'), needs.get-environment.outputs.stability) }} From 5425a7f55fc2d5898b8761b4d3bc5fd31ee6db30 Mon Sep 17 00:00:00 2001 From: Evan-Adam <152897682+Evan-Adam@users.noreply.github.com> Date: Tue, 30 Apr 2024 15:25:15 +0200 Subject: [PATCH 08/11] Apply suggestions from code review Co-authored-by: May <110405507+paul-oureib@users.noreply.github.com> --- .github/actions/test-plugins/action.yml | 2 +- .github/docker/testing/Dockerfile.testing-plugins-alma8 | 3 ++- .github/docker/testing/Dockerfile.testing-plugins-alma9 | 1 - .github/docker/testing/Dockerfile.testing-plugins-bookworm | 1 + .github/workflows/plugins.yml | 5 ++--- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/actions/test-plugins/action.yml b/.github/actions/test-plugins/action.yml index 74c6e20735..84aab55c97 100644 --- a/.github/actions/test-plugins/action.yml +++ b/.github/actions/test-plugins/action.yml @@ -25,4 +25,4 @@ runs: - name: Install, test and remove plugin shell: bash run: | - python3 .github/scripts/test-all-plugins.py ${{inputs.package-extension}} ${{inputs.plugin-list}} + python3 .github/scripts/test-all-plugins.py ${{ inputs.package-extension }} ${{ inputs.plugin-list }} diff --git a/.github/docker/testing/Dockerfile.testing-plugins-alma8 b/.github/docker/testing/Dockerfile.testing-plugins-alma8 index 80e408f2d8..4a40fa2de0 100644 --- a/.github/docker/testing/Dockerfile.testing-plugins-alma8 +++ b/.github/docker/testing/Dockerfile.testing-plugins-alma8 @@ -17,6 +17,7 @@ pip3.11 install snmpsim-lextudio # Install node curl -fsSL https://rpm.nodesource.com/setup_21.x | bash - yum install -y nodejs + # Install mockoon npm install -g -D @mockoon/cli@7.0.0 @@ -66,4 +67,4 @@ dnf clean all EOF -WORKDIR /tests \ No newline at end of file +WORKDIR /tests diff --git a/.github/docker/testing/Dockerfile.testing-plugins-alma9 b/.github/docker/testing/Dockerfile.testing-plugins-alma9 index 1f2501dbdc..ed68e67ccc 100644 --- a/.github/docker/testing/Dockerfile.testing-plugins-alma9 +++ b/.github/docker/testing/Dockerfile.testing-plugins-alma9 @@ -66,4 +66,3 @@ dnf clean all EOF -WORKDIR /tests diff --git a/.github/docker/testing/Dockerfile.testing-plugins-bookworm b/.github/docker/testing/Dockerfile.testing-plugins-bookworm index ac631a3dd8..54d2c50add 100644 --- a/.github/docker/testing/Dockerfile.testing-plugins-bookworm +++ b/.github/docker/testing/Dockerfile.testing-plugins-bookworm @@ -29,6 +29,7 @@ pip3 install snmpsim-lextudio # Install nodejs curl -fsSL https://deb.nodesource.com/setup_21.x | bash - &&\ apt-get install -y nodejs + # Install mockoon (needs nodejs) npm install -g -D @mockoon/cli@7.0.0 diff --git a/.github/workflows/plugins.yml b/.github/workflows/plugins.yml index b58755207f..9a788e960b 100644 --- a/.github/workflows/plugins.yml +++ b/.github/workflows/plugins.yml @@ -276,14 +276,13 @@ jobs: - name: Checkout sources uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: ./.github/actions/test-plugins with: cache-key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} package-extension: ${{ matrix.package_extension }} - plugin-list: ${{needs.get-plugins.outputs.plugins}} + plugin-list: ${{ needs.get-plugins.outputs.plugins }} - - name: Upload apt/dnf logs as artifacts if tests failed. + - name: Upload apt/dnf logs as artifacts if tests failed if: failure() uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 with: From 1477b27af2ea595f7a5534c26dbe1c4c942a5375 Mon Sep 17 00:00:00 2001 From: Evan Adam Date: Tue, 30 Apr 2024 15:38:25 +0200 Subject: [PATCH 09/11] add back snmpsim run in tests REF:CTOR-474 --- .github/scripts/test-all-plugins.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/test-all-plugins.py b/.github/scripts/test-all-plugins.py index 24bdb9c977..176e7eaba0 100644 --- a/.github/scripts/test-all-plugins.py +++ b/.github/scripts/test-all-plugins.py @@ -97,7 +97,7 @@ def remove_plugin(plugin, archi): "argument, separated by space)") sys.exit(1) - # launch_snmp_sim() + launch_snmp_sim() archi = sys.argv.pop(1) # expected either deb or rpm. script_name = sys.argv.pop(0) From e6b3a7d9c49dee8541e0307ac3b2949381b90e2f Mon Sep 17 00:00:00 2001 From: Evan Adam Date: Tue, 30 Apr 2024 15:40:08 +0200 Subject: [PATCH 10/11] remove uselless workdir docker call REF:CTOR-474 --- .github/docker/testing/Dockerfile.testing-plugins-alma8 | 2 -- .github/docker/testing/Dockerfile.testing-plugins-alma9 | 1 - 2 files changed, 3 deletions(-) diff --git a/.github/docker/testing/Dockerfile.testing-plugins-alma8 b/.github/docker/testing/Dockerfile.testing-plugins-alma8 index 4a40fa2de0..46a9712942 100644 --- a/.github/docker/testing/Dockerfile.testing-plugins-alma8 +++ b/.github/docker/testing/Dockerfile.testing-plugins-alma8 @@ -66,5 +66,3 @@ chmod 777 /var/lib/centreon/centplugins/ dnf clean all EOF - -WORKDIR /tests diff --git a/.github/docker/testing/Dockerfile.testing-plugins-alma9 b/.github/docker/testing/Dockerfile.testing-plugins-alma9 index ed68e67ccc..aacff01578 100644 --- a/.github/docker/testing/Dockerfile.testing-plugins-alma9 +++ b/.github/docker/testing/Dockerfile.testing-plugins-alma9 @@ -65,4 +65,3 @@ chmod 777 /var/lib/centreon/centplugins/ dnf clean all EOF - From 5d88c7ccf28e2f6236299078762579d77941d1cd Mon Sep 17 00:00:00 2001 From: Evan Adam Date: Tue, 30 Apr 2024 16:18:03 +0200 Subject: [PATCH 11/11] Let npm take the last mockoon version REF:CTOR-474 --- .github/docker/testing/Dockerfile.testing-plugins-alma8 | 2 +- .github/docker/testing/Dockerfile.testing-plugins-alma9 | 2 +- .github/docker/testing/Dockerfile.testing-plugins-bookworm | 2 +- .github/docker/testing/Dockerfile.testing-plugins-bullseye | 2 +- .github/docker/testing/Dockerfile.testing-plugins-jammy | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/docker/testing/Dockerfile.testing-plugins-alma8 b/.github/docker/testing/Dockerfile.testing-plugins-alma8 index 46a9712942..47c2ffdba0 100644 --- a/.github/docker/testing/Dockerfile.testing-plugins-alma8 +++ b/.github/docker/testing/Dockerfile.testing-plugins-alma8 @@ -19,7 +19,7 @@ curl -fsSL https://rpm.nodesource.com/setup_21.x | bash - yum install -y nodejs # Install mockoon -npm install -g -D @mockoon/cli@7.0.0 +npm install -g -D @mockoon/cli # Add Centreon plugins repositories echo -e '[centreon-plugins-stable]\n\ diff --git a/.github/docker/testing/Dockerfile.testing-plugins-alma9 b/.github/docker/testing/Dockerfile.testing-plugins-alma9 index aacff01578..6761366c85 100644 --- a/.github/docker/testing/Dockerfile.testing-plugins-alma9 +++ b/.github/docker/testing/Dockerfile.testing-plugins-alma9 @@ -18,7 +18,7 @@ pip3.11 install snmpsim-lextudio curl -fsSL https://rpm.nodesource.com/setup_21.x | bash - yum install -y nodejs # Install mockoon -npm install -g -D @mockoon/cli@7.0.0 +npm install -g -D @mockoon/cli # Add Centreon plugins repositories echo -e '[centreon-plugins-stable]\n\ diff --git a/.github/docker/testing/Dockerfile.testing-plugins-bookworm b/.github/docker/testing/Dockerfile.testing-plugins-bookworm index 54d2c50add..2ff56f473d 100644 --- a/.github/docker/testing/Dockerfile.testing-plugins-bookworm +++ b/.github/docker/testing/Dockerfile.testing-plugins-bookworm @@ -31,7 +31,7 @@ curl -fsSL https://deb.nodesource.com/setup_21.x | bash - &&\ apt-get install -y nodejs # Install mockoon (needs nodejs) -npm install -g -D @mockoon/cli@7.0.0 +npm install -g -D @mockoon/cli # Add Centreon plugins repositories echo "deb https://packages.centreon.com/apt-plugins-stable/ bookworm main" | tee /etc/apt/sources.list.d/centreon-plugins.list diff --git a/.github/docker/testing/Dockerfile.testing-plugins-bullseye b/.github/docker/testing/Dockerfile.testing-plugins-bullseye index a8485968db..72c2b2ec6a 100644 --- a/.github/docker/testing/Dockerfile.testing-plugins-bullseye +++ b/.github/docker/testing/Dockerfile.testing-plugins-bullseye @@ -29,7 +29,7 @@ pip3 install snmpsim-lextudio curl -fsSL https://deb.nodesource.com/setup_21.x | bash - &&\ apt-get install -y nodejs # Install mockoon (needs nodejs) -npm install -g -D @mockoon/cli@7.0.0 +npm install -g -D @mockoon/cli # Add Centreon plugins repositories echo "deb https://packages.centreon.com/apt-plugins-stable/ bullseye main" | tee /etc/apt/sources.list.d/centreon-plugins.list diff --git a/.github/docker/testing/Dockerfile.testing-plugins-jammy b/.github/docker/testing/Dockerfile.testing-plugins-jammy index 46d8041cb3..9df67d9d98 100644 --- a/.github/docker/testing/Dockerfile.testing-plugins-jammy +++ b/.github/docker/testing/Dockerfile.testing-plugins-jammy @@ -29,7 +29,7 @@ pip3 install snmpsim-lextudio curl -fsSL https://deb.nodesource.com/setup_21.x | bash - &&\ apt-get install -y nodejs # Install mockoon (needs nodejs) -npm install -g -D @mockoon/cli@7.0.0 +npm install -g -D @mockoon/cli # Add Centreon plugins repositories echo "deb https://packages.centreon.com/ubuntu-plugins-testing/ jammy main" | tee -a /etc/apt/sources.list.d/centreon-plugins.list