Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ctor 474 use docker to test plugin #4983

Merged
merged 11 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/actions/test-plugins/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "test-plugins"
description: "Test plugin that are passed as parameters"
inputs:
cache-key:
description: "The packaged plugin's cache key"
required: true
plugin-list:
description: "List of plugins to install from the cache"
required: true
package-extension:
description: "Either 'rpm' or 'deb'. Needed to determine the package manager command (dnf or apt-get)."
required: true

runs:
using: "composite"
steps:

- 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
shell: bash
run: |
python3 .github/scripts/test-all-plugins.py ${{ inputs.package-extension }} ${{ inputs.plugin-list }}
68 changes: 68 additions & 0 deletions .github/docker/testing/Dockerfile.testing-plugins-alma8
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
ARG REGISTRY_URL

FROM ${REGISTRY_URL}/almalinux:8

RUN bash -e <<EOF

dnf install -y 'dnf-command(config-manager)' epel-release zstd jq
dnf config-manager --set-enabled powertools
dnf clean all

# Install Robotframework
dnf install -y python3.11 python3.11-pip
pip3.11 install robotframework robotframework-examples
# Install snmpsim
pip3.11 install snmpsim-lextudio

# Install node
curl -fsSL https://rpm.nodesource.com/setup_21.x | bash -
yum install -y nodejs

# Install mockoon
Evan-Adam marked this conversation as resolved.
Show resolved Hide resolved
npm install -g -D @mockoon/cli

# Add Centreon plugins repositories
echo -e '[centreon-plugins-stable]\n\
name=centreon plugins stable x86_64\n\
baseurl=https://packages.centreon.com/rpm-plugins/el8/stable/x86_64\n\
enabled=1\n\
gpgcheck=1\n\
gpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n\
[centreon-plugins-stable-noarch]\n\
name=centreon plugins stable noarch\n\
baseurl=https://packages.centreon.com/rpm-plugins/el8/stable/noarch\n\
enabled=1\n\
gpgcheck=1\n\
gpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n\
[centreon-plugins-testing]\n\
name=centreon plugins testing x86_64\n\
baseurl=https://packages.centreon.com/rpm-plugins/el8/testing/x86_64\n\
enabled=1\n\
gpgcheck=1\n\
gpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n\
[centreon-plugins-testing-noarch]\n\
name=centreon plugins testing noarch\n\
baseurl=https://packages.centreon.com/rpm-plugins/el8/testing/noarch\n\
enabled=1\n\
gpgcheck=1\n\
gpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n\
[centreon-plugins-unstable]\n\
name=centreon plugins unstable x86_64\n\
baseurl=https://packages.centreon.com/rpm-plugins/el8/unstable/x86_64\n\
enabled=1\n\
gpgcheck=1\n\
gpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n\
[centreon-plugins-unstable-noarch]\n\
name=centreon plugins unstable noarch\n\
baseurl=https://packages.centreon.com/rpm-plugins/el8/unstable/noarch\n\
enabled=1\n\
gpgcheck=1\n\
gpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n'\
>> /etc/yum.repos.d/centreon-plugins.repo

mkdir -p /var/lib/centreon/centplugins/
chmod 777 /var/lib/centreon/centplugins/

dnf clean all

EOF
67 changes: 67 additions & 0 deletions .github/docker/testing/Dockerfile.testing-plugins-alma9
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
ARG REGISTRY_URL

FROM ${REGISTRY_URL}/almalinux:9

RUN bash -e <<EOF

dnf install -y 'dnf-command(config-manager)' epel-release zstd jq
dnf config-manager --set-enabled crb
dnf clean all

# Install Robotframework
dnf install -y python3.11 python3.11-pip
pip3.11 install robotframework robotframework-examples
# Install snmpsim
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

# Add Centreon plugins repositories
echo -e '[centreon-plugins-stable]\n\
name=centreon plugins stable x86_64\n\
baseurl=https://packages.centreon.com/rpm-plugins/el9/stable/x86_64\n\
enabled=1\n\
gpgcheck=1\n\
gpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n\
[centreon-plugins-stable-noarch]\n\
name=centreon plugins stable noarch\n\
baseurl=https://packages.centreon.com/rpm-plugins/el9/stable/noarch\n\
enabled=1\n\
gpgcheck=1\n\
gpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n\
[centreon-plugins-testing]\n\
name=centreon plugins testing x86_64\n\
baseurl=https://packages.centreon.com/rpm-plugins/el9/testing/x86_64\n\
enabled=1\n\
gpgcheck=1\n\
gpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n\
[centreon-plugins-testing-noarch]\n\
name=centreon plugins testing noarch\n\
baseurl=https://packages.centreon.com/rpm-plugins/el9/testing/noarch\n\
enabled=1\n\
gpgcheck=1\n\
gpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n\
[centreon-plugins-unstable]\n\
name=centreon plugins unstable x86_64\n\
baseurl=https://packages.centreon.com/rpm-plugins/el9/unstable/x86_64\n\
enabled=1\n\
gpgcheck=1\n\
gpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n\
[centreon-plugins-unstable-noarch]\n\
name=centreon plugins unstable noarch\n\
baseurl=https://packages.centreon.com/rpm-plugins/el9/unstable/noarch\n\
enabled=1\n\
gpgcheck=1\n\
gpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n'\
>> /etc/yum.repos.d/centreon-plugins.repo

mkdir -p /var/lib/centreon/centplugins/
chmod 777 /var/lib/centreon/centplugins/

dnf clean all

EOF
48 changes: 48 additions & 0 deletions .github/docker/testing/Dockerfile.testing-plugins-bookworm
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
ARG REGISTRY_URL

FROM ${REGISTRY_URL}/debian:bookworm

ENV DEBIAN_FRONTEND noninteractive

# fix locale
RUN bash -e <<EOF

apt-get update
apt-get install -y locales libcurl4-openssl-dev curl wget zstd jq
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 bash -e <<EOF
apt-get update
# Install Robotframework
apt-get install -y python3-dev python3-pip
rm -rf /usr/lib/python3.11/EXTERNALLY-MANAGED
Evan-Adam marked this conversation as resolved.
Show resolved Hide resolved
pip3 install robotframework robotframework-examples
# Install snmpsim
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)
Evan-Adam marked this conversation as resolved.
Show resolved Hide resolved
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
echo "deb https://packages.centreon.com/apt-plugins-testing/ bookworm main" | tee -a /etc/apt/sources.list.d/centreon-plugins.list
echo "deb https://packages.centreon.com/apt-plugins-unstable/ bookworm main" | tee -a /etc/apt/sources.list.d/centreon-plugins.list
wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1
apt-get update

mkdir -p /var/lib/centreon/centplugins/
chmod 777 /var/lib/centreon/centplugins/

apt-get clean

EOF
47 changes: 47 additions & 0 deletions .github/docker/testing/Dockerfile.testing-plugins-bullseye
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
ARG REGISTRY_URL

FROM ${REGISTRY_URL}/debian:bullseye

ENV DEBIAN_FRONTEND noninteractive

# fix locale
RUN bash -e <<EOF

apt-get update
apt-get install -y locales libcurl4-openssl-dev curl wget zstd jq
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 bash -e <<EOF
apt-get update
# Install Robotframework
apt-get install -y python3 python3-dev python3-pip
pip3 install robotframework robotframework-examples
# Install snmpsim
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

# Add Centreon plugins repositories
echo "deb https://packages.centreon.com/apt-plugins-stable/ bullseye main" | tee /etc/apt/sources.list.d/centreon-plugins.list
echo "deb https://packages.centreon.com/apt-plugins-testing/ bullseye main" | tee -a /etc/apt/sources.list.d/centreon-plugins.list
echo "deb https://packages.centreon.com/apt-plugins-unstable/ bullseye main" | tee -a /etc/apt/sources.list.d/centreon-plugins.list
wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1
apt-get update

mkdir -p /var/lib/centreon/centplugins/
chmod 777 /var/lib/centreon/centplugins/

apt-get clean


EOF
45 changes: 45 additions & 0 deletions .github/docker/testing/Dockerfile.testing-plugins-jammy
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
ARG REGISTRY_URL

FROM ${REGISTRY_URL}/ubuntu:jammy

ENV DEBIAN_FRONTEND noninteractive

# fix locale
RUN bash -e <<EOF

apt-get update
apt-get install -y locales libcurl4-openssl-dev curl wget zstd jq
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 bash -e <<EOF
apt-get update
# Install Robotframework
apt-get install -y python3 python3-dev python3-pip
pip3 install robotframework robotframework-examples
# Install snmpsim
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

# 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
echo "deb https://packages.centreon.com/ubuntu-plugins-unstable/ jammy main" | tee -a /etc/apt/sources.list.d/centreon-plugins.list
wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1
apt-get update

mkdir -p /var/lib/centreon/centplugins/
chmod 777 /var/lib/centreon/centplugins/

apt-get clean

EOF
2 changes: 1 addition & 1 deletion .github/scripts/process-plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
kduret marked this conversation as resolved.
Show resolved Hide resolved

directory_path = re.search('^(.+)\/pkg.json', filepath).group(1)

Expand Down
Loading
Loading