mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-09-21 16:58:30 +02:00
enh(ci): introduce github actions
This commit is contained in:
parent
d07cb0ce46
commit
a869dd7380
64
.github/actions/deb-delivery/action.yml
vendored
Normal file
64
.github/actions/deb-delivery/action.yml
vendored
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
name: "deb-package"
|
||||||
|
description: "Package DEB Centreon"
|
||||||
|
inputs:
|
||||||
|
distrib:
|
||||||
|
description: "The distribution used for packaging"
|
||||||
|
required: true
|
||||||
|
major_version:
|
||||||
|
description: "The major version"
|
||||||
|
required: true
|
||||||
|
artifactory_username:
|
||||||
|
description: The artifactory username
|
||||||
|
required: true
|
||||||
|
artifactory_password:
|
||||||
|
description: The artifactory password
|
||||||
|
required: true
|
||||||
|
version:
|
||||||
|
description: "Centreon packaged version"
|
||||||
|
required: true
|
||||||
|
release:
|
||||||
|
description: The release number
|
||||||
|
required: true
|
||||||
|
cache_key:
|
||||||
|
description: "The cached package key"
|
||||||
|
required: true
|
||||||
|
stability:
|
||||||
|
description: "The package stability (stable, testing, unstable)"
|
||||||
|
required: true
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Use cache DEB files
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ./*.deb
|
||||||
|
key: ${{ inputs.cache_key }}
|
||||||
|
|
||||||
|
- name: Publish DEBS to Nexus
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
FILES="centreon-plugin-operatingsystems-linux-*.deb"
|
||||||
|
|
||||||
|
VERSION="${{ inputs.version }}"
|
||||||
|
RELEASE="${{ inputs.release }}"
|
||||||
|
REPOTYPE="${{ inputs.stability }}"
|
||||||
|
PROJECT="plugins"
|
||||||
|
PROJECT_PATH="standard"
|
||||||
|
|
||||||
|
find -name "*.deb" -print0 | xargs -0 -t -I % -P 2 curl -u "${{ inputs.artifactory_username }}":"${{ inputs.artifactory_password }}" -H "Content-Type: multipart/form-data" --data-binary "@%" https://apt.centreon.com/repository/${{ inputs.major_version }}-$REPOTYPE/
|
||||||
|
|
||||||
|
#for MAJOR in "22.04" "22.10"; do
|
||||||
|
# echo "Delivering to $MAJOR $REPOTYPE"
|
||||||
|
|
||||||
|
# find -name "*.deb" -print0 | xargs -0 -t -I % -P 2 curl -u "${{ inputs.artifactory_username }}":"${{ inputs.artifactory_password }}" -H "Content-Type: multipart/form-data" --data-binary "@%" https://apt.centreon.com/repository/$MAJOR-$REPOTYPE/
|
||||||
|
|
||||||
|
# for FILE in $FILES; do
|
||||||
|
# echo "::group::Delivering $FILE"
|
||||||
|
|
||||||
|
#curl -v -u "${{ inputs.artifactory_username }}":"${{ inputs.artifactory_password }}" -H "Content-Type: multipart/form-data" --data-binary "@./$FILE" https://apt.centreon.com/repository/$MAJOR-$REPOTYPE/
|
||||||
|
|
||||||
|
# echo "::endgroup::"
|
||||||
|
# done
|
||||||
|
#done
|
||||||
|
shell: bash
|
70
.github/actions/package/action.yml
vendored
Normal file
70
.github/actions/package/action.yml
vendored
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
name: package
|
||||||
|
description: Package module
|
||||||
|
inputs:
|
||||||
|
package_extension:
|
||||||
|
description: The package extension (deb or rpm)
|
||||||
|
required: true
|
||||||
|
image_name:
|
||||||
|
description: The action matrix
|
||||||
|
required: true
|
||||||
|
script_name:
|
||||||
|
description: The packaging script name
|
||||||
|
plugins:
|
||||||
|
description: List of plugins to package
|
||||||
|
required: true
|
||||||
|
version:
|
||||||
|
description: The plugins version
|
||||||
|
required: true
|
||||||
|
release:
|
||||||
|
description: The release number
|
||||||
|
required: true
|
||||||
|
cache_key:
|
||||||
|
description: The package files cache key
|
||||||
|
required: true
|
||||||
|
sign:
|
||||||
|
description: Wether to sign the package or not
|
||||||
|
default: ""
|
||||||
|
artifactory_username:
|
||||||
|
description: The artifactory username
|
||||||
|
required: true
|
||||||
|
artifactory_password:
|
||||||
|
description: The artifactory password
|
||||||
|
required: true
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Login to Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: docker.centreon.com
|
||||||
|
username: ${{ inputs.artifactory_username }}
|
||||||
|
password: ${{ inputs.artifactory_password }}
|
||||||
|
|
||||||
|
- name: Package
|
||||||
|
uses: ./.github/actions/runner-docker
|
||||||
|
with:
|
||||||
|
script_name: ${{ inputs.script_name }}
|
||||||
|
image_name: ${{ inputs.image_name }}
|
||||||
|
image_version: latest
|
||||||
|
artifactory_username: ${{ inputs.artifactory_username }}
|
||||||
|
artifactory_password: ${{ inputs.artifactory_password }}
|
||||||
|
params: ${{ inputs.version }} ${{ inputs.release }} "${{ inputs.plugins }}"
|
||||||
|
|
||||||
|
- name: Sign
|
||||||
|
if: ${{ inputs.sign != '' && inputs.package_extension == 'rpm' }}
|
||||||
|
uses: ./.github/actions/runner-docker
|
||||||
|
with:
|
||||||
|
script_name: rpm-signing
|
||||||
|
image_name: rpm-signing
|
||||||
|
image_version: ubuntu
|
||||||
|
artifactory_username: ${{ inputs.artifactory_username }}
|
||||||
|
artifactory_password: ${{ inputs.artifactory_password }}
|
||||||
|
|
||||||
|
- name: Cache packaged files
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ./*.${{ inputs.package_extension }}
|
||||||
|
key: ${{ inputs.cache_key }}
|
110
.github/actions/rpm-delivery/action.yml
vendored
Normal file
110
.github/actions/rpm-delivery/action.yml
vendored
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
name: "rpm-delivery"
|
||||||
|
description: "rpm delivery"
|
||||||
|
inputs:
|
||||||
|
distrib:
|
||||||
|
description: "The distribution used for packaging"
|
||||||
|
required: true
|
||||||
|
version:
|
||||||
|
description: "Centreon packaged version"
|
||||||
|
required: true
|
||||||
|
release:
|
||||||
|
description: The release number
|
||||||
|
required: true
|
||||||
|
cache_key:
|
||||||
|
description: "The cached package key"
|
||||||
|
required: true
|
||||||
|
yum_repo_url:
|
||||||
|
description: "The legacy yum repo url"
|
||||||
|
required: true
|
||||||
|
update_repo_path:
|
||||||
|
description: "The update repo script path"
|
||||||
|
required: true
|
||||||
|
cloudfront_id:
|
||||||
|
description: "The cloudfront ID for repo url"
|
||||||
|
required: true
|
||||||
|
yum_repo_address:
|
||||||
|
description: "The legacy yum repo address"
|
||||||
|
required: true
|
||||||
|
yum_repo_key:
|
||||||
|
description: "The repo key"
|
||||||
|
required: true
|
||||||
|
stability:
|
||||||
|
description: "The package stability (stable, testing, unstable)"
|
||||||
|
required: true
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Use cache RPM files
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ./*.rpm
|
||||||
|
key: ${{ inputs.cache_key }}
|
||||||
|
|
||||||
|
- name: Setup awscli
|
||||||
|
run: |
|
||||||
|
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
|
||||||
|
sudo unzip -q awscliv2.zip
|
||||||
|
sudo ./aws/install
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Publish RPMS
|
||||||
|
run: |
|
||||||
|
FILES="*.rpm"
|
||||||
|
|
||||||
|
VERSION="${{ inputs.version }}"
|
||||||
|
RELEASE="${{ inputs.release }}"
|
||||||
|
REPOTYPE="${{ inputs.stability }}"
|
||||||
|
PROJECT="plugins"
|
||||||
|
PROJECT_PATH="standard"
|
||||||
|
DISTRIB="${{ inputs.distrib }}"
|
||||||
|
ARCH="noarch"
|
||||||
|
|
||||||
|
eval `ssh-agent`
|
||||||
|
ssh-add - <<< "${{ inputs.yum_repo_key }}"
|
||||||
|
|
||||||
|
for MAJOR in "21.10" "22.04" "22.10"; do
|
||||||
|
echo "::group::Delivering to $MAJOR $REPOTYPE"
|
||||||
|
|
||||||
|
if [ "$REPOTYPE" == "stable" ]; then
|
||||||
|
TARGET="/srv/centreon-yum/yum.centreon.com/$PROJECT_PATH/$MAJOR/$DISTRIB/$REPOTYPE/$ARCH/RPMS"
|
||||||
|
else
|
||||||
|
FOLDER="centreon-$PROJECT-$VERSION-$RELEASE"
|
||||||
|
TARGET="/srv/centreon-yum/yum.centreon.com/$PROJECT_PATH/$MAJOR/$DISTRIB/$REPOTYPE/$ARCH/$PROJECT/$FOLDER"
|
||||||
|
PROJECT_LOCATION="/srv/centreon-yum/yum.centreon.com/$PROJECT_PATH/$MAJOR/$DISTRIB/$REPOTYPE/$ARCH/$PROJECT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[DEBUG] - Folder: $FOLDER"
|
||||||
|
echo "[DEBUG] - Project : $PROJECT"
|
||||||
|
echo "[DEBUG] - Target : $TARGET"
|
||||||
|
echo "[DEBUG] - PROJECT_LOCATION : $PROJECT_LOCATION"
|
||||||
|
|
||||||
|
ssh -o StrictHostKeyChecking=no "${{ inputs.yum_repo_address }}" mkdir -p "$TARGET"
|
||||||
|
scp -o StrictHostKeyChecking=no ./*.rpm "${{ inputs.yum_repo_address }}:$TARGET"
|
||||||
|
|
||||||
|
# Cleanup is done on unstable repository only
|
||||||
|
if [ "$REPOTYPE" == "unstable" ]; then
|
||||||
|
ssh -o StrictHostKeyChecking=no "${{ inputs.yum_repo_address }}" "ls -drc $PROJECT_LOCATION/* 2>&- | head -n -1 | xargs rm -rf"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update repository metadata
|
||||||
|
METADATAS="/srv/centreon-yum/yum.centreon.com/$PROJECT_PATH/$MAJOR/$DISTRIB/$REPOTYPE/$ARCH"
|
||||||
|
ssh -o StrictHostKeyChecking=no "${{ inputs.yum_repo_address }}" "sh "${{ inputs.update_repo_path }}" $METADATAS" 2>&-
|
||||||
|
|
||||||
|
# Invalidate cloudfront cache
|
||||||
|
ID="${{ inputs.cloudfront_id }}"
|
||||||
|
PATHS="/$PROJECT_PATH/$MAJOR/$DISTRIB/$REPOTYPE/$ARCH/*"
|
||||||
|
ITERATIONS=1
|
||||||
|
|
||||||
|
until aws cloudfront create-invalidation --distribution-id "$ID" --paths "$PATHS"; do
|
||||||
|
if [ ${ITERATIONS} -eq 10 ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
echo "couldn't invalidate cache, AWS quota might have been reached, retrying in 30 seconds..."
|
||||||
|
sleep 30s
|
||||||
|
ITERATIONS=$((ITERATIONS+1))
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "::endgroup::"
|
||||||
|
done
|
||||||
|
shell: bash
|
36
.github/actions/runner-docker/action.yml
vendored
Normal file
36
.github/actions/runner-docker/action.yml
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
name: run-in-docker
|
||||||
|
description: Run step in docker container
|
||||||
|
inputs:
|
||||||
|
script_name:
|
||||||
|
description: "script_name"
|
||||||
|
required: true
|
||||||
|
image_name:
|
||||||
|
description: "image_name"
|
||||||
|
required: true
|
||||||
|
image_version:
|
||||||
|
description: "image_version"
|
||||||
|
required: true
|
||||||
|
centreon_pat:
|
||||||
|
description: "Secret"
|
||||||
|
required: false
|
||||||
|
artifactory_username:
|
||||||
|
description: The artifactory username
|
||||||
|
required: true
|
||||||
|
artifactory_password:
|
||||||
|
description: The artifactory password
|
||||||
|
required: true
|
||||||
|
params:
|
||||||
|
description: "params for script"
|
||||||
|
required: false
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Login to Registry (via runner)
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: docker.centreon.com
|
||||||
|
username: ${{ inputs.artifactory_username }}
|
||||||
|
password: ${{ inputs.artifactory_password }}
|
||||||
|
|
||||||
|
- run: docker run -i -e TOKEN=${{ inputs.centreon_pat }} --entrypoint /src/.github/scripts/${{ inputs.script_name }}.sh -v "$PWD:/src" docker.centreon.com/${{ inputs.image_name }}:${{ inputs.image_version }} ${{ inputs.params }}
|
||||||
|
shell: bash
|
13
.github/docker/Dockerfile.packaging-plugins-alma8
vendored
Normal file
13
.github/docker/Dockerfile.packaging-plugins-alma8
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
FROM docker-proxy.centreon.com/almalinux:8.5
|
||||||
|
|
||||||
|
RUN <<EOF
|
||||||
|
|
||||||
|
dnf -y install git gettext rpm-build dos2unix python3 epel-release
|
||||||
|
dnf -y install perl-App-cpanminus perl-JSON
|
||||||
|
cpanm App::FatPacker
|
||||||
|
cpanm File::Copy::Recursive
|
||||||
|
dnf clean all
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
WORKDIR /src
|
38
.github/docker/Dockerfile.packaging-plugins-bullseye
vendored
Normal file
38
.github/docker/Dockerfile.packaging-plugins-bullseye
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
FROM docker-proxy.centreon.com/debian:bullseye
|
||||||
|
|
||||||
|
# fix locale
|
||||||
|
RUN <<EOF
|
||||||
|
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y locales
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
|
||||||
|
apt-get clean
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
ENV LANG en_US.utf8
|
||||||
|
|
||||||
|
RUN <<EOF
|
||||||
|
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y \
|
||||||
|
dh-make \
|
||||||
|
aptitude \
|
||||||
|
lintian \
|
||||||
|
pbuilder \
|
||||||
|
quilt \
|
||||||
|
git-buildpackage \
|
||||||
|
debmake \
|
||||||
|
devscripts \
|
||||||
|
fakeroot \
|
||||||
|
curl \
|
||||||
|
git \
|
||||||
|
python3 \
|
||||||
|
libjson-perl \
|
||||||
|
libapp-fatpacker-perl \
|
||||||
|
libfile-copy-recursive-perl \
|
||||||
|
jq
|
||||||
|
apt-get clean
|
||||||
|
|
||||||
|
EOF
|
11
.github/docker/Dockerfile.packaging-plugins-centos7
vendored
Normal file
11
.github/docker/Dockerfile.packaging-plugins-centos7
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
FROM docker-proxy.centreon.com/centos:7
|
||||||
|
|
||||||
|
RUN <<EOF
|
||||||
|
|
||||||
|
yum -y install git gettext rpm-build dos2unix python3 epel-release
|
||||||
|
yum -y install perl-App-FatPacker perl-File-Copy-Recursive perl-JSON
|
||||||
|
yum clean all
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
WORKDIR /src
|
24
.github/packaging/debian/control.body.template
vendored
Normal file
24
.github/packaging/debian/control.body.template
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
Package: @NAME@
|
||||||
|
Architecture: all
|
||||||
|
Description: @SUMMARY@
|
||||||
|
Depends:
|
||||||
|
${shlibs:Depends},
|
||||||
|
${misc:Depends},
|
||||||
|
libpod-parser-perl,
|
||||||
|
libnet-curl-perl,
|
||||||
|
liburi-encode-perl,
|
||||||
|
libwww-perl,
|
||||||
|
liblwp-protocol-https-perl,
|
||||||
|
libhttp-cookies-perl,
|
||||||
|
libio-socket-ssl-perl,
|
||||||
|
liburi-perl,
|
||||||
|
libhttp-proxypac-perl,
|
||||||
|
libcryptx-perl,
|
||||||
|
libjson-xs-perl,
|
||||||
|
libjson-path-perl,
|
||||||
|
libcrypt-argon2-perl,
|
||||||
|
libkeepass-reader-perl,
|
||||||
|
libdatetime-perl,
|
||||||
|
@REQUIRES@
|
||||||
|
|
12
.github/packaging/debian/control.head.template
vendored
Normal file
12
.github/packaging/debian/control.head.template
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
Source: centreon-plugins
|
||||||
|
Section: net
|
||||||
|
Priority: optional
|
||||||
|
Maintainer: Centreon <contact@centreon.com>
|
||||||
|
Build-Depends:
|
||||||
|
debhelper-compat (= 12),
|
||||||
|
libapp-fatpacker-perl,
|
||||||
|
libfile-copy-recursive-perl,
|
||||||
|
libjson-perl
|
||||||
|
Standards-Version: 4.5.0
|
||||||
|
Homepage: https://www.centreon.com
|
||||||
|
|
29
.github/packaging/debian/copyright
vendored
Normal file
29
.github/packaging/debian/copyright
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
|
Upstream-Name: centreon-collect
|
||||||
|
Upstream-Contact: Centreon <contact@centreon.com>
|
||||||
|
Source: https://www.centreon.com
|
||||||
|
|
||||||
|
Files: *
|
||||||
|
Copyright: 2021 Centreon
|
||||||
|
License: Apache-2.0
|
||||||
|
|
||||||
|
Files: debian/*
|
||||||
|
Copyright: 2021 Centreon
|
||||||
|
License: Apache-2.0
|
||||||
|
|
||||||
|
License: Apache-2.0
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
.
|
||||||
|
https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
.
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
.
|
||||||
|
On Debian systems, the complete text of the Apache version 2.0 license
|
||||||
|
can be found in "/usr/share/common-licenses/Apache-2.0".
|
||||||
|
|
1
.github/packaging/debian/plugin.install.template
vendored
Normal file
1
.github/packaging/debian/plugin.install.template
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
plugins/@DIR@/@NAME@ usr/lib/centreon/plugins
|
7
.github/packaging/debian/rules
vendored
Normal file
7
.github/packaging/debian/rules
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
|
%:
|
||||||
|
dh $@
|
||||||
|
|
||||||
|
override_dh_clean:
|
||||||
|
override_dh_auto_build:
|
1
.github/packaging/debian/source/format
vendored
Normal file
1
.github/packaging/debian/source/format
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
3.0 (quilt)
|
48
.github/packaging/rpm/plugin.spectemplate
vendored
Normal file
48
.github/packaging/rpm/plugin.spectemplate
vendored
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
Name: @NAME@
|
||||||
|
Version: @VERSION@
|
||||||
|
Release: @RELEASE@%{?dist}
|
||||||
|
Source0: %{name}-%{version}.tar.gz
|
||||||
|
Summary: @SUMMARY@
|
||||||
|
Group: Development/Libraries
|
||||||
|
License: ASL 2.0
|
||||||
|
URL: https://www.centreon.com/
|
||||||
|
BuildArch: noarch
|
||||||
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
|
AutoReqProv: no
|
||||||
|
|
||||||
|
AutoReqProv: no
|
||||||
|
Requires: perl(Digest::MD5)
|
||||||
|
Requires: perl(Pod::Find)
|
||||||
|
Requires: perl-Net-Curl
|
||||||
|
Requires: perl(URI::Encode)
|
||||||
|
Requires: perl(LWP::UserAgent)
|
||||||
|
Requires: perl(LWP::Protocol::https)
|
||||||
|
Requires: perl(IO::Socket::SSL)
|
||||||
|
Requires: perl(URI)
|
||||||
|
Requires: perl(HTTP::ProxyPAC)
|
||||||
|
Requires: perl-CryptX
|
||||||
|
Requires: perl(MIME::Base64)
|
||||||
|
Requires: perl(JSON::XS)
|
||||||
|
Requires: perl-JSON-Path
|
||||||
|
Requires: perl-KeePass-Reader
|
||||||
|
Requires: perl(Storable)
|
||||||
|
Requires: perl(POSIX)
|
||||||
|
Requires: perl(Encode)
|
||||||
|
@REQUIRES@
|
||||||
|
|
||||||
|
@CUSTOM_PKG_DATA@
|
||||||
|
|
||||||
|
%description
|
||||||
|
Centreon plugin
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q
|
||||||
|
|
||||||
|
%install
|
||||||
|
rm -rf %{buildroot}
|
||||||
|
mkdir -p %{buildroot}/usr/lib/centreon/plugins/
|
||||||
|
%{__install} -m 775 *.pl %{buildroot}%{_prefix}/lib/centreon/plugins/
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%{_prefix}/lib/centreon/plugins/@PLUGIN_NAME@
|
34
.github/scripts/create-spec-file.py
vendored
Normal file
34
.github/scripts/create-spec-file.py
vendored
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import json
|
||||||
|
from sys import argv
|
||||||
|
|
||||||
|
package_name = argv[1]
|
||||||
|
package_version = argv[2]
|
||||||
|
package_release = argv[3]
|
||||||
|
|
||||||
|
with open('.github/packaging/rpm/plugin.spectemplate', 'r') as rfile:
|
||||||
|
specfile = rfile.read()
|
||||||
|
|
||||||
|
with open('packaging/%s/pkg.json' % package_name, 'r') as rfile:
|
||||||
|
plugincfg = json.load(rfile)
|
||||||
|
|
||||||
|
with open('packaging/%s/rpm.json' % package_name, 'r') as rfile:
|
||||||
|
pluginrpm = json.load(rfile)
|
||||||
|
|
||||||
|
specfile = specfile.replace('@NAME@', package_name)
|
||||||
|
specfile = specfile.replace('@VERSION@', package_version)
|
||||||
|
specfile = specfile.replace('@RELEASE@', package_release)
|
||||||
|
specfile = specfile.replace('@SUMMARY@', plugincfg['pkg_summary'])
|
||||||
|
specfile = specfile.replace('@PLUGIN_NAME@', plugincfg['plugin_name'])
|
||||||
|
specfile = specfile.replace(
|
||||||
|
'@REQUIRES@',
|
||||||
|
"\n".join(["Requires:\t%s" % x for x in pluginrpm.get('dependencies', '')])
|
||||||
|
)
|
||||||
|
specfile = specfile.replace(
|
||||||
|
'@CUSTOM_PKG_DATA@', pluginrpm.get('custom_pkg_data', '')
|
||||||
|
)
|
||||||
|
|
||||||
|
# write final specfile
|
||||||
|
with open('plugin.specfile', 'w+') as wfile:
|
||||||
|
wfile.write(specfile)
|
45
.github/scripts/plugin-packaging-deb.sh
vendored
Executable file
45
.github/scripts/plugin-packaging-deb.sh
vendored
Executable file
@ -0,0 +1,45 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
VERSION="$1"
|
||||||
|
RELEASE="$2"
|
||||||
|
PLUGINS="$3"
|
||||||
|
|
||||||
|
cd /src
|
||||||
|
|
||||||
|
mkdir -p centreon-plugins/plugins
|
||||||
|
cp -R .github/packaging/debian centreon-plugins/debian
|
||||||
|
mv centreon-plugins/debian/control.head.template centreon-plugins/debian/control
|
||||||
|
|
||||||
|
for PLUGIN in $PLUGINS; do
|
||||||
|
|
||||||
|
if [[ "$PLUGIN" =~ (.*)"=>".* ]]; then
|
||||||
|
PLUGIN=$(echo ${BASH_REMATCH[1]})
|
||||||
|
fi
|
||||||
|
PLUGIN_NAME_LOWER=$(echo "$PLUGIN" | tr '[:upper:]' '[:lower:]')
|
||||||
|
|
||||||
|
echo "::group::Preparing $PLUGIN_NAME_LOWER"
|
||||||
|
|
||||||
|
mkdir centreon-plugins/plugins/$PLUGIN
|
||||||
|
cp -R build/$PLUGIN/*.pl centreon-plugins/plugins/$PLUGIN
|
||||||
|
|
||||||
|
# Process package files
|
||||||
|
pkg_values=($(cat "packaging/$PLUGIN/pkg.json" | jq -r '.pkg_name,.plugin_name'))
|
||||||
|
pkg_summary=$(echo "${pkg_values[0]}")
|
||||||
|
plugin_name=$(echo "${pkg_values[1]}")
|
||||||
|
deb_dependencies=$(cat "packaging/$PLUGIN/deb.json" | jq -r '.dependencies | join(",\\n ")')
|
||||||
|
|
||||||
|
sed -e "s/@NAME@/$PLUGIN_NAME_LOWER/g" -e "s/@SUMMARY@/$pkg_summary/g" -e "s/@REQUIRES@/$deb_dependencies/g" < centreon-plugins/debian/control.body.template >> centreon-plugins/debian/control
|
||||||
|
|
||||||
|
# .install file
|
||||||
|
sed -e "s/@DIR@/$PLUGIN/g" -e "s/@NAME@/$plugin_name/g" < centreon-plugins/debian/plugin.install.template >> centreon-plugins/debian/$PLUGIN_NAME_LOWER.install
|
||||||
|
|
||||||
|
echo "::endgroup::"
|
||||||
|
done
|
||||||
|
|
||||||
|
rm -f centreon-plugins/debian/*.template
|
||||||
|
tar czf centreon-plugins-${VERSION}-${RELEASE}.tar.gz centreon-plugins
|
||||||
|
cd centreon-plugins
|
||||||
|
debmake -f "Centreon" -e "contact@centreon.com" -u "${VERSION}-${RELEASE}" -y -r "bullseye"
|
||||||
|
debuild-pbuilder --no-lintian
|
32
.github/scripts/plugin-packaging-rpm.sh
vendored
Executable file
32
.github/scripts/plugin-packaging-rpm.sh
vendored
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
VERSION="$1"
|
||||||
|
RELEASE="$2"
|
||||||
|
PLUGINS="$3"
|
||||||
|
|
||||||
|
for PLUGIN_NAME in $PLUGINS; do
|
||||||
|
|
||||||
|
if [[ "$PLUGIN_NAME" =~ (.*)"=>".* ]]; then
|
||||||
|
PLUGIN_NAME=$(echo ${BASH_REMATCH[1]})
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Process specfile
|
||||||
|
rm -f plugin.specfile
|
||||||
|
python3 .github/scripts/create-spec-file.py "$PLUGIN_NAME" "$VERSION" "$RELEASE"
|
||||||
|
|
||||||
|
rm -rf $HOME/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
|
||||||
|
mkdir -p $HOME/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
|
||||||
|
|
||||||
|
mv build/$PLUGIN_NAME $PLUGIN_NAME-$VERSION
|
||||||
|
tar czf $PLUGIN_NAME-$VERSION.tar.gz $PLUGIN_NAME-$VERSION
|
||||||
|
mv $PLUGIN_NAME-$VERSION.tar.gz $HOME/rpmbuild/SOURCES/
|
||||||
|
|
||||||
|
cd $PLUGIN_NAME-$VERSION
|
||||||
|
rpmbuild -ba ../plugin.specfile
|
||||||
|
find $HOME/rpmbuild/RPMS -name *.rpm -exec mv {} /src/ \;
|
||||||
|
|
||||||
|
cd -
|
||||||
|
|
||||||
|
done
|
111
.github/scripts/plugins-source.container.pl
vendored
Normal file
111
.github/scripts/plugins-source.container.pl
vendored
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
#!/usr/bin/env perl
|
||||||
|
|
||||||
|
use App::FatPacker;
|
||||||
|
use File::Copy::Recursive;
|
||||||
|
use File::Path;
|
||||||
|
use File::Basename;
|
||||||
|
use JSON;
|
||||||
|
use Cwd qw(getcwd);
|
||||||
|
|
||||||
|
my $pwd = (getcwd . '/');
|
||||||
|
my $plugins_dir = ($pwd . 'centreon-plugins');
|
||||||
|
my $packaging_dir = ($pwd . 'packaging');
|
||||||
|
my $build_dir = ($pwd . 'build');
|
||||||
|
|
||||||
|
# Prepare destination directory.
|
||||||
|
File::Path::remove_tree($build_dir);
|
||||||
|
File::Path::make_path($build_dir);
|
||||||
|
|
||||||
|
|
||||||
|
# Set version within sources.
|
||||||
|
my $plugins = $ARGV[0];
|
||||||
|
my $global_version = $ARGV[1];
|
||||||
|
do {
|
||||||
|
local $^I = '.bak';
|
||||||
|
local @ARGV = ($plugins_dir . '/centreon/plugins/script.pm');
|
||||||
|
while (<>) {
|
||||||
|
s/^my \$global_version = .*$/my \$global_version = '$global_version';/ig;
|
||||||
|
print;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
do {
|
||||||
|
local $^I = '.bak';
|
||||||
|
local @ARGV = ($plugins_dir . '/centreon/plugins/script.pm');
|
||||||
|
while (<>) {
|
||||||
|
s/^my \$alternative_fatpacker = 0;$/my \$alternative_fatpacker = 1;/ig;
|
||||||
|
print;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
chdir($packaging_dir);
|
||||||
|
|
||||||
|
my @plugins = split / /, $plugins;
|
||||||
|
foreach my $plugin (@plugins) {
|
||||||
|
chdir($packaging_dir);
|
||||||
|
|
||||||
|
# Load plugin configuration file.
|
||||||
|
if (! -f $plugin . '/pkg.json') {
|
||||||
|
if ($plugin =~ /(.*)=>/) {
|
||||||
|
$plugin = $1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print "::group::Processing $plugin...";
|
||||||
|
if (-f $plugin . '/pkg.json') {
|
||||||
|
my $plugin_build_dir = $build_dir . '/' . $plugin;
|
||||||
|
File::Path::make_path($plugin_build_dir);
|
||||||
|
|
||||||
|
open($fh, '<', $plugin . '/pkg.json');
|
||||||
|
my $json_content = do { local $/; <$fh> };
|
||||||
|
close($fh);
|
||||||
|
$config = JSON::decode_json($json_content);
|
||||||
|
|
||||||
|
# Prepare plugin layout.
|
||||||
|
chdir($plugins_dir);
|
||||||
|
File::Path::remove_tree('lib');
|
||||||
|
File::Path::make_path('lib');
|
||||||
|
my @common_files = (
|
||||||
|
'centreon/plugins/http.pm',
|
||||||
|
'centreon/plugins/misc.pm',
|
||||||
|
'centreon/plugins/mode.pm',
|
||||||
|
'centreon/plugins/multi.pm',
|
||||||
|
'centreon/plugins/options.pm',
|
||||||
|
'centreon/plugins/output.pm',
|
||||||
|
'centreon/plugins/perfdata.pm',
|
||||||
|
'centreon/plugins/script.pm',
|
||||||
|
'centreon/plugins/statefile.pm',
|
||||||
|
'centreon/plugins/values.pm',
|
||||||
|
'centreon/plugins/backend/http/curl.pm',
|
||||||
|
'centreon/plugins/backend/http/curlconstants.pm',
|
||||||
|
'centreon/plugins/backend/http/lwp.pm',
|
||||||
|
'centreon/plugins/backend/http/useragent.pm',
|
||||||
|
'centreon/plugins/alternative/Getopt.pm',
|
||||||
|
'centreon/plugins/alternative/FatPackerOptions.pm',
|
||||||
|
'centreon/plugins/passwordmgr/environment.pm',
|
||||||
|
'centreon/plugins/passwordmgr/hashicorpvault.pm',
|
||||||
|
'centreon/plugins/passwordmgr/keepass.pm',
|
||||||
|
'centreon/plugins/passwordmgr/teampass.pm',
|
||||||
|
'centreon/plugins/templates/catalog_functions.pm',
|
||||||
|
'centreon/plugins/templates/counter.pm',
|
||||||
|
'centreon/plugins/templates/hardware.pm'
|
||||||
|
);
|
||||||
|
foreach my $file ((@common_files, @{$config->{files}})) {
|
||||||
|
print " - $file\n";
|
||||||
|
if (-f $file) {
|
||||||
|
File::Copy::Recursive::fcopy($file, 'lib/' . $file);
|
||||||
|
} elsif (-d $file) {
|
||||||
|
File::Copy::Recursive::dircopy($file, 'lib/' . $file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# Remove __END__ for Centreon Connector Perl compatibility.
|
||||||
|
system 'find', 'lib', '-name', '*.pm', '-exec', 'sed', '-i', ' /__END__/d', '{}', ';';
|
||||||
|
|
||||||
|
# Fatpack plugin.
|
||||||
|
my $fatpacker = App::FatPacker->new();
|
||||||
|
my $content = $fatpacker->fatpack_file("centreon_plugins.pl");
|
||||||
|
open($fh, '>', "$plugin_build_dir/$config->{plugin_name}");
|
||||||
|
print $fh $content;
|
||||||
|
close($fh);
|
||||||
|
chmod 0755, "$plugin_build_dir/$config->{plugin_name}"; # Add execution permission
|
||||||
|
}
|
||||||
|
print "::endgroup::";
|
||||||
|
}
|
52
.github/scripts/process-plugins.py
vendored
Normal file
52
.github/scripts/process-plugins.py
vendored
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
from sys import argv
|
||||||
|
import re
|
||||||
|
import os
|
||||||
|
import json
|
||||||
|
|
||||||
|
common = argv[1] == 'true'
|
||||||
|
packages = argv[2]
|
||||||
|
plugins = argv[3]
|
||||||
|
|
||||||
|
list_plugins_dir = set()
|
||||||
|
list_packages = set()
|
||||||
|
|
||||||
|
if not common:
|
||||||
|
for plugin in plugins.split(' '):
|
||||||
|
try:
|
||||||
|
found = re.search('(.*)\/mode\/.*', plugin).group(1)
|
||||||
|
list_plugins_dir.add(found)
|
||||||
|
except AttributeError:
|
||||||
|
try:
|
||||||
|
found = re.search('(.*)\/plugin.pm', plugin).group(1)
|
||||||
|
list_plugins_dir.add(found)
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
updated_packages = packages.split(' ')
|
||||||
|
|
||||||
|
for filepath in os.popen('find packaging -type f -name pkg.json').read().split('\n')[0:-1]:
|
||||||
|
packaging_file = open(filepath)
|
||||||
|
packaging = json.load(packaging_file)
|
||||||
|
packaging_file.close()
|
||||||
|
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"]
|
||||||
|
if common or filepath in updated_packages:
|
||||||
|
list_packages.add(packaging_path)
|
||||||
|
else:
|
||||||
|
for pkg_file in packaging["files"]:
|
||||||
|
pkg_file_dir = pkg_file
|
||||||
|
try:
|
||||||
|
found = re.search('(.*)\/mode\/.*', pkg_file).group(1)
|
||||||
|
pkg_file_dir = found
|
||||||
|
except AttributeError:
|
||||||
|
try:
|
||||||
|
found = re.search('(.*)\/plugin.pm', pkg_file).group(1)
|
||||||
|
pkg_file_dir = found
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
if pkg_file_dir in list_plugins_dir:
|
||||||
|
list_packages.add(packaging_path)
|
||||||
|
|
||||||
|
print(*list_packages)
|
5
.github/scripts/rpm-signing.sh
vendored
Executable file
5
.github/scripts/rpm-signing.sh
vendored
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
export GPG_TTY=$(tty)
|
||||||
|
rpmsign --addsign /src/*.rpm
|
55
.github/workflows/docker-builder-packaging-plugins.yml
vendored
Normal file
55
.github/workflows/docker-builder-packaging-plugins.yml
vendored
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
name: docker-builder-packaging-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-packaging-plugins.yml"
|
||||||
|
# - ".github/docker/*"
|
||||||
|
# pull_request:
|
||||||
|
# paths:
|
||||||
|
# - ".github/workflows/docker-builder-packaging-plugins.yml"
|
||||||
|
# - ".github/docker/*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
create-and-push-docker:
|
||||||
|
runs-on: [self-hosted, common]
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
distrib: [centos7, alma8, bullseye]
|
||||||
|
include:
|
||||||
|
- project: plugins
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Login to Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: docker.centreon.com
|
||||||
|
username: ${{ secrets.REPOS_USERNAME }}
|
||||||
|
password: ${{ secrets.REPOS_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Login to proxy registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: docker-proxy.centreon.com
|
||||||
|
username: ${{ secrets.REPOS_USERNAME }}
|
||||||
|
password: ${{ secrets.REPOS_PASSWORD }}
|
||||||
|
|
||||||
|
- uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
file: .github/docker/Dockerfile.packaging-${{ matrix.project }}-${{ matrix.distrib }}
|
||||||
|
context: .
|
||||||
|
pull: true
|
||||||
|
push: true
|
||||||
|
tags: docker.centreon.com/packaging-${{ matrix.project }}-${{ matrix.distrib }}:latest
|
52
.github/workflows/get-environment.yml
vendored
Normal file
52
.github/workflows/get-environment.yml
vendored
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
outputs:
|
||||||
|
stability:
|
||||||
|
description: "branch stability (stable, testing, unstable, canary)"
|
||||||
|
value: ${{ jobs.get-version.outputs.stability }}
|
||||||
|
version:
|
||||||
|
description: "version"
|
||||||
|
value: ${{ jobs.get-version.outputs.version }}
|
||||||
|
release:
|
||||||
|
description: "release number"
|
||||||
|
value: ${{ jobs.get-version.outputs.release }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
get-version:
|
||||||
|
runs-on: [self-hosted, common]
|
||||||
|
outputs:
|
||||||
|
stability: ${{ steps.get_environment.outputs.stability }}
|
||||||
|
version: ${{ steps.get_environment.outputs.version }}
|
||||||
|
release: ${{ steps.get_environment.outputs.release }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
#- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- id: get_environment
|
||||||
|
run: |
|
||||||
|
case "$BRANCHNAME" in
|
||||||
|
develop)
|
||||||
|
STABILITY="unstable"
|
||||||
|
;;
|
||||||
|
release* | hotfix*)
|
||||||
|
STABILITY="testing"
|
||||||
|
;;
|
||||||
|
master)
|
||||||
|
STABILITY="stable"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
STABILITY="canary"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# @todo remove next line
|
||||||
|
STABILITY="unstable"
|
||||||
|
|
||||||
|
echo "stability=$STABILITY" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
VERSION=`date '+%Y%m%d'`
|
||||||
|
echo "version=$(echo $VERSION)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
RELEASE=`date '+%H%M%S'`
|
||||||
|
echo "release=$(echo $RELEASE)" >> $GITHUB_OUTPUT
|
||||||
|
shell: bash
|
80
.github/workflows/plugin-delivery.yml
vendored
Normal file
80
.github/workflows/plugin-delivery.yml
vendored
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: "Plugins version"
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
release:
|
||||||
|
description: The release number
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
stability:
|
||||||
|
description: The package stability (stable, testing, unstable)
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
secrets:
|
||||||
|
artifactory_username:
|
||||||
|
required: true
|
||||||
|
artifactory_password:
|
||||||
|
required: true
|
||||||
|
update_repo_path:
|
||||||
|
description: "The update repo script path"
|
||||||
|
required: true
|
||||||
|
cloudfront_id:
|
||||||
|
description: "The cloudfront ID for repo url"
|
||||||
|
required: true
|
||||||
|
yum_repo_address:
|
||||||
|
description: "The legacy yum repo address"
|
||||||
|
required: true
|
||||||
|
yum_repo_key:
|
||||||
|
description: "The repo key"
|
||||||
|
required: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deliver-rpm:
|
||||||
|
runs-on: [self-hosted, common]
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
distrib: [el7, el8]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Delivery
|
||||||
|
uses: ./.github/actions/rpm-delivery
|
||||||
|
with:
|
||||||
|
distrib: ${{ matrix.distrib }}
|
||||||
|
version: ${{ inputs.version }}
|
||||||
|
release: ${{ inputs.release }}
|
||||||
|
cache_key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }}
|
||||||
|
update_repo_path: ${{ secrets.update_repo_path }}
|
||||||
|
cloudfront_id: ${{ secrets.cloudfront_id }}
|
||||||
|
yum_repo_address: ${{ secrets.yum_repo_address }}
|
||||||
|
yum_repo_key: ${{ secrets.yum_repo_key }}
|
||||||
|
stability: ${{ inputs.stability }}
|
||||||
|
|
||||||
|
deliver-deb:
|
||||||
|
runs-on: [self-hosted, common]
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
major_version: ["22.04", "22.10"]
|
||||||
|
include:
|
||||||
|
- distrib: bullseye
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Delivery
|
||||||
|
uses: ./.github/actions/deb-delivery
|
||||||
|
with:
|
||||||
|
distrib: ${{ matrix.distrib }}
|
||||||
|
major_version: ${{ matrix.major_version }}
|
||||||
|
version: ${{ inputs.version }}
|
||||||
|
release: ${{ inputs.release }}
|
||||||
|
artifactory_username: ${{ secrets.artifactory_username }}
|
||||||
|
artifactory_password: ${{ secrets.artifactory_password }}
|
||||||
|
cache_key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.distrib }}
|
||||||
|
stability: ${{ inputs.stability }}
|
87
.github/workflows/plugin-package.yml
vendored
Normal file
87
.github/workflows/plugin-package.yml
vendored
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
plugins:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
version:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
release:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
secrets:
|
||||||
|
artifactory_username:
|
||||||
|
required: true
|
||||||
|
artifactory_password:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
fatpacker:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.get_version.outputs.version }}
|
||||||
|
release: ${{ steps.get_version.outputs.release }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- name: Prepare FatPacker
|
||||||
|
uses: perl-actions/install-with-cpm@stable
|
||||||
|
with:
|
||||||
|
install: |
|
||||||
|
App::FatPacker
|
||||||
|
File::Copy::Recursive
|
||||||
|
JSON
|
||||||
|
|
||||||
|
- name: Run FatPacker
|
||||||
|
run: |
|
||||||
|
COMMIT=$(git log -1 HEAD --pretty=format:%h)
|
||||||
|
perl .github/scripts/plugins-source.container.pl "${{ inputs.plugins }}" "${{ steps.get_version.outputs.version }} ($COMMIT)"
|
||||||
|
|
||||||
|
- uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ./build/
|
||||||
|
key: fatpacked-plugins-${{ github.sha }}-${{ github.run_id }}
|
||||||
|
|
||||||
|
package:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
needs: [fatpacker]
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- package_extension: rpm
|
||||||
|
image: packaging-plugins-centos7
|
||||||
|
distrib: el7
|
||||||
|
- package_extension: rpm
|
||||||
|
image: packaging-plugins-alma8
|
||||||
|
distrib: el8
|
||||||
|
- package_extension: deb
|
||||||
|
image: packaging-plugins-bullseye
|
||||||
|
distrib: bullseye
|
||||||
|
name: "package ${{ matrix.distrib }}"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ./build/
|
||||||
|
key: fatpacked-plugins-${{ github.sha }}-${{ github.run_id }}
|
||||||
|
|
||||||
|
- uses: ./.github/actions/package
|
||||||
|
with:
|
||||||
|
package_extension: ${{ matrix.package_extension }}
|
||||||
|
image_name: ${{ matrix.image }}
|
||||||
|
script_name: plugin-packaging-${{ matrix.package_extension }}
|
||||||
|
plugins: ${{ inputs.plugins }}
|
||||||
|
version: ${{ inputs.version }}
|
||||||
|
release: ${{ inputs.release }}
|
||||||
|
cache_key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }}
|
||||||
|
sign: true
|
||||||
|
artifactory_username: ${{ secrets.artifactory_username }}
|
||||||
|
artifactory_password: ${{ secrets.artifactory_password }}
|
121
.github/workflows/plugins.yml
vendored
Normal file
121
.github/workflows/plugins.yml
vendored
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
name: plugins
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/plugins.yml'
|
||||||
|
- 'centreon-plugins/**'
|
||||||
|
- 'packaging/**'
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
- dev-[2-9][0-9].[0-9][0-9].x
|
||||||
|
- master
|
||||||
|
- "[2-9][0-9].[0-9][0-9].x"
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/plugins.yml'
|
||||||
|
- 'centreon-plugins/**'
|
||||||
|
- 'packaging/**'
|
||||||
|
tags:
|
||||||
|
- centreon-plugins-*
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
get-environment:
|
||||||
|
uses: ./.github/workflows/get-environment.yml
|
||||||
|
|
||||||
|
get-plugins:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
outputs:
|
||||||
|
plugins: ${{ steps.get_plugins.outputs.plugins }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.9'
|
||||||
|
|
||||||
|
- uses: dorny/paths-filter@v2
|
||||||
|
id: filter
|
||||||
|
with:
|
||||||
|
list-files: shell
|
||||||
|
filters: |
|
||||||
|
common:
|
||||||
|
- added|deleted|modified:
|
||||||
|
- 'centreon-plugins/centreon/**'
|
||||||
|
- 'packaging/rpm/**'
|
||||||
|
- 'packaging/debian/**'
|
||||||
|
packages:
|
||||||
|
- added|modified:
|
||||||
|
- 'packaging/centreon-**'
|
||||||
|
plugins:
|
||||||
|
- added|modified:
|
||||||
|
- 'centreon-plugins/**'
|
||||||
|
|
||||||
|
- name: transform to directories
|
||||||
|
id: transform
|
||||||
|
run: |
|
||||||
|
folders=()
|
||||||
|
for f in ${{ steps.filter.outputs.packages_files }}; \
|
||||||
|
do \
|
||||||
|
echo "Adding $(dirname $f) to folders"; \
|
||||||
|
folders+=($(dirname $f)); \
|
||||||
|
done
|
||||||
|
unique_folders=($(printf "%s\n" "${folders[@]}" | sort -u | tr '\n' ' '))
|
||||||
|
echo "package_directories=$(jq --compact-output --null-input '$ARGS.positional' --args -- ${unique_folders[@]})" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
folders=()
|
||||||
|
for f in ${{ steps.filter.outputs.plugins_files }}; \
|
||||||
|
do \
|
||||||
|
echo "Adding $(dirname $f) to folders"; \
|
||||||
|
folders+=($(dirname $f)); \
|
||||||
|
done
|
||||||
|
unique_folders=($(printf "%s\n" "${folders[@]}" | sort -u | tr '\n' ' '))
|
||||||
|
echo "plugin_directories=$(jq --compact-output --null-input '$ARGS.positional' --args -- ${unique_folders[@]})" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Get plugins for build
|
||||||
|
id: get_plugins
|
||||||
|
if: ${{ steps.filter.outputs.common == 'true' || steps.filter.outputs.packages == 'true' || steps.filter.outputs.plugins == 'true' }}
|
||||||
|
run: |
|
||||||
|
PLUGINS="$(python3 .github/scripts/process-plugins.py \
|
||||||
|
'${{ steps.filter.outputs.common == 'true' }}' \
|
||||||
|
'${{ steps.transform.outputs.package_directories }}' \
|
||||||
|
'${{ steps.filter.outputs.plugin_directories }}' \
|
||||||
|
)"
|
||||||
|
echo "plugins=$(echo $PLUGINS)" >> $GITHUB_OUTPUT
|
||||||
|
if [ "$PLUGINS" == '' ]; then
|
||||||
|
echo "::notice::There are no modifications to the plugins packages"
|
||||||
|
fi
|
||||||
|
|
||||||
|
package:
|
||||||
|
needs: [get-environment, get-plugins]
|
||||||
|
uses: ./.github/workflows/plugin-package.yml
|
||||||
|
with:
|
||||||
|
plugins: ${{ needs.get-plugins.outputs.plugins }}
|
||||||
|
version: ${{ needs.get-environment.outputs.version }}
|
||||||
|
release: ${{ needs.get-environment.outputs.release }}
|
||||||
|
secrets:
|
||||||
|
artifactory_username: ${{ secrets.REPOS_USERNAME }}
|
||||||
|
artifactory_password: ${{ secrets.REPOS_PASSWORD }}
|
||||||
|
|
||||||
|
deliver:
|
||||||
|
needs: [get-environment, package]
|
||||||
|
if: ${{ contains(fromJson('["stable", "testing", "unstable"]'), needs.get-environment.outputs.stability) }}
|
||||||
|
uses: ./.github/workflows/plugin-delivery.yml
|
||||||
|
with:
|
||||||
|
version: ${{ needs.get-environment.outputs.version }}
|
||||||
|
release: ${{ needs.get-environment.outputs.release }}
|
||||||
|
stability: ${{ needs.get-environment.outputs.stability }}
|
||||||
|
secrets:
|
||||||
|
artifactory_username: ${{ secrets.NEXUS_USER }}
|
||||||
|
artifactory_password: ${{ secrets.NEXUS_PASSWD }}
|
||||||
|
update_repo_path: ${{ secrets.UPDATE_REPO_PATH }}
|
||||||
|
cloudfront_id: ${{ secrets.CLOUDFRONT_ID }}
|
||||||
|
yum_repo_address: ${{ secrets.YUM_REPO_ADDRESS }}
|
||||||
|
yum_repo_key: ${{ secrets.YUM_REPO_KEY }}
|
70
centreon-plugins/Jenkinsfile
vendored
70
centreon-plugins/Jenkinsfile
vendored
@ -1,70 +0,0 @@
|
|||||||
|
|
||||||
env.REF_BRANCH = 'master'
|
|
||||||
if ((env.BRANCH_NAME == env.REF_BRANCH)) {
|
|
||||||
env.BUILD = 'REFERENCE'
|
|
||||||
env.REPO = '22.10-unstable'
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Source') {
|
|
||||||
node {
|
|
||||||
cleanWs()
|
|
||||||
sh 'setup_centreon_build.sh'
|
|
||||||
dir('centreon-plugins') {
|
|
||||||
checkout scm
|
|
||||||
}
|
|
||||||
sh './centreon-build/jobs/plugins/plugins-source.sh'
|
|
||||||
source = readProperties file: 'source.properties'
|
|
||||||
env.VERSION = "${source.VERSION}"
|
|
||||||
env.RELEASE = "${source.RELEASE}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('RPM/DEB Packaging') {
|
|
||||||
parallel 'RPM': {
|
|
||||||
node {
|
|
||||||
sh 'setup_centreon_build.sh'
|
|
||||||
sh './centreon-build/jobs/plugins/plugins-package.sh'
|
|
||||||
archiveArtifacts artifacts: 'rpms-centos7.tar.gz'
|
|
||||||
archiveArtifacts artifacts: 'rpms-alma8.tar.gz'
|
|
||||||
stash name: "rpms-centos7", includes: 'output-centos7/noarch/*.rpm'
|
|
||||||
stash name: "rpms-alma8", includes: 'output-alma8/noarch/*.rpm'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'package debian bullseye': {
|
|
||||||
node {
|
|
||||||
sh 'setup_centreon_build.sh'
|
|
||||||
sh './centreon-build/jobs/plugins/plugins-package-deb.sh'
|
|
||||||
archiveArtifacts artifacts: '*.deb'
|
|
||||||
stash name: "Debian11", includes: '*.deb'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((currentBuild.result ?: 'SUCCESS') != 'SUCCESS') {
|
|
||||||
error('Package stage failure.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('RPM Delivery') {
|
|
||||||
parallel 'rpm delivery': {
|
|
||||||
node {
|
|
||||||
sh 'setup_centreon_build.sh'
|
|
||||||
unstash 'rpms-centos7'
|
|
||||||
unstash 'rpms-alma8'
|
|
||||||
sh './centreon-build/jobs/plugins/plugins-delivery.sh'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'deliver debian bullseye': {
|
|
||||||
node {
|
|
||||||
withCredentials([usernamePassword(credentialsId: 'nexus-credentials', passwordVariable: 'NEXUS_PASSWORD', usernameVariable: 'NEXUS_USERNAME')]) {
|
|
||||||
checkout scm
|
|
||||||
unstash "Debian11"
|
|
||||||
sh '''
|
|
||||||
find -name "*.deb" -print0 | xargs -0 -t -I % -P 2 curl -u $NEXUS_USERNAME:$NEXUS_PASSWORD -H "Content-Type: multipart/form-data" --data-binary "@%" https://apt.centreon.com/repository/$REPO/
|
|
||||||
'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((currentBuild.result ?: 'SUCCESS') != 'SUCCESS') {
|
|
||||||
error('Package stage failure.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
255
packaging/README.md
Normal file
255
packaging/README.md
Normal file
@ -0,0 +1,255 @@
|
|||||||
|
# Centreon Plugins continuous integration
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
Centreon Plugins continuous integration is carried by the Centreon Build project.
|
||||||
|
This allow easy delivery of plugins on public repositories and better follow-up of changes.
|
||||||
|
|
||||||
|
This documentation presents the workflows to build and deliver packaged plugins on
|
||||||
|
unstable, testing and stable repositories.
|
||||||
|
|
||||||
|
### Basic principles
|
||||||
|
|
||||||
|
Packaged plugins are formed by two components:
|
||||||
|
|
||||||
|
* Source code from [Centreon-Plugins](<https://github.com/centreon/centreon-plugins>) project,
|
||||||
|
* Configuration files for standalone plugin files build and package dependencies management.
|
||||||
|
|
||||||
|
Those configuration files are hosted in this project.
|
||||||
|
|
||||||
|
### Continuous integration workflows
|
||||||
|
|
||||||
|
As the packaging process is based on two components, the CI can be triggered by both.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
* Each time a commit is made on Centreon Plugins master branch, a build is automatically launched (green arrows),
|
||||||
|
* Each time a new plugin configuration files are added, or existing files modified, a build as to
|
||||||
|
be launched manually (purple arrows).
|
||||||
|
|
||||||
|
The Jenkins job in charge of building unstable packages is the
|
||||||
|
[Centreon EPP/Centreon Plugins/master](<https://jenkins.centreon.com/view/Centreon%20EPP/job/centreon-plugins/job/master/>) job.
|
||||||
|
|
||||||
|
For each successful jobs, packages will be available on the unstable repositories:
|
||||||
|
|
||||||
|
* 2.8/CentOS 7: <http://yum.centreon.com/standard/3.4/el7/unstable/noarch/plugins/>,
|
||||||
|
* 18.10/CentOS 7: <http://yum.centreon.com/standard/18.10/el7/unstable/noarch/plugins/>.
|
||||||
|
|
||||||
|
Each time stamped subdirectories represents a successful build.
|
||||||
|
|
||||||
|
To make a build goes from unstable to testing, the
|
||||||
|
[centreon-plugins-testing](<https://jenkins.centreon.com/view/Centreon%20EPP/job/centreon-plugins-testing/>) job
|
||||||
|
should be launched.
|
||||||
|
This job needs a version and a release number:
|
||||||
|
|
||||||
|
* The version is the date of the unstable build considered as the most mature,
|
||||||
|
* The release number is the time of the unstable build considered as the most mature.
|
||||||
|
|
||||||
|
For each successful jobs, packages will be available on the testing repositories:
|
||||||
|
|
||||||
|
* 2.8/CentOS 7: <http://yum.centreon.com/standard/3.4/el7/testing/noarch/plugins/>,
|
||||||
|
* 18.10/CentOS 7: <http://yum.centreon.com/standard/18.10/el7/testing/noarch/plugins/>.
|
||||||
|
|
||||||
|
To make a build goes from testing to stable, the
|
||||||
|
[centreon-plugins-stable](<https://jenkins.centreon.com/view/Centreon%20EPP/job/centreon-plugins-stable/>) job
|
||||||
|
should be launched.
|
||||||
|
It takes the same parameters as the testing job.
|
||||||
|
|
||||||
|
Packages are now available on standard stable repositories.
|
||||||
|
|
||||||
|
## How to create a new packaged plugin
|
||||||
|
|
||||||
|
### Clone Centreon Build project
|
||||||
|
|
||||||
|
Clone the master branch of the Centreon Build project
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# git clone https://github.com/centreon/centreon-build
|
||||||
|
```
|
||||||
|
|
||||||
|
### Create configuration files
|
||||||
|
|
||||||
|
#### Create new directory
|
||||||
|
|
||||||
|
In the *centreon-build/packaging/plugins* directory, create a new directory.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# cd centreon-build/packaging/plugins
|
||||||
|
# mkdir centreon-plugin-<name>
|
||||||
|
```
|
||||||
|
|
||||||
|
The name of the package is generaly made from the tree of the plugin's source code but with some
|
||||||
|
specificities, for examples:
|
||||||
|
|
||||||
|
* *centreon-plugin-Network-Huawei-Snmp* plugin is for *network/huawei/snmp/* source code,
|
||||||
|
* *centreon-plugin-Applications-Antivirus-Kaspersky-Snmp* plugin is for *apps/antivirus/kaspersky/snmp/* source code,
|
||||||
|
* *centreon-plugin-Network-Firewalls-Paloalto-Standard-Snmp* plugin is for *network/paloalto/snmp/* source code.
|
||||||
|
|
||||||
|
Ask slack *#software-plugin-packs* channel to confirm name if needed.
|
||||||
|
|
||||||
|
#### Create standalone plugin configuration file
|
||||||
|
|
||||||
|
In the previously created directory, create a new JSON file named *pkg.json*.
|
||||||
|
|
||||||
|
In this file must appear the following mandatory entries:
|
||||||
|
|
||||||
|
* *pkg_name*: name of the package, same than the parent directory,
|
||||||
|
* *pkg_summary*: short string describing the plugin, starting with "Centreon Plugin to monitor",
|
||||||
|
* *plugin_name*: name of the standalone plugin file, starting with "centreon_" and made of words making this file unique,
|
||||||
|
* *files*: table listing all files that should be included in the standalone file, like common code and specific plugin code.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
{
|
||||||
|
"pkg_name": "centreon-plugin-Applications-Antivirus-Kaspersky-Snmp",
|
||||||
|
"pkg_summary": "Centreon Plugin to monitor Kaspersky Security Center using SNMP",
|
||||||
|
"plugin_name": "centreon_kaspersky_snmp.pl",
|
||||||
|
"files": [
|
||||||
|
"centreon/plugins/script_snmp.pm",
|
||||||
|
"centreon/plugins/snmp.pm",
|
||||||
|
"apps/antivirus/kaspersky/snmp/"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The following files are included by default:
|
||||||
|
|
||||||
|
* centreon/plugins/alternative/Getopt.pm,
|
||||||
|
* centreon/plugins/alternative/FatPackerOptions.pm,
|
||||||
|
* centreon/plugins/misc.pm,
|
||||||
|
* centreon/plugins/mode.pm,
|
||||||
|
* centreon/plugins/multi.pm,
|
||||||
|
* centreon/plugins/options.pm,
|
||||||
|
* centreon/plugins/output.pm,
|
||||||
|
* centreon/plugins/perfdata.pm,
|
||||||
|
* centreon/plugins/script.pm,
|
||||||
|
* centreon/plugins/statefile.pm,
|
||||||
|
* centreon/plugins/templates/counter.pm,
|
||||||
|
* centreon/plugins/templates/hardware.pm,
|
||||||
|
* centreon/plugins/values.pm.
|
||||||
|
|
||||||
|
Extra entries can be used, for example to make a package obsoleting another one:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
"custom_pkg_data": "Obsoletes: centreon-plugin-Old-Plugin",
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Create package dependencies management files
|
||||||
|
|
||||||
|
In the previously created directory, create two new JSON files named *rpm.json* and *deb.json*.
|
||||||
|
|
||||||
|
In this files must appear the following mandatory entry:
|
||||||
|
|
||||||
|
* *dependencies*: table listing all the perl dependencies that should be installed (does not include Perl core libraries),
|
||||||
|
|
||||||
|
Example of *rpm.json* file:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"perl(SNMP)",
|
||||||
|
"perl(DateTime)"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Example of *deb.json* file:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"libsnmp-perl",
|
||||||
|
"libdatetime-perl"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Commit and push changes
|
||||||
|
|
||||||
|
In the project directory, create a new branch:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# git checkout -B add-my-new-plugin
|
||||||
|
```
|
||||||
|
|
||||||
|
Add the new directory and files to be commited:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# git add packaging/plugins/centreon-plugin-My-Plugin
|
||||||
|
```
|
||||||
|
|
||||||
|
Commit the changes, respecting project format:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# git commit -m "feat(plugin): add new my-plugin json files"
|
||||||
|
```
|
||||||
|
|
||||||
|
Push the commit to your own fork:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# git push https://github.com/<username>/centreon-build add-my-new-plugin
|
||||||
|
```
|
||||||
|
|
||||||
|
Create a new pull request on the project and wait for the build team to accept it.
|
||||||
|
|
||||||
|
### Launch a Jenkins build
|
||||||
|
|
||||||
|
From the Jenkins *Centreon EPP* tab, launch the Centreon Plugins/master job
|
||||||
|
(<https://jenkins.centreon.com/view/Centreon%20EPP/job/centreon-plugins/job/master/>)
|
||||||
|
|
||||||
|
If the build succeed, the new plugin will be available on unstable repositories.
|
||||||
|
|
||||||
|
## How to edit a packaged plugin
|
||||||
|
|
||||||
|
### Clone Centreon Build project
|
||||||
|
|
||||||
|
Clone the master branch of the Centreon Build project
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# git clone https://github.com/centreon/centreon-build
|
||||||
|
```
|
||||||
|
|
||||||
|
### Edit configuration files
|
||||||
|
|
||||||
|
In the plugin configuration files directory, edit either *pkg.json*, *rpm.json* or *deb.json* files.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# cd centreon-build/packaging/plugins/centreon-plugin-My-Plugin
|
||||||
|
# vi pkg.json
|
||||||
|
```
|
||||||
|
|
||||||
|
### Commit and push changes
|
||||||
|
|
||||||
|
In the project directory, create a new branch:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# git checkout -B fix-my-plugin
|
||||||
|
```
|
||||||
|
|
||||||
|
Add the modified files to be commited:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# git add packaging/plugins/centreon-plugin-My-Plugin/pkg.json
|
||||||
|
```
|
||||||
|
|
||||||
|
Commit the changes, respecting project format:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# git commit -m "fix(plugin): fix my-plugin pkg.json file, adding common code"
|
||||||
|
```
|
||||||
|
|
||||||
|
Push the commit to your own fork:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# git push https://github.com/<username>/centreon-build fix-my-plugin
|
||||||
|
```
|
||||||
|
|
||||||
|
Create a new pull request on the project and wait for the build team to accept it.
|
||||||
|
|
||||||
|
### Launch a Jenkins build
|
||||||
|
|
||||||
|
From the Jenkins *Centreon EPP* tab, launch the Centreon Plugins/master job
|
||||||
|
(<https://jenkins.centreon.com/view/Centreon%20EPP/job/centreon-plugins/job/master/>)
|
||||||
|
|
||||||
|
If the build succeed, the new plugin will be available on unstable repositories.
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"libopenwsman-perl",
|
||||||
|
"libxml-simple-perl"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"pkg_name": "centreon-plugin-Applications-ActiveDirectory-Wsman",
|
||||||
|
"pkg_summary": "Centreon Plugin",
|
||||||
|
"plugin_name": "centreon_activedirectory_wsman.pl",
|
||||||
|
"files": [
|
||||||
|
"centreon/plugins/script_wsman.pm",
|
||||||
|
"centreon/plugins/wsman.pm",
|
||||||
|
"apps/microsoft/activedirectory/wsman/"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"perl(openwsman)",
|
||||||
|
"perl(POSIX)",
|
||||||
|
"perl(Time::HiRes)",
|
||||||
|
"perl(XML::Simple)"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"libjmx4perl-perl"
|
||||||
|
]
|
||||||
|
}
|
10
packaging/centreon-plugin-Applications-ActiveMQ-Jmx/pkg.json
Normal file
10
packaging/centreon-plugin-Applications-ActiveMQ-Jmx/pkg.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"pkg_name": "centreon-plugin-Applications-ActiveMQ-Jmx",
|
||||||
|
"pkg_summary": "Centreon Plugin to monitor ActiveMQ application using JMX",
|
||||||
|
"plugin_name": "centreon_activemq_jmx.pl",
|
||||||
|
"files": [
|
||||||
|
"centreon/plugins/script_custom.pm",
|
||||||
|
"centreon/common/protocols/jmx/",
|
||||||
|
"apps/mq/activemq/jmx/"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"perl(JMX::Jmx4Perl)"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"libssh-session-perl",
|
||||||
|
"plink"
|
||||||
|
]
|
||||||
|
}
|
12
packaging/centreon-plugin-Applications-Ansible-Cli/pkg.json
Normal file
12
packaging/centreon-plugin-Applications-Ansible-Cli/pkg.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"pkg_name": "centreon-plugin-Applications-Ansible-Cli",
|
||||||
|
"pkg_summary": "Centreon Plugin to interact with Ansible using CLI",
|
||||||
|
"plugin_name": "centreon_ansible_cli.pl",
|
||||||
|
"files": [
|
||||||
|
"centreon/plugins/script_custom.pm",
|
||||||
|
"centreon/plugins/script_custom/cli.pm",
|
||||||
|
"centreon/plugins/backend/ssh/",
|
||||||
|
"centreon/plugins/ssh.pm",
|
||||||
|
"apps/automation/ansible/cli/"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"perl(Libssh::Session)",
|
||||||
|
"plink"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"libtime-parsedate-perl"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"pkg_name": "centreon-plugin-Applications-Ansible-Tower",
|
||||||
|
"pkg_summary": "Centreon Plugin to monitor Ansible Tower using Tower CLI",
|
||||||
|
"plugin_name": "centreon_ansible_tower.pl",
|
||||||
|
"files": [
|
||||||
|
"centreon/plugins/script_custom.pm",
|
||||||
|
"apps/automation/ansible/tower/"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"perl(Date::Parse)"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"plink",
|
||||||
|
"libssh-session-perl"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"pkg_name": "centreon-plugin-Applications-Clamav-Ssh",
|
||||||
|
"pkg_summary": "Centreon Plugin to monitor ClamAV antivirus engine through SSH",
|
||||||
|
"plugin_name": "centreon_clamav_ssh.pl",
|
||||||
|
"files": [
|
||||||
|
"centreon/plugins/script_custom.pm",
|
||||||
|
"centreon/plugins/script_custom/cli.pm",
|
||||||
|
"centreon/plugins/backend/ssh/",
|
||||||
|
"centreon/plugins/ssh.pm",
|
||||||
|
"apps/antivirus/clamav/local/"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"plink",
|
||||||
|
"perl(Libssh::Session)"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"libsnmp-perl",
|
||||||
|
"libdatetime-perl"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"pkg_name": "centreon-plugin-Applications-Antivirus-Kaspersky-Snmp",
|
||||||
|
"pkg_summary": "Centreon Plugin",
|
||||||
|
"plugin_name": "centreon_kaspersky_snmp.pl",
|
||||||
|
"files": [
|
||||||
|
"centreon/plugins/script_snmp.pm",
|
||||||
|
"centreon/plugins/snmp.pm",
|
||||||
|
"apps/antivirus/kaspersky/snmp/"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"perl(SNMP)",
|
||||||
|
"perl(DateTime)"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"libsnmp-perl",
|
||||||
|
"libdatetime-perl"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"pkg_name": "centreon-plugin-Applications-Antivirus-Mcafee-Webgateway-Snmp",
|
||||||
|
"pkg_summary": "Centreon Plugin to monitor McAfee Web Gateway application using SNMP",
|
||||||
|
"plugin_name": "centreon_mcafee_webgateway_snmp.pl",
|
||||||
|
"files": [
|
||||||
|
"centreon/plugins/script_snmp.pm",
|
||||||
|
"centreon/plugins/snmp.pm",
|
||||||
|
"apps/antivirus/mcafee/webgateway/snmp/"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"perl(SNMP)",
|
||||||
|
"perl(Digest::MD5)",
|
||||||
|
"perl(DateTime)"
|
||||||
|
]
|
||||||
|
}
|
5
packaging/centreon-plugin-Applications-Awa-Jmx/deb.json
Normal file
5
packaging/centreon-plugin-Applications-Awa-Jmx/deb.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"libjmx4perl-perl"
|
||||||
|
]
|
||||||
|
}
|
11
packaging/centreon-plugin-Applications-Awa-Jmx/pkg.json
Normal file
11
packaging/centreon-plugin-Applications-Awa-Jmx/pkg.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"pkg_name": "centreon-plugin-Applications-Awa-Jmx",
|
||||||
|
"pkg_summary": "Centreon Plugin",
|
||||||
|
"plugin_name": "centreon_awa_jmx.pl",
|
||||||
|
"files": [
|
||||||
|
"centreon/plugins/script_custom.pm",
|
||||||
|
"centreon/common/protocols/jmx/",
|
||||||
|
"centreon/common/jvm",
|
||||||
|
"apps/java/awa/jmx/"
|
||||||
|
]
|
||||||
|
}
|
5
packaging/centreon-plugin-Applications-Awa-Jmx/rpm.json
Normal file
5
packaging/centreon-plugin-Applications-Awa-Jmx/rpm.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"perl(JMX::Jmx4Perl)"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"libssh-session-perl",
|
||||||
|
"plink"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"pkg_name": "centreon-plugin-Applications-Backup-Emc-Recoverypoint-Ssh",
|
||||||
|
"pkg_summary": "Centreon Plugin",
|
||||||
|
"plugin_name": "centreon_emc_recoverypoint.pl",
|
||||||
|
"files": [
|
||||||
|
"centreon/plugins/script_custom.pm",
|
||||||
|
"centreon/plugins/script_custom/cli.pm",
|
||||||
|
"centreon/plugins/backend/ssh/",
|
||||||
|
"centreon/plugins/ssh.pm",
|
||||||
|
"storage/emc/recoverypoint/ssh/"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"perl(Libssh::Session)",
|
||||||
|
"plink"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"libxml-xpath-perl"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"pkg_name": "centreon-plugin-Applications-Bind9-Web",
|
||||||
|
"pkg_summary": "Centreon Plugin Bind9",
|
||||||
|
"plugin_name": "centreon_bind9_web.pl",
|
||||||
|
"files": [
|
||||||
|
"centreon/plugins/script_custom.pm",
|
||||||
|
"apps/bind9/web/"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"perl(XML::XPath)"
|
||||||
|
]
|
||||||
|
}
|
5
packaging/centreon-plugin-Applications-Biztalk/deb.json
Normal file
5
packaging/centreon-plugin-Applications-Biztalk/deb.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"libdbi-perl"
|
||||||
|
]
|
||||||
|
}
|
11
packaging/centreon-plugin-Applications-Biztalk/pkg.json
Normal file
11
packaging/centreon-plugin-Applications-Biztalk/pkg.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"pkg_name": "centreon-plugin-Applications-Biztalk",
|
||||||
|
"pkg_summary": "Centreon Plugin",
|
||||||
|
"plugin_name": "centreon_biztalk.pl",
|
||||||
|
"files": [
|
||||||
|
"centreon/plugins/script_sql.pm",
|
||||||
|
"centreon/plugins/dbi.pm",
|
||||||
|
"database/mssql/",
|
||||||
|
"apps/biztalk/sql/"
|
||||||
|
]
|
||||||
|
}
|
5
packaging/centreon-plugin-Applications-Biztalk/rpm.json
Normal file
5
packaging/centreon-plugin-Applications-Biztalk/rpm.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"perl(DBI)"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"plink",
|
||||||
|
"libssh-session-perl"
|
||||||
|
]
|
||||||
|
}
|
11
packaging/centreon-plugin-Applications-Bluemind-Ssh/pkg.json
Normal file
11
packaging/centreon-plugin-Applications-Bluemind-Ssh/pkg.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"pkg_name": "centreon-plugin-Applications-Bluemind-Ssh",
|
||||||
|
"pkg_summary": "Centreon Plugin Bluemind SSH",
|
||||||
|
"plugin_name": "centreon_bluemind_ssh.pl",
|
||||||
|
"files": [
|
||||||
|
"centreon/plugins/script_custom.pm",
|
||||||
|
"centreon/plugins/backend/ssh/",
|
||||||
|
"centreon/plugins/ssh.pm",
|
||||||
|
"apps/bluemind/local/"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"plink",
|
||||||
|
"perl(Libssh::Session)"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"pkg_name": "centreon-plugin-Applications-Ceph-Restapi",
|
||||||
|
"pkg_summary": "Centreon Plugin",
|
||||||
|
"plugin_name": "centreon_ceph_restapi.pl",
|
||||||
|
"files": [
|
||||||
|
"centreon/plugins/script_custom.pm",
|
||||||
|
"apps/ceph/restapi/"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"libxml-simple-perl",
|
||||||
|
"libdatetime-perl"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"pkg_name": "centreon-plugin-Applications-Cisco-Cms-Restapi",
|
||||||
|
"pkg_summary": "Centreon Plugin to monitor Cisco CMS (Cisco Meeting Server) using RestAPI",
|
||||||
|
"plugin_name": "centreon_cisco_cms_restapi.pl",
|
||||||
|
"files": [
|
||||||
|
"centreon/plugins/script_custom.pm",
|
||||||
|
"apps/cisco/cms/restapi/"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"perl(XML::Simple)",
|
||||||
|
"perl(DateTime)",
|
||||||
|
"perl(Digest::SHA)"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"pkg_name": "centreon-plugin-Applications-Cisco-Dnac-Restapi",
|
||||||
|
"pkg_summary": "Centreon Plugin to monitor Cisco DNA Center using Rest API",
|
||||||
|
"plugin_name": "centreon_cisco_dnac_restapi.pl",
|
||||||
|
"files": [
|
||||||
|
"centreon/plugins/script_custom.pm",
|
||||||
|
"apps/cisco/dnac/restapi/"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"libxml-simple-perl",
|
||||||
|
"libdatetime-perl"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"pkg_name": "centreon-plugin-Applications-Cisco-Ise-Restapi",
|
||||||
|
"pkg_summary": "Centreon Plugin to monitor Cisco ISE (Identity Services Engine) using RestAPI",
|
||||||
|
"plugin_name": "centreon_cisco_ise_restapi.pl",
|
||||||
|
"files": [
|
||||||
|
"centreon/plugins/script_custom.pm",
|
||||||
|
"apps/cisco/ise/restapi/"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"perl(XML::Simple)",
|
||||||
|
"perl(DateTime)",
|
||||||
|
"perl(Digest::SHA)"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"pkg_name": "centreon-plugin-Applications-Cisco-Ssms-Restapi",
|
||||||
|
"pkg_summary": "Centreon Plugin to monitor Cisco Smart Software Manager Satellite using RestAPI",
|
||||||
|
"plugin_name": "centreon_cisco_ssms_restapi.pl",
|
||||||
|
"files": [
|
||||||
|
"centreon/plugins/script_custom.pm",
|
||||||
|
"apps/cisco/ssms/restapi/"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
],
|
||||||
|
"custom_pkg_data": "Obsoletes: centreon-plugin-Network-Cisco-Ssms-Restapi"
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"pkg_name": "centreon-plugin-Applications-Commvault-Commserve-Restapi",
|
||||||
|
"pkg_summary": "Centreon Plugin to monitor Commvault Commserve using Rest API",
|
||||||
|
"plugin_name": "centreon_commvault_commserve_restapi.pl",
|
||||||
|
"files": [
|
||||||
|
"centreon/plugins/script_custom.pm",
|
||||||
|
"apps/backup/commvault/commserve/restapi/"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"libjmx4perl-perl"
|
||||||
|
]
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user