Skip to content

Commit

Permalink
Adding docker images for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sdepassio committed Mar 27, 2024
1 parent 5feba68 commit 567775f
Show file tree
Hide file tree
Showing 13 changed files with 436 additions and 3 deletions.
86 changes: 86 additions & 0 deletions .github/docker/testing/Dockerfile.testing-plugins-alma8
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
ARG REGISTRY_URL

FROM ${REGISTRY_URL}/almalinux:8

RUN bash -e <<EOF

dnf install -y 'dnf-command(config-manager)' epel-release
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
npm install -g -D @mockoon/[email protected]

# 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

# Install perl dependencies
dnf install -y \
perl-Digest-MD5 \
perl-Pod-Parser \
perl-Net-Curl \
perl-URI-Encode \
perl-LWP-UserAgent-Determined \
perl-LWP-Protocol-https \
perl-IO-Socket-SSL \
perl-URI \
perl-HTTP-ProxyAutoConfig \
perl-CryptX \
perl-MIME-Base64 \
perl-JSON-XS \
perl-JSON-Path \
perl-KeePass-Reader \
perl-Storable \
perl-POSIX-strftime-Compiler \
perl-Encode

dnf clean all

EOF

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

FROM ${REGISTRY_URL}/almalinux:9

RUN bash -e <<EOF

dnf install -y 'dnf-command(config-manager)' epel-release
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/[email protected]

# 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

# Install perl dependencies
dnf install -y \
perl-Digest-MD5 \
perl-Pod-Parser \
perl-Net-Curl \
perl-URI-Encode \
perl-LWP-UserAgent-Determined \
perl-LWP-Protocol-https \
perl-IO-Socket-SSL \
perl-URI \
perl-HTTP-ProxyAutoConfig \
perl-CryptX \
perl-MIME-Base64 \
perl-JSON-XS \
perl-JSON-Path \
perl-KeePass-Reader \
perl-Storable \
perl-POSIX-strftime-Compiler \
perl-Encode

dnf clean all

EOF

WORKDIR /tests
63 changes: 63 additions & 0 deletions .github/docker/testing/Dockerfile.testing-plugins-bookworm
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
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
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
pip install robotframework robotframework-examples
# Install snmpsim
pip 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/[email protected]

# 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

# Install perl dependencies
apt-get install -y \
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

apt-get update
apt-get clean

EOF
61 changes: 61 additions & 0 deletions .github/docker/testing/Dockerfile.testing-plugins-bullseye
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
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
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
# Install Robotframework
apt-get install -y python3 python3-dev python3-pip
pip install robotframework robotframework-examples
# Install snmpsim
pip 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/[email protected]

# 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

# Install perl dependencies
apt-get install -y \
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

apt-get update
apt-get clean

EOF
61 changes: 61 additions & 0 deletions .github/docker/testing/Dockerfile.testing-plugins-jammy
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
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
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
pip install robotframework robotframework-examples
# Install snmpsim
pip 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/[email protected]

# 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

# Install perl dependencies
apt-get install -y \
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

apt-get update
apt-get clean

EOF
6 changes: 3 additions & 3 deletions .github/workflows/docker-builder-packaging-plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 567775f

Please sign in to comment.