From 2674d4aacb5a6bc3d0444c52bd3d1d7092094812 Mon Sep 17 00:00:00 2001 From: tuntoja <58987095+tuntoja@users.noreply.github.com> Date: Wed, 20 Jul 2022 17:19:36 +0200 Subject: [PATCH] Merge release-debian-22.04.0 into 22.04.x (#11383) * fix jenkinsfile for debian * fix jenkinsfile for debian * fix jenkinsfile for debian * fix jenkinsfile for debian * fix jenkinsfile for debian * fix jenkinsfile for debian * Update centreon-common.postinst * add centreon-poller package (#11274) * Fix lowercase names (#11275) * add package as dependency of centreon-poller (#11282) * improve snmpd file change (#11287) * fix path (#11288) * set snmp community to public using centreon profile (#11291) * (debian) Fix commit number in about page (#11292) * fix get commit number * fix path to get commit * add postinst to fix permissions for poller package (#11300) * comment other public entry (#11301) * (debian) fix permissions in generate traps directory (#11302) * fix permissions in generate traps directory * add centreon-engine-extcommands as dependency * Add widget single metric (#11303) * (debian) add centreon-database plugin as dependecy (#11306) * add centreon-database plugin as dependecy * add centreon-plugin-applications-jvm-actuator * fix(install): add port to dsn in database tempalte (#11324) * Update Jenkinsfile * Update Jenkinsfile * Update control * Update Jenkinsfile * Update Jenkinsfile * Update Jenkinsfile * simplifies the COMMIT var get value * add apt upgrade before run tasks Co-authored-by: Zakaria GUENNOUNE Co-authored-by: Zakaria Guennoune <83596451+zguennoune02@users.noreply.github.com> Co-authored-by: Luiz Costa --- Jenkinsfile | 14 +++---- ci/debian/centreon-common.postinst | 5 ++- .../centreon-poller-centreon-engine.postinst | 24 +++++++---- ci/debian/centreon-poller.postinst | 13 ++++++ ci/debian/centreon-trap.postinst | 13 ++++-- ci/debian/control | 42 ++++++++++++++++++- .../extra/centreon-web-apache/centreon.conf | 1 + ci/debian/rules | 1 + ci/scripts/centreon-deb-package.sh | 5 +++ www/install/var/databaseTemplate.yaml | 4 +- 10 files changed, 98 insertions(+), 24 deletions(-) create mode 100644 ci/debian/centreon-poller.postinst diff --git a/Jenkinsfile b/Jenkinsfile index 492f9f7eddc..5e5c1c40a51 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -136,12 +136,9 @@ def checkoutCentreonBuild() { */ stage('Deliver sources') { node { + cleanWs() dir('centreon-web') { checkout scm - if (!isStableBuild()) { - hasFrontendChanges = hasChanges(frontendFiles) - hasBackendChanges = hasChanges(backendFiles) - } } checkoutCentreonBuild() @@ -170,18 +167,21 @@ stage('Deliver sources') { reportTitles: '' ]) + // get api feature files apiFeatureFiles = sh( script: 'find centreon-web/tests/api/features -type f -name "*.feature" -printf "%P\n" | sort', returnStdout: true ).split() + // get tests E2E feature files e2eFeatureFiles = sh( script: 'find centreon-web/tests/e2e/cypress/integration -type f -name "*.feature" -printf "%P\n" | sort', returnStdout: true ).split() + //FIXME : reintegrate ldap features after fixing them featureFiles = sh( script: "rm centreon-web/features/Ldap*.feature && find centreon-web/features -type f -name '*.feature' | sed -e 's#centreon-web/features/##g' | sort", @@ -491,10 +491,10 @@ try { checkout scm unstash "Debian11" sh '''for i in $(echo *.deb) - do - curl -u $NEXUS_USERNAME:$NEXUS_PASSWORD -H "Content-Type: multipart/form-data" --data-binary "@./$i" https://apt.centreon.com/repository/22.04/ + do + curl -u $NEXUS_USERNAME:$NEXUS_PASSWORD -H "Content-Type: multipart/form-data" --data-binary "@./$i" https://apt.centreon.com/repository/22.04-$REPO/ done - ''' + ''' } } if ((currentBuild.result ?: 'SUCCESS') != 'SUCCESS') { diff --git a/ci/debian/centreon-common.postinst b/ci/debian/centreon-common.postinst index 656e0aad114..3ae2b180cc1 100644 --- a/ci/debian/centreon-common.postinst +++ b/ci/debian/centreon-common.postinst @@ -3,12 +3,13 @@ if [ "$1" = "configure" ] ; then if [ ! "$(getent passwd centreon)" ]; then # User will have a shell. Not secure but require refactoring otherwise. - adduser --system --group --shell /bin/bash --home /var/lib/centreon centreon + adduser --system --group --shell /bin/bash --home /var/spool/centreon centreon fi chown -vR centreon:centreon \ /etc/centreon \ - /var/cache/centreon + /var/cache/centreon \ + /var/spool/centreon chmod -R 0775 \ /var/cache/centreon fi diff --git a/ci/debian/centreon-poller-centreon-engine.postinst b/ci/debian/centreon-poller-centreon-engine.postinst index 9945a74b2c6..4d64f561601 100644 --- a/ci/debian/centreon-poller-centreon-engine.postinst +++ b/ci/debian/centreon-poller-centreon-engine.postinst @@ -25,18 +25,26 @@ if [ "$1" = "configure" ]; then chmod -v +x /usr/share/centreon/bin/centreontrapd # snmpd.conf file - if [ -f "/etc/snmpd/snmpd.conf" ]; then + if [ -e "/etc/snmp/snmpd.conf" ]; then # Add right in SNMP - sed -i \ - -e "/^view.*\.1\.3\.6\.1\.2\.1\.1$/i\ -view centreon included .1.3.6.1" \ - -e "/^access.*$/i\ -access notConfigGroup \"\" any noauth exact centreon none none" \ - /etc/snmp/snmpd.conf + if [ ! "$(grep 'view centreon' /etc/snmp/snmpd.conf)" ]; then + sed -i \ + '/^# system + hrSystem groups only/a view centreon included .1.3.6.1' \ + /etc/snmp/snmpd.conf + fi + if [ ! "$(grep 'public default -V centreon' /etc/snmp/snmpd.conf)" ]; then + sed -i \ + -e '/^# Read-only access to everyone to the systemonly view/a rocommunity public default -V centreon' \ + -e 's/^rocommunity public default -V systemonly/#rocommunity public default -V systemonly/' \ + -e 's/^rocommunity6 public default -V systemonly/#rocommunity6 public default -V systemonly/' \ + /etc/snmp/snmpd.conf + fi fi # Fix centreon configuration permissions - chmod -v 0775 /etc/centreon + chmod -v 0775 \ + /etc/centreon \ + /etc/centreon/config.d chmod -v 0664 \ /etc/centreon/centreontrapd.pm \ /etc/centreon/config.yaml \ diff --git a/ci/debian/centreon-poller.postinst b/ci/debian/centreon-poller.postinst new file mode 100644 index 00000000000..05153400d0a --- /dev/null +++ b/ci/debian/centreon-poller.postinst @@ -0,0 +1,13 @@ +#!/bin/sh + +if [ "$1" = "configure" ]; then + + if [ "$(getent passwd centreon-engine)" ]; then + chmod -v -R 0775 \ + /var/lib/centreon/centplugins + chown -v -R centreon-engine:centreon-engine \ + /var/lib/centreon/centplugins + fi + +fi +exit 0 diff --git a/ci/debian/centreon-trap.postinst b/ci/debian/centreon-trap.postinst index b6d531e27db..2335c4f4ce4 100644 --- a/ci/debian/centreon-trap.postinst +++ b/ci/debian/centreon-trap.postinst @@ -17,12 +17,19 @@ EOF fi # Fix permissions - chmod 0755 \ + chmod -v 0755 \ /usr/share/centreon/bin/centreontrapd \ /usr/share/centreon/bin/centreontrapdforward \ /var/spool/centreontrapd - chown centreon:centreon \ - /var/spool/centreontrapd + if [ "$(getent passwd centreon)" ]; then + chown -v centreon:centreon \ + /var/spool/centreontrapd + if [ -d "/etc/snmp/centreon_traps" ]; then + chmod -v 0775 /etc/snmp/centreon_traps + chown -v centreon:centreon \ + /etc/snmp/centreon_traps + fi + fi # Initial installation systemctl --no-reload preset centreontrapd.service || : &>/dev/null || : diff --git a/ci/debian/control b/ci/debian/control index b869040f9a6..e1b2724289a 100644 --- a/ci/debian/control +++ b/ci/debian/control @@ -54,12 +54,46 @@ Depends: centreon-widget-live-top10-memory-usage, centreon-widget-service-monitoring, centreon-widget-servicegroup-monitoring, - centreon-widget-tactical-overview + centreon-widget-tactical-overview, + centreon-widget-single-metric Description: The package contains base configuration for Centreon Engine and Centreon Broker. It provides one default monitoring engine running with Centreon Engine and two Centreon Broker instances to store real-time information in database and performance data in RRD files. +Package: centreon-poller +Architecture: all +Depends: + centreon-common (>= ${centreon:version}~), + centreon-poller-centreon-engine (>= ${centreon:version}~), + centreon-trap (>= ${centreon:version}~), + centreon-engine (>= ${centreon:version}~), + centreon-broker (>= ${centreon:version}~), + centreon-broker-cbmod (>= ${centreon:version}~), + centreon-broker-storage (>= ${centreon:version}~), + centreon-connector (>= ${centreon:version}~), + centreon-gorgone (>= ${centreon:version}~), + libdbd-mysql-perl, + libdbd-sqlite3-perl, + centreon-plugin-applications-databases-mysql, + centreon-plugin-applications-monitoring-centreon-central, + centreon-plugin-applications-monitoring-centreon-database, + centreon-plugin-applications-monitoring-centreon-map4-jmx, + centreon-plugin-applications-monitoring-centreon-poller, + centreon-plugin-applications-protocol-dns, + centreon-plugin-applications-protocol-ftp, + centreon-plugin-applications-protocol-http, + centreon-plugin-applications-protocol-ldap, + centreon-plugin-applications-databases-mysql, + centreon-plugin-hardware-printers-generic-snmp, + centreon-plugin-hardware-ups-standard-rfc1628-snmp, + centreon-plugin-network-cisco-standard-snmp, + centreon-plugin-operatingsystems-linux-snmp, + centreon-plugin-operatingsystems-windows-snmp, + monitoring-plugins-basic +Description: This package add rights and default directories for a poller + managed by Centreon. This includes the default central poller. + Package: centreon-web-common Architecture: all Depends: @@ -151,10 +185,14 @@ Depends: centreon-broker (>= ${centreon:version}~), centreon-engine (>= ${centreon:version}~), centreon-gorgone (>= ${centreon:version}~), + centreon-engine-extcommands (>= ${centreon:version}~), centreon-trap (>= ${centreon:version}~), + centreon-plugin-applications-databases-mysql, centreon-plugin-applications-monitoring-centreon-central, + centreon-plugin-applications-monitoring-centreon-database, + centreon-plugin-applications-monitoring-centreon-map4-jmx, + centreon-plugin-applications-jvm-actuator, centreon-plugin-applications-monitoring-centreon-poller, - centreon-plugin-applications-databases-mysql, centreon-plugin-applications-protocol-dns, centreon-plugin-applications-protocol-ldap, centreon-plugin-hardware-printers-generic-snmp, diff --git a/ci/debian/extra/centreon-web-apache/centreon.conf b/ci/debian/extra/centreon-web-apache/centreon.conf index 471ee52ef71..2f2d3d78ba2 100644 --- a/ci/debian/extra/centreon-web-apache/centreon.conf +++ b/ci/debian/extra/centreon-web-apache/centreon.conf @@ -33,6 +33,7 @@ ServerTokens Prod + DirectoryIndex index.php AllowOverride none Require all granted FallbackResource ${base_uri}/index.html diff --git a/ci/debian/rules b/ci/debian/rules index 09324ad7b9f..0e8ee8a1a3c 100644 --- a/ci/debian/rules +++ b/ci/debian/rules @@ -1,6 +1,7 @@ #!/usr/bin/make -f export DH_VERBOSE=1 +export CYPRESS_CACHE_FOLDER=$PWD/cypress_cache %: dh $@ diff --git a/ci/scripts/centreon-deb-package.sh b/ci/scripts/centreon-deb-package.sh index 5c77c9e3de0..d7a1cdcca36 100755 --- a/ci/scripts/centreon-deb-package.sh +++ b/ci/scripts/centreon-deb-package.sh @@ -6,6 +6,10 @@ if [ -z "$VERSION" -o -z "$RELEASE" -o -z "$DISTRIB" ] ; then exit 1 fi +# Upgrade image before +apt update +apt upgrade -y + echo "################################################## PACKAGING WEB ##################################################" AUTHOR="Luiz Costa" @@ -18,6 +22,7 @@ MAJOR_VERSION="$(echo $VERSION | egrep -o '^[0-9][0-9].[0-9][0-9]')" cd centreon/ # Replace basic macros. +COMMIT=$(git log -1 HEAD --pretty=format:%h) find ./www/include/Administration/about -type f | xargs --delimiter='\n' sed -i -e "s/@COMMIT@/$COMMIT/g" # set locale diff --git a/www/install/var/databaseTemplate.yaml b/www/install/var/databaseTemplate.yaml index a98f04798c7..a7321efb9aa 100644 --- a/www/install/var/databaseTemplate.yaml +++ b/www/install/var/databaseTemplate.yaml @@ -1,9 +1,9 @@ database: db_configuration: - dsn: "mysql:host=--ADDRESS--:--DBPORT--;dbname=--CONFDB--" + dsn: "mysql:host=--ADDRESS--:port=--DBPORT--;dbname=--CONFDB--" username: "--DBUSER--" password: "--DBPASS--" db_realtime: - dsn: "mysql:host=--ADDRESS--:--DBPORT--;dbname=--STORAGEDB--" + dsn: "mysql:host=--ADDRESS--:port=--DBPORT--;dbname=--STORAGEDB--" username: "--DBUSER--" password: "--DBPASS--"