-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mon 22230 create a dedicated docker image of centreon collect (#923)
* use of test images * pass image in cache * enh(test):factor database creation and package install * add other configuration to test * test: install bdd and others in docker-builder * no more ssh2 package * review comments * review comments * fix conanfile opentelemetry grpc conflict
- Loading branch information
1 parent
1e3f6d0
commit 4841ffb
Showing
13 changed files
with
364 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
ARG REGISTRY_URL | ||
|
||
FROM ${REGISTRY_URL}/almalinux:9 | ||
|
||
COPY . /tmp/collect | ||
|
||
RUN <<EOF | ||
|
||
# Base dnf configuration. | ||
echo 'http_caching=none' >> /etc/yum.conf | ||
echo 'assumeyes=1' >> /etc/yum.conf | ||
sed -i 's/best=True/best=False/g' /etc/dnf/dnf.conf | ||
dnf install -y dnf-plugins-core | ||
dnf config-manager --set-enabled crb | ||
|
||
dnf install -y epel-release | ||
|
||
dnf install -y \ | ||
gcc \ | ||
gcc-c++ \ | ||
gdb \ | ||
git \ | ||
openssh-server \ | ||
mariadb-server \ | ||
mariadb \ | ||
gnutls \ | ||
libgcrypt \ | ||
lua \ | ||
perl-ExtUtils-Embed \ | ||
python3 \ | ||
python3-devel \ | ||
python3-pip \ | ||
perl-Thread-Queue \ | ||
rrdtool \ | ||
perl \ | ||
procps-ng \ | ||
zstd \ | ||
psmisc \ | ||
sudo | ||
|
||
echo "install robot and dependencies" | ||
|
||
pip3 install -U robotframework robotframework-databaselibrary robotframework-httpctrl robotframework-examples pymysql python-dateutil psutil | ||
pip3 install grpcio grpcio_tools py-cpuinfo cython unqlite gitpython boto3 | ||
|
||
cd /tmp/collect | ||
|
||
.github/scripts/collect-prepare-test-robot.sh mariadb | ||
|
||
/bin/rm -rf /tmp/collect | ||
|
||
EOF | ||
|
53 changes: 53 additions & 0 deletions
53
.github/docker/Dockerfile.centreon-collect-debian-bullseye-test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
ARG REGISTRY_URL | ||
|
||
FROM ${REGISTRY_URL}/debian:bullseye | ||
|
||
|
||
COPY . /tmp/collect | ||
|
||
RUN <<EOF | ||
|
||
apt-get update | ||
|
||
apt-get -y install curl \ | ||
gcc \ | ||
g++ \ | ||
gdb \ | ||
git \ | ||
mariadb-server \ | ||
openssh-server \ | ||
libmariadb3 \ | ||
librrd8 \ | ||
libgnutlsxx28 \ | ||
liblua5.3 \ | ||
python3 \ | ||
python3-dev \ | ||
python3-pip \ | ||
libperl-dev \ | ||
libgcrypt20 \ | ||
aptitude \ | ||
strace \ | ||
locales \ | ||
rrdtool \ | ||
rrdcached \ | ||
zstd \ | ||
psmisc \ | ||
sudo | ||
|
||
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 | ||
|
||
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py | ||
python3 get-pip.py | ||
|
||
pip3 install -U robotframework robotframework-databaselibrary robotframework-httpctrl robotframework-examples pymysql python-dateutil psutil | ||
pip3 install grpcio grpcio_tools py-cpuinfo cython unqlite gitpython boto3 | ||
|
||
|
||
cd /tmp/collect | ||
|
||
.github/scripts/collect-prepare-test-robot.sh mariadb | ||
|
||
/bin/rm -rf /tmp/collect | ||
|
||
EOF | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
.github/docker/Dockerfile.centreon-collect-mysql-alma9-test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
ARG REGISTRY_URL | ||
|
||
FROM ${REGISTRY_URL}/almalinux:9 | ||
|
||
COPY . /tmp/collect | ||
|
||
RUN <<EOF | ||
|
||
# Base dnf configuration. | ||
echo 'http_caching=none' >> /etc/yum.conf | ||
echo 'assumeyes=1' >> /etc/yum.conf | ||
sed -i 's/best=True/best=False/g' /etc/dnf/dnf.conf | ||
dnf install -y dnf-plugins-core | ||
dnf config-manager --set-enabled crb | ||
|
||
dnf install -y epel-release | ||
|
||
dnf install -y gcc \ | ||
gcc-c++ \ | ||
gdb \ | ||
git \ | ||
openssh-server \ | ||
mysql-server \ | ||
mysql \ | ||
gnutls \ | ||
libgcrypt \ | ||
lua \ | ||
perl-ExtUtils-Embed \ | ||
python3 \ | ||
python3-devel \ | ||
python3-pip \ | ||
perl-Thread-Queue \ | ||
rrdtool \ | ||
perl \ | ||
procps-ng \ | ||
zstd \ | ||
psmisc \ | ||
sudo \ | ||
iproute | ||
|
||
echo "install robot and dependencies" | ||
|
||
pip3 install -U robotframework robotframework-databaselibrary robotframework-httpctrl robotframework-examples pymysql python-dateutil psutil | ||
pip3 install grpcio grpcio_tools py-cpuinfo cython unqlite gitpython boto3 | ||
|
||
cd /tmp/collect | ||
|
||
.github/scripts/collect-prepare-test-robot.sh mysql | ||
|
||
/bin/rm -rf /tmp/collect | ||
|
||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#!/bin/bash | ||
set -e | ||
set -x | ||
|
||
|
||
database_type=$1 | ||
|
||
. /etc/os-release | ||
distrib=${ID} | ||
distrib=$(echo $distrib | tr '[:lower:]' '[:upper:]') | ||
|
||
|
||
echo "########################### Configure sshd ###########################" | ||
ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -P "" <<<y | ||
ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -P "" <<<y | ||
ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -P "" <<<y | ||
mkdir -p /run/sshd | ||
|
||
if [ $database_type == 'mysql' ]; then | ||
echo "########################### Start MySQL ######################################" | ||
#workaround of forbidden execution of mysqld | ||
cp /usr/libexec/mysqld /usr/libexec/mysqldtoto | ||
/usr/libexec/mysqldtoto --user=root --initialize-insecure | ||
/usr/libexec/mysqldtoto --user=root & | ||
|
||
while [ ! -S /var/lib/mysql/mysql.sock ] && [ ! -S /var/run/mysqld/mysqld.sock ]; do | ||
sleep 10 | ||
done | ||
|
||
sleep 5 | ||
echo "########################### Init centreon database ############################" | ||
|
||
mysql -e "CREATE USER IF NOT EXISTS 'centreon'@'localhost' IDENTIFIED WITH mysql_native_password BY 'centreon';" | ||
mysql -e "CREATE USER IF NOT EXISTS 'root_centreon'@'localhost' IDENTIFIED WITH mysql_native_password BY 'centreon';" | ||
else | ||
echo "########################### Start MariaDB ######################################" | ||
if [ "$distrib" = "ALMALINUX" ]; then | ||
mysql_install_db --user=root --basedir=/usr --datadir=/var/lib/mysql | ||
mariadbd --socket=/var/lib/mysql/mysql.sock --user=root > /dev/null 2>&1 & | ||
else | ||
mkdir -p /run/mysqld | ||
chown mysql:mysql /run/mysqld | ||
mariadbd --socket=/run/mysqld/mysqld.sock --user=root > /dev/null 2>&1 & | ||
fi | ||
sleep 5 | ||
|
||
echo "########################### Init centreon database ############################" | ||
|
||
mysql -e "CREATE USER IF NOT EXISTS 'centreon'@'localhost' IDENTIFIED BY 'centreon';" | ||
mysql -e "CREATE USER IF NOT EXISTS 'root_centreon'@'localhost' IDENTIFIED BY 'centreon';" | ||
fi | ||
|
||
mysql -e "GRANT SELECT,UPDATE,DELETE,INSERT,CREATE,DROP,INDEX,ALTER,LOCK TABLES,CREATE TEMPORARY TABLES, EVENT,CREATE VIEW ON *.* TO 'centreon'@'localhost';" | ||
mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'root_centreon'@'localhost'" | ||
|
||
cat resources/centreon.sql | sed "s/DBNameConf/centreon/g" > /tmp/centreon.sql | ||
|
||
mysql -u root_centreon -pcentreon < resources/centreon_storage.sql | ||
mysql -u root_centreon -pcentreon < /tmp/centreon.sql | ||
|
||
cd tests | ||
|
||
if [ "$distrib" = "ALMALINUX" ]; then | ||
dnf groupinstall -y "Development Tools" | ||
dnf install -y python3-devel | ||
else | ||
apt-get update | ||
apt-get install -y build-essential | ||
apt-get install -y python3-dev | ||
fi | ||
|
||
|
||
echo "########################## Install centreon collect ###########################" | ||
cd .. | ||
echo "Installation..." | ||
if [ "$distrib" = "ALMALINUX" ]; then | ||
dnf clean all | ||
rm -f ./*-selinux-*.rpm # avoid to install selinux packages which are dependent to centreon-common-selinux | ||
dnf install -y ./*.rpm | ||
else | ||
apt-get update | ||
# apt-get install -y ./*.deb | ||
fi | ||
|
||
|
||
if [ $database_type == 'mysql' ]; then | ||
killall -w mysqldtoto | ||
else | ||
killall -w mariadbd | ||
fi | ||
|
||
cd .. | ||
|
||
\rm -rf * | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
4841ffb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Robot Results
Failed Tests
Bench