From 0c01f2946ed21f5e7977b5503f9c9f00e72fd708 Mon Sep 17 00:00:00 2001 From: waja Date: Fri, 23 Feb 2024 14:25:44 +0100 Subject: CI specfile (#1894) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Adding spec file and github pipeline for testing * Restructure github pipelines for more clarity * Add build tests for several RPM based distributions --------- Co-authored-by: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> --- .github/mock.sh | 50 ++ .github/monitoring-plugins.spec | 975 +++++++++++++++++++++++++++++++++++++++ .github/os_detect.sh | 18 + .github/workflows/spellcheck.yml | 27 ++ .github/workflows/test.yml | 76 ++- 5 files changed, 1105 insertions(+), 41 deletions(-) create mode 100755 .github/mock.sh create mode 100644 .github/monitoring-plugins.spec create mode 100644 .github/os_detect.sh create mode 100644 .github/workflows/spellcheck.yml (limited to '.github') diff --git a/.github/mock.sh b/.github/mock.sh new file mode 100755 index 00000000..7fbe6903 --- /dev/null +++ b/.github/mock.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +set -x + +export DEBIAN_FRONTEND=noninteractive + +BASE_PATH="/src" + +ls -la ${BASE_PATH}/.github/os_detect.sh +. ${BASE_PATH}/.github/os_detect.sh + +SRCRPM_DIR="/tmp/result-srcrpm" +RPM_DIR="/tmp/result-rpm" +SPEC_DIR="${BASE_PATH}/.github/" +SOURCE_DIR="." +SPEC_FILE="${SPEC_DIR}monitoring-plugins.spec" + +cd ${BASE_PATH} + +dnf -y --setopt="tsflags=nodocs" update && \ + if [ ${distro_id} != "fedora" ]; then dnf -y --setopt="tsflags=nodocs" install epel-release; else platform_id="$(echo ${platform_id} | sed s/^f/fc/)"; fi && \ + case ${distro_id} in + ol) + case ${platform_id} in + el9) + dnf config-manager --add-repo https://copr.fedorainfracloud.org/coprs/g/mock/mock-stable/repo/epel-9/group_mock-mock-stable-epel-9.repo + ;; + el8) + dnf config-manager --add-repo https://copr.fedorainfracloud.org/coprs/g/mock/mock-stable/repo/epel-8/group_mock-mock-stable-epel-8.repo + ;; + esac + ;; + esac + dnf -y --setopt="tsflags=nodocs" install mock rpm-build git-core && \ + usermod -a -G mock $(whoami) +SRC_RPM="monitoring-plugins-*-1.${platform_id}.src.rpm" +if command -v git > /dev/null 2>&1; then + git config --global --add safe.directory ${BASE_PATH} + SHA="$(git rev-parse HEAD)" + sed "s/^%global commit.*/%global commit ${SHA}/" ${SPEC_FILE} > ${SPEC_DIR}monitoring-plugins-git.spec + sed -i "s/^%global fromgit.*/%global fromgit 1/" ${SPEC_DIR}monitoring-plugins-git.spec + SPEC_FILE="${SPEC_DIR}monitoring-plugins-git.spec" + SRC_RPM="monitoring-plugins-*git.$(echo ${SHA:0:7})*.${platform_id}.src.rpm" +fi +mkdir -p "${SRCRPM_DIR}" "${RPM_DIR}" +#rpmbuild --undefine=_disable_source_fetch --define "_sourcedir ${SOURCE_DIR}" -ba ${SPEC_FILE} +dnf -y --setopt="tsflags=nodocs" install rpmdevtools && spectool -g -C ${SOURCE_DIR} ${SPEC_FILE} && \ +mock --dnf --clean --spec ${SPEC_FILE} --sources=${SOURCE_DIR} --result=${SRCRPM_DIR} --build || { cat ${SRCRPM_DIR}/{root,build}.log; exit 1; } +mock --dnf --clean --sources=${SOURCE_DIR} --result=${RPM_DIR} --rebuild ${SRCRPM_DIR}/${SRC_RPM} || { cat ${RPM_DIR}/{root,build}.log; exit 1; } +ls -la ${SOURCE_DIR} ${SRCRPM_DIR} ${RPM_DIR} diff --git a/.github/monitoring-plugins.spec b/.github/monitoring-plugins.spec new file mode 100644 index 00000000..5cae3e59 --- /dev/null +++ b/.github/monitoring-plugins.spec @@ -0,0 +1,975 @@ +%global upstream_name monitoring-plugins +%global version 2.3.3 +%global plugindir %{_libdir}/monitoring/plugins +%global commit 72dd0a308130b9778828d143d1b9d9906218d6ac +%global shortcommit %(c=%{commit}; echo ${c:0:7}) +%global fromgit 0 + +%define _unpackaged_files_terminate_build 0 + +Name: %{upstream_name} +Version: %{version} +Summary: Monitoring Plugins from the Monitoring Plugins Team + +License: GPLv3 +URL: https://www.monitoring-plugins.org +## When using checkouts from git, use the following +%if 0%{?fromgit} +Release: git.%{?shortcommit}.1%{?dist} +Source0: https://github.com/monitoring-plugins/%{name}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz +%else +Release: 1%{?dist} +Source0: https://www.monitoring-plugins.org/download/monitoring-plugins-%{version}.tar.gz +%endif +Conflicts: nagios-plugins + + + + +##### BUILD REQUIREMENTS ##### +# Needed for the git code +%if 0%{?fromgit} +BuildRequires: automake +BuildRequires: autoconf +BuildRequires: gettext-devel +%endif +### General build requirements +BuildRequires: gcc +BuildRequires: make +BuildRequires: automake + +### Check Plugin specific build requirements +# check_by_ssh +BuildRequires: openssh-clients + +# check_curl +BuildRequires: libcurl-devel >= 7.15.2 +BuildRequires: openssl-devel +BuildRequires: uriparser-devel >= 0.7.5 + +# check_dbi +%if 0%{?rhel} != 9 +BuildRequires: libdbi-devel +%endif + +# check_dig check_dns +BuildRequires: bind-utils + +# check_disk_smb +%if 0%{?rhel} == 7 +BuildRequires: samba-client +%endif + +# check_fping +BuildRequires: fping + +# check_game +%if 0%{?rhel} != 8 +BuildRequires: qstat +%endif + +# check_hpjd +BuildRequires: net-snmp-utils + +# check_ldap check_ldaps +BuildRequires: openldap-devel + +# check_load +BuildRequires: procps-ng + +# check_mysql check_mysql_query +%if 0%{?rhel} == 7 +BuildRequires: mariadb-devel +%endif + +# check_pgsql +BuildRequires: postgresql-devel + +# check_radius +BuildRequires: radcli-devel + +%description +Common files for Monitoring Plugins + +%files +%{plugindir}/negate +%{plugindir}/urlize +%{plugindir}/utils.pm +%{plugindir}/utils.sh +%doc ABOUT-NLS +%doc ACKNOWLEDGEMENTS +%doc AUTHORS +%doc CODING +%doc FAQ +%doc NEWS +%doc README +%doc REQUIREMENTS +%doc SUPPORT +%license COPYING + + + + +##### ACTUAL BUILD ##### +%prep +%if 0%{?fromgit} +%autosetup -n %{upstream_name}-%{commit} +%else +%autosetup -n %{upstream_name}-%{version} +%endif + + +%build +%if 0%{?fromgit} +./tools/setup +%endif +%configure \ + --prefix=%{_prefix} \ + --libexecdir=%{plugindir} \ + --with-openssl=/usr \ + --with-ping-command="/usr/bin/ping -4 -n -U -w %d -c %d %s" \ + --with-ping6-command="/usr/bin/ping -6 -n -U -w %d -c %d %s" +%make_build + +%if 0%{?fromgit} +make THANKS +%endif + +%install +%make_install +%{__make} install-root DESTDIR=%{buildroot} INSTALL="%{__install} -p" + + + + +##### SUB PACKAGES ##### +# all +%package all +Summary: Monitoring Plugins - All Check Plugins +Requires: %{name} +Requires: %{name}-apt +Requires: %{name}-breeze +Requires: %{name}-by_ssh +Requires: %{name}-cluster +Requires: %{name}-curl +%if 0%{?rhel} != 9 +Requires: %{name}-dbi +%endif +Requires: %{name}-dhcp +Requires: %{name}-dig +Requires: %{name}-disk +%if 0%{?rhel} == 7 +Requires: %{name}-disk_smb +%endif +Requires: %{name}-dns +Requires: %{name}-dummy +Requires: %{name}-file_age +Requires: %{name}-flexlm +Requires: %{name}-fping +%if 0%{?rhel} != 8 +Requires: %{name}-game +%endif +Requires: %{name}-hpjd +Requires: %{name}-http +Requires: %{name}-icmp +Requires: %{name}-ide_smart +Requires: %{name}-ifoperstatus +Requires: %{name}-ifstatus +Requires: %{name}-ircd +Requires: %{name}-ldap +Requires: %{name}-load +Requires: %{name}-log +Requires: %{name}-mailq +Requires: %{name}-mrtg +Requires: %{name}-mrtgtraf +%if 0%{?rhel} == 7 +Requires: %{name}-mysql +Requires: %{name}-mysql_query +%endif +Requires: %{name}-nagios +Requires: %{name}-nt +Requires: %{name}-ntp +Requires: %{name}-ntp_peer +Requires: %{name}-ntp_time +Requires: %{name}-nwstat +Requires: %{name}-oracle +Requires: %{name}-overcr +Requires: %{name}-pgsql +Requires: %{name}-ping +Requires: %{name}-procs +Requires: %{name}-radius +Requires: %{name}-real +Requires: %{name}-rpc +Requires: %{name}-sensors +Requires: %{name}-smtp +Requires: %{name}-snmp +Requires: %{name}-ssh +Requires: %{name}-swap +Requires: %{name}-tcp +Requires: %{name}-time +Requires: %{name}-ups +Requires: %{name}-uptime +Requires: %{name}-users +Requires: %{name}-wave + +%description all +Meta package that requires all the check plugins of the Monitoring Plugins + +%files all + + + +# check_apt +%package apt +Summary: Monitoring Plugins - check_apt +Requires: %{name} = %{version}-%{release} + +%description apt +Provides check_apt of the Monitoring Plugins. + +%files apt +%{plugindir}/check_apt + + + +# check_breeze +%package breeze +Summary: Monitoring Plugins - check_breeze +Requires: %{name} = %{version}-%{release} + +%description breeze +Provides check_breeze of the Monitoring Plugins. + +%files breeze +%{plugindir}/check_breeze + + + +# check_by_ssh +%package by_ssh +Summary: Monitoring Plugins - check_by_ssh +Requires: %{name} = %{version}-%{release} + +%description by_ssh +Provides check_by_ssh of the Monitoring Plugins. + +%files by_ssh +%{plugindir}/check_by_ssh + + + +# check_cluster +%package cluster +Summary: Monitoring Plugins - check_cluster +Requires: %{name} = %{version}-%{release} + +%description cluster +Provides check_cluster of the Monitoring Plugins. + +%files cluster +%{plugindir}/check_cluster + + + +# check_curl +%package curl +Summary: Monitoring Plugins - check_curl +Requires: %{name} = %{version}-%{release} + +%description curl +Provides check_curl of the Monitoring Plugins. + +%files curl +%{plugindir}/check_curl + + + +# check_dbi +%if 0%{?rhel} != 9 +%package dbi +Summary: Monitoring Plugins - check_dbi +Requires: %{name} = %{version}-%{release} + +%description dbi +Provides check_dbi of the Monitoring Plugins. + +%files dbi +%{plugindir}/check_dbi +%endif + + + +# check_dhcp +%package dhcp +Summary: Monitoring Plugins - check_dhcp +Requires: %{name} = %{version}-%{release} + +%description dhcp +Provides check_dhcp of the Monitoring Plugins. + +%files dhcp +%{plugindir}/check_dhcp + + + +# check_dig +%package dig +Summary: Monitoring Plugins - check_dig +Requires: %{name} = %{version}-%{release} +Requires: bind-utils + +%description dig +Provides check_dig of the Monitoring Plugins. + +%files dig +%{plugindir}/check_dig + + + +# check_disk +%package disk +Summary: Monitoring Plugins - check_disk +Requires: %{name} = %{version}-%{release} + +%description disk +Provides check_disk of the Monitoring Plugins. + +%files disk +%{plugindir}/check_disk + + + +# check_disk_smb +%if 0%{?rhel} == 7 +%package disk_smb +Summary: Monitoring Plugins - check_disk_smb +Requires: %{name} = %{version}-%{release} +Requires: samba-client + +%description disk_smb +Provides check_disk_smb of the Monitoring Plugins. + +%files disk_smb +%{plugindir}/check_disk_smb +%endif + + + +# check_dns +%package dns +Summary: Monitoring Plugins - check_dns +Requires: %{name} = %{version}-%{release} +Requires: bind-utils + +%description dns +Provides check_dns of the Monitoring Plugins. + +%files dns +%{plugindir}/check_dns + + + +# check_dummy +%package dummy +Summary: Monitoring Plugins - check_dummy +Requires: %{name} = %{version}-%{release} + +%description dummy +Provides check_dummy of the Monitoring Plugins. + +%files dummy +%{plugindir}/check_dummy + + + +# check_file_age +%package file_age +Summary: Monitoring Plugins - check_file_age +Requires: %{name} = %{version}-%{release} + +%description file_age +Provides check_file_age of the Monitoring Plugins. + +%files file_age +%{plugindir}/check_file_age + + + +# check_flexlm +%package flexlm +Summary: Monitoring Plugins - check_flexlm +Requires: %{name} = %{version}-%{release} + +%description flexlm +Provides check_flexlm of the Monitoring Plugins. + +%files flexlm +%{plugindir}/check_flexlm + + + +# check_fping +%package fping +Summary: Monitoring Plugins - check_fping +Requires: %{name} = %{version}-%{release} +Requires: fping + +%description fping +Provides check_fping of the Monitoring Plugins. + +%files fping +%{plugindir}/check_fping + + + +# check_game +%if 0%{?rhel} != 8 +%package game +Summary: Monitoring Plugins - check_fping +Requires: %{name} = %{version}-%{release} +Requires: qstat + +%description game +Provides check_game of the Monitoring Plugins. + +%files game +%{plugindir}/check_game +%endif + + + +# check_hpjd +%package hpjd +Summary: Monitoring Plugins - check_hpjd +Requires: %{name} = %{version}-%{release} + +%description hpjd +Provides check_hpjd of the Monitoring Plugins. + +%files hpjd +%{plugindir}/check_hpjd + + + +# check_http +%package http +Summary: Monitoring Plugins - check_http +Requires: %{name} = %{version}-%{release} + +%description http +Provides check_http of the Monitoring Plugins. + +%files http +%{plugindir}/check_http + + + +# check_icmp +%package icmp +Summary: Monitoring Plugins - check_icmp +Requires: %{name} = %{version}-%{release} + +%description icmp +Provides check_icmp of the Monitoring Plugins. + +%files icmp +%{plugindir}/check_icmp + + + +# check_ide_smart +%package ide_smart +Summary: Monitoring Plugins - check_ide_smart +Requires: %{name} = %{version}-%{release} + +%description ide_smart +Provides check_ide_smart of the Monitoring Plugins. + +%files ide_smart +%{plugindir}/check_ide_smart + + + +# check_ifoperstatus +%package ifoperstatus +Summary: Monitoring Plugins - check_ifoperstatus +Requires: %{name} = %{version}-%{release} +Requires: perl(Net::SNMP) + +%description ifoperstatus +Provides check_ifoperstatus of the Monitoring Plugins. + +%files ifoperstatus +%{plugindir}/check_ifoperstatus + + + +# check_ifstatus +%package ifstatus +Summary: Monitoring Plugins - check_ifstatus +Requires: %{name} = %{version}-%{release} + +%description ifstatus +Provides check_ifstatus of the Monitoring Plugins. + +%files ifstatus +%{plugindir}/check_ifstatus + + + +# check_ircd +%package ircd +Summary: Monitoring Plugins - check_ircd +Requires: %{name} = %{version}-%{release} + +%description ircd +Provides check_ircd of the Monitoring Plugins. + +%files ircd +%{plugindir}/check_ircd + + + +# check_ldap +%package ldap +Summary: Monitoring Plugins - check_ldap +Requires: %{name} = %{version}-%{release} + +%description ldap +Provides check_ldap of the Monitoring Plugins. + +%files ldap +%{plugindir}/check_ldap +%{plugindir}/check_ldaps + + + +# check_load +%package load +Summary: Monitoring Plugins - check_load +Requires: %{name} = %{version}-%{release} +Requires: procps-ng + +%description load +Provides check_load of the Monitoring Plugins. + +%files load +%{plugindir}/check_load + + + +# check_log +%package log +Summary: Monitoring Plugins - check_log +Requires: %{name} = %{version}-%{release} + +%description log +Provides check_log of the Monitoring Plugins. + +%files log +%{plugindir}/check_log + + + +# check_mailq +%package mailq +Summary: Monitoring Plugins - check_mailq +Requires: %{name} = %{version}-%{release} + +%description mailq +Provides check_mailq of the Monitoring Plugins. + +%files mailq +%{plugindir}/check_mailq + + + +# check_mrtg +%package mrtg +Summary: Monitoring Plugins - check_mrtg +Requires: %{name} = %{version}-%{release} + +%description mrtg +Provides check_mrtg of the Monitoring Plugins. + +%files mrtg +%{plugindir}/check_mrtg + + + +# check_mrtgtraf +%package mrtgtraf +Summary: Monitoring Plugins - check_mrtgtraf +Requires: %{name} = %{version}-%{release} + +%description mrtgtraf +Provides check_mrtgtraf of the Monitoring Plugins. + +%files mrtgtraf +%{plugindir}/check_mrtgtraf + + + +%if 0%{?rhel} == 7 +# check_mysql +%package mysql +Summary: Monitoring Plugins - check_mysql +Requires: %{name} = %{version}-%{release} + +%description mysql +Provides check_mysql of the Monitoring Plugins. + +%files mysql +%{plugindir}/check_mysql + + + +# check_mysql_query +%package mysql_query +Summary: Monitoring Plugins - check_mysql_query +Requires: %{name} = %{version}-%{release} + +%description mysql_query +Provides check_mysql_query of the Monitoring Plugins. + +%files mysql_query +%{plugindir}/check_mysql_query +%endif + + + +# check_nagios +%package nagios +Summary: Monitoring Plugins - check_nagios +Requires: %{name} = %{version}-%{release} + +%description nagios +Provides check_nagios of the Monitoring Plugins. + +%files nagios +%{plugindir}/check_nagios + + + +# check_nt +%package nt +Summary: Monitoring Plugins - check_nt +Requires: %{name} = %{version}-%{release} + +%description nt +Provides check_nt of the Monitoring Plugins. + +%files nt +%{plugindir}/check_nt + + + +# check_ntp +%package ntp +Summary: Monitoring Plugins - check_ntp +Requires: %{name} = %{version}-%{release} + +%description ntp +Provides check_ntp of the Monitoring Plugins. + +%files ntp +%{plugindir}/check_ntp + + + +# check_ntp_peer +%package ntp_peer +Summary: Monitoring Plugins - check_ntp_peer +Requires: %{name} = %{version}-%{release} + +%description ntp_peer +Provides check_ntp_peer of the Monitoring Plugins. + +%files ntp_peer +%{plugindir}/check_ntp_peer + + + +# check_ntp_time +%package ntp_time +Summary: Monitoring Plugins - check_ntp_time +Requires: %{name} = %{version}-%{release} + +%description ntp_time +Provides check_ntp_time of the Monitoring Plugins. + +%files ntp_time +%{plugindir}/check_ntp_time + + + +# check_nwstat +%package nwstat +Summary: Monitoring Plugins - check_nwstat +Requires: %{name} = %{version}-%{release} + +%description nwstat +Provides check_nwstat of the Monitoring Plugins. + +%files nwstat +%{plugindir}/check_nwstat + + + +# check_oracle +%package oracle +Summary: Monitoring Plugins - check_oracle +Requires: %{name} = %{version}-%{release} + +%description oracle +Provides check_oracle of the Monitoring Plugins. + +%files oracle +%{plugindir}/check_oracle + + + +# check_overcr +%package overcr +Summary: Monitoring Plugins - check_overcr +Requires: %{name} = %{version}-%{release} + +%description overcr +Provides check_overcr of the Monitoring Plugins. + +%files overcr +%{plugindir}/check_overcr + + + +# check_pgsql +%package pgsql +Summary: Monitoring Plugins - check_pgsql +Requires: %{name} = %{version}-%{release} + +%description pgsql +Provides check_pgsql of the Monitoring Plugins. + +%files pgsql +%{plugindir}/check_pgsql + + + +# check_ping +%package ping +Summary: Monitoring Plugins - check_ping +Requires: %{name} = %{version}-%{release} + +%description ping +Provides check_ping of the Monitoring Plugins. + +%files ping +%{plugindir}/check_ping + + + +# check_procs +%package procs +Summary: Monitoring Plugins - check_procs +Requires: %{name} = %{version}-%{release} + +%description procs +Provides check_procs of the Monitoring Plugins. + +%files procs +%{plugindir}/check_procs + + + +# check_radius +%package radius +Summary: Monitoring Plugins - check_radius +Requires: %{name} = %{version}-%{release} + +%description radius +Provides check_radius of the Monitoring Plugins. + +%files radius +%{plugindir}/check_radius + + + +# check_real +%package real +Summary: Monitoring Plugins - check_real +Requires: %{name} = %{version}-%{release} + +%description real +Provides check_real of the Monitoring Plugins. + +%files real +%{plugindir}/check_real + + + +# check_rpc +%package rpc +Summary: Monitoring Plugins - check_rpc +Requires: %{name} = %{version}-%{release} + +%description rpc +Provides check_rpc of the Monitoring Plugins. + +%files rpc +%{plugindir}/check_rpc + + + +# check_sensors +%package sensors +Summary: Monitoring Plugins - check_sensors +Requires: %{name} = %{version}-%{release} +Requires: lm_sensors + +%description sensors +Provides check_sensors of the Monitoring Plugins. + +%files sensors +%{plugindir}/check_sensors + + + +# check_smtp +%package smtp +Summary: Monitoring Plugins - check_smtp +Requires: %{name} = %{version}-%{release} + +%description smtp +Provides check_smtp of the Monitoring Plugins. + +%files smtp +%{plugindir}/check_smtp + + + +# check_snmp +%package snmp +Summary: Monitoring Plugins - check_snmp +Requires: %{name} = %{version}-%{release} +Requires: net-snmp + +%description snmp +Provides check_snmp of the Monitoring Plugins. + +%files snmp +%{plugindir}/check_snmp + + + +# check_ssh +%package ssh +Summary: Monitoring Plugins - check_ssh +Requires: %{name} = %{version}-%{release} + +%description ssh +Provides check_ssh of the Monitoring Plugins. + +%files ssh +%{plugindir}/check_ssh + + + +# check_swap +%package swap +Summary: Monitoring Plugins - check_swap +Requires: %{name} = %{version}-%{release} + +%description swap +Provides check_swap of the Monitoring Plugins. + +%files swap +%{plugindir}/check_swap + + + +# check_tcp +%package tcp +Summary: Monitoring Plugins - check_tcp +Requires: %{name} = %{version}-%{release} + +%description tcp +Provides check_tcp of the Monitoring Plugins. + +%files tcp +%{plugindir}/check_clamd +%{plugindir}/check_ftp +%{plugindir}/check_imap +%{plugindir}/check_jabber +%{plugindir}/check_nntp +%{plugindir}/check_nntps +%{plugindir}/check_pop +%{plugindir}/check_simap +%{plugindir}/check_spop +%{plugindir}/check_ssmtp +%{plugindir}/check_tcp +%{plugindir}/check_udp + + + +# check_time +%package time +Summary: Monitoring Plugins - check_time +Requires: %{name} = %{version}-%{release} + +%description time +Provides check_time of the Monitoring Plugins. + +%files time +%{plugindir}/check_time + + + +# check_ups +%package ups +Summary: Monitoring Plugins - check_ups +Requires: %{name} = %{version}-%{release} + +%description ups +Provides check_ups of the Monitoring Plugins. + +%files ups +%{plugindir}/check_ups + + + +# check_uptime +%package uptime +Summary: Monitoring Plugins - check_uptime +Requires: %{name} = %{version}-%{release} + +%description uptime +Provides check_uptime of the Monitoring Plugins. + +%files uptime +%{plugindir}/check_uptime + + + +# check_users +%package users +Summary: Monitoring Plugins - check_users +Requires: %{name} = %{version}-%{release} + +%description users +Provides check_users of the Monitoring Plugins. + +%files users +%{plugindir}/check_users + + + +# check_wave +%package wave +Summary: Monitoring Plugins - check_wave +Requires: %{name} = %{version}-%{release} + +%description wave +Provides check_wave of the Monitoring Plugins. + +%files wave +%{plugindir}/check_wave diff --git a/.github/os_detect.sh b/.github/os_detect.sh new file mode 100644 index 00000000..ee9c145d --- /dev/null +++ b/.github/os_detect.sh @@ -0,0 +1,18 @@ +#!/bin/sh -e +# workaround for really bare-bones Archlinux containers: +if [ -x "$(command -v pacman)" ]; then + pacman --noconfirm -Sy + pacman --noconfirm -S grep gawk sed +fi + +os_release_file= +if [ -s "/etc/os-release" ]; then + os_release_file="/etc/os-release" +elif [ -s "/usr/lib/os-release" ]; then + os_release_file="/usr/lib/os-release" +else + echo >&2 "Cannot find an os-release file ..." + return 1 +fi +export distro_id=$(grep '^ID=' $os_release_file|awk -F = '{print $2}'|sed 's/\"//g') +export platform_id=$(grep '^PLATFORM_ID=' /etc/os-release|awk -F = '{print $2}'|sed 's/\"//g'| cut -d":" -f2) diff --git a/.github/workflows/spellcheck.yml b/.github/workflows/spellcheck.yml new file mode 100644 index 00000000..72f7c7eb --- /dev/null +++ b/.github/workflows/spellcheck.yml @@ -0,0 +1,27 @@ +--- +name: Spellcheck + +on: + # Run for pushes on any branch + push: + branches: + - '*' + # Run for any PRs + pull_request: + +jobs: + codespell: + name: codespell + strategy: + fail-fast: false + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Codespell + uses: codespell-project/actions-codespell@v2 + with: + skip: "./.git,./.gitignore,./ABOUT-NLS,./gl,./tools/squid.conf,./build-aux/ltmain.sh,THANKS.in" + ignore_words_list: allright,gord,didi,hda,nd,alis,clen,scrit,ser,fot,te,parm,isnt,consol,oneliners,esponse,slac + check_filenames: true + check_hidden: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c4975f1d..33220d6d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,65 +1,27 @@ --- -name: Test +name: Tests on: push: branches: - '*' - # Run test for any PRs pull_request: jobs: - codespell: - name: codespell - strategy: - fail-fast: false + full-test: + name: Running unit and integrationt tests runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Codespell - uses: codespell-project/actions-codespell@v2 - with: - skip: "./.git,./.gitignore,./ABOUT-NLS,./gl,./tools/squid.conf,./build-aux/ltmain.sh,THANKS.in" - ignore_words_list: allright,gord,didi,hda,nd,alis,clen,scrit,ser,fot,te,parm,isnt,consol,oneliners,esponse,slac - check_filenames: true - check_hidden: true -# super-linter: -# name: super-linter -# strategy: -# fail-fast: false -# runs-on: ubuntu-latest -# steps: -# - name: Checkout -# uses: actions/checkout@v4 -# - name: Lint Code Base -# uses: github/super-linter@v5.0.0 -# env: -# DEFAULT_BRANCH: master -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# macos: -# ... - linux: - needs: - - codespell -# - super-linter - runs-on: ubuntu-latest - name: Running tests on ${{ matrix.distro }} strategy: fail-fast: false matrix: distro: - 'debian:stable' - #... include: - distro: 'debian:stable' prepare: .github/prepare_debian.sh - #... steps: - name: Git clone repository uses: actions/checkout@v4 - #- name: Setup tmate session, see https://github.com/marketplace/actions/debugging-with-tmate - # uses: mxschmitt/action-tmate@v3 - name: Run the tests on ${{ matrix.distro }} run: | docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 tmp-vol @@ -83,3 +45,35 @@ jobs: make' docker container prune -f docker volume prune -f + + build-test: + name: Running rpm build test on ${{ matrix.distro }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - {"distro": "fedora:latest", "build": ".github/mock.sh"} + - {"distro": "fedora:rawhide", "build": ".github/mock.sh"} + - {"distro": "rockylinux:8", "build": ".github/mock.sh"} + - {"distro": "almalinux:9", "build": ".github/mock.sh"} +# - {"distro": "oraclelinux:9", "build": ".github/mock.sh"} + steps: + - name: Git clone repository + uses: actions/checkout@v4 + - name: Run the tests on ${{ matrix.distro }} + run: | + docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 tmp-vol + docker run \ + --privileged=true \ + -e NPTEST_ACCEPTDEFAULT=1 \ + -e NPTEST_CACHE="/src/.github/NPTest.cache" \ + -w /src -v ${PWD}:/src \ + --tmpfs /media/ramdisk1 \ + -v /var/run/utmp:/var/run/utmp \ + --mount source=tmp-vol,destination=/src,target=/media/ramdisk2 \ + ${{ matrix.distro }} \ + /bin/sh -c '${{ matrix.build }} && \ + ls -la' + docker container prune -f + docker volume prune -f -- cgit v1.2.3-74-g34f1 From ea104fa400acfa017e9d7690dea19edef787421f Mon Sep 17 00:00:00 2001 From: Sven Nierlein Date: Tue, 23 Jul 2024 20:52:59 +0200 Subject: tests: always remove ipv6 entry from hosts file --- .github/prepare_debian.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to '.github') diff --git a/.github/prepare_debian.sh b/.github/prepare_debian.sh index dcf778bc..3f4674a2 100755 --- a/.github/prepare_debian.sh +++ b/.github/prepare_debian.sh @@ -64,13 +64,9 @@ apt-get -y install perl \ iproute2 # remove ipv6 interface from hosts -if [ $(ip addr show | grep "inet6 ::1" | wc -l) -eq "0" ]; then - sed '/^::1/d' /etc/hosts > /tmp/hosts - cp -f /tmp/hosts /etc/hosts -fi - +sed '/^::1/d' /etc/hosts > /tmp/hosts +cp -f /tmp/hosts /etc/hosts ip addr show - cat /etc/hosts # apache -- cgit v1.2.3-74-g34f1 From d7579e42495e2ad83a48d1cea258c6b708aea603 Mon Sep 17 00:00:00 2001 From: Sven Nierlein Date: Wed, 2 Oct 2024 11:42:22 +0200 Subject: add new github test workflow for debian:testing and fedora:rawhide this workflow runs scheduled once a week, so it does not prevent PRs from being merged but still allows us to notice if anything will go wrong with the next release. Remove rawhide test from the mandatory tests like we did with debian testing already. --- .github/workflows/test-next.yml | 77 +++++++++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 1 - 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test-next.yml (limited to '.github') diff --git a/.github/workflows/test-next.yml b/.github/workflows/test-next.yml new file mode 100644 index 00000000..083bc1e4 --- /dev/null +++ b/.github/workflows/test-next.yml @@ -0,0 +1,77 @@ +--- +name: Tests Debian:Testing and Fedora:Rawhide + +on: + push: + branches-ignore: + - '*' + schedule: + # Run every week on Monday at 9:00 AM (UTC) + - cron: '0 9 * * 1' + +jobs: + full-test: + name: Running unit and integrationt tests + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + distro: + - 'debian:testing' + include: + - distro: 'debian:testing' + prepare: .github/prepare_debian.sh + steps: + - name: Git clone repository + uses: actions/checkout@v4 + - name: Run the tests on ${{ matrix.distro }} + run: | + docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 tmp-vol + docker run \ + -e NPTEST_ACCEPTDEFAULT=1 \ + -e NPTEST_CACHE="/src/.github/NPTest.cache" \ + -w /src -v ${PWD}:/src \ + --tmpfs /media/ramdisk1 \ + -v /var/run/utmp:/var/run/utmp \ + --mount source=tmp-vol,destination=/src,target=/media/ramdisk2 \ + ${{ matrix.distro }} \ + /bin/sh -c '${{ matrix.prepare }} && \ + tools/setup && \ + ./configure --enable-libtap --with-ipv6=no && \ + make && \ + make test && \ + make dist && \ + tar zxf monitoring-plugins-*.tar.gz && \ + cd monitoring-plugins-*/ && \ + ./configure && \ + make' + docker container prune -f + docker volume prune -f + + build-test: + name: Running rpm build test on ${{ matrix.distro }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - {"distro": "fedora:rawhide", "build": ".github/mock.sh"} + steps: + - name: Git clone repository + uses: actions/checkout@v4 + - name: Run the tests on ${{ matrix.distro }} + run: | + docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 tmp-vol + docker run \ + --privileged=true \ + -e NPTEST_ACCEPTDEFAULT=1 \ + -e NPTEST_CACHE="/src/.github/NPTest.cache" \ + -w /src -v ${PWD}:/src \ + --tmpfs /media/ramdisk1 \ + -v /var/run/utmp:/var/run/utmp \ + --mount source=tmp-vol,destination=/src,target=/media/ramdisk2 \ + ${{ matrix.distro }} \ + /bin/sh -c '${{ matrix.build }} && \ + ls -la' + docker container prune -f + docker volume prune -f diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 33220d6d..77ca6585 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -54,7 +54,6 @@ jobs: matrix: include: - {"distro": "fedora:latest", "build": ".github/mock.sh"} - - {"distro": "fedora:rawhide", "build": ".github/mock.sh"} - {"distro": "rockylinux:8", "build": ".github/mock.sh"} - {"distro": "almalinux:9", "build": ".github/mock.sh"} # - {"distro": "oraclelinux:9", "build": ".github/mock.sh"} -- cgit v1.2.3-74-g34f1 From 2558e488f35334d75f662cb94dc2122f68c7740a Mon Sep 17 00:00:00 2001 From: Sven Nierlein Date: Wed, 2 Oct 2024 20:59:31 +0200 Subject: add manual workflow trigger --- .github/workflows/test-next.yml | 1 + 1 file changed, 1 insertion(+) (limited to '.github') diff --git a/.github/workflows/test-next.yml b/.github/workflows/test-next.yml index 083bc1e4..81240759 100644 --- a/.github/workflows/test-next.yml +++ b/.github/workflows/test-next.yml @@ -2,6 +2,7 @@ name: Tests Debian:Testing and Fedora:Rawhide on: + workflow_dispatch: {} push: branches-ignore: - '*' -- cgit v1.2.3-74-g34f1 From 903773eb9c3cc2079187dc99c7b48662148ff679 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Fri, 25 Oct 2024 12:02:14 +0200 Subject: Add sanity options to test prepare scripts --- .github/mock.sh | 2 ++ .github/prepare_debian.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to '.github') diff --git a/.github/mock.sh b/.github/mock.sh index 7fbe6903..8da147ec 100755 --- a/.github/mock.sh +++ b/.github/mock.sh @@ -2,6 +2,8 @@ set -x +set -euo pipefail + export DEBIAN_FRONTEND=noninteractive BASE_PATH="/src" diff --git a/.github/prepare_debian.sh b/.github/prepare_debian.sh index 3f4674a2..c38d241e 100755 --- a/.github/prepare_debian.sh +++ b/.github/prepare_debian.sh @@ -1,7 +1,7 @@ #!/bin/bash set -x -set -e +set -euo pipefail export DEBIAN_FRONTEND=noninteractive -- cgit v1.2.3-74-g34f1 From d996f6560065950393c186cb6c39d94ea9025ac1 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Fri, 25 Oct 2024 12:21:16 +0200 Subject: github/mock.sh: Improve readability and generel shellcheck stuff --- .github/mock.sh | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to '.github') diff --git a/.github/mock.sh b/.github/mock.sh index 8da147ec..0b913644 100755 --- a/.github/mock.sh +++ b/.github/mock.sh @@ -20,7 +20,11 @@ SPEC_FILE="${SPEC_DIR}monitoring-plugins.spec" cd ${BASE_PATH} dnf -y --setopt="tsflags=nodocs" update && \ - if [ ${distro_id} != "fedora" ]; then dnf -y --setopt="tsflags=nodocs" install epel-release; else platform_id="$(echo ${platform_id} | sed s/^f/fc/)"; fi && \ + if [ "${distro_id}" != "fedora" ]; then + dnf -y --setopt="tsflags=nodocs" install epel-release; + else + platform_id="$(echo "${platform_id}" | sed s/^f/fc/)"; + fi && \ case ${distro_id} in ol) case ${platform_id} in @@ -34,19 +38,27 @@ dnf -y --setopt="tsflags=nodocs" update && \ ;; esac dnf -y --setopt="tsflags=nodocs" install mock rpm-build git-core && \ - usermod -a -G mock $(whoami) + usermod -a -G mock "$(whoami)" + SRC_RPM="monitoring-plugins-*-1.${platform_id}.src.rpm" + if command -v git > /dev/null 2>&1; then git config --global --add safe.directory ${BASE_PATH} SHA="$(git rev-parse HEAD)" sed "s/^%global commit.*/%global commit ${SHA}/" ${SPEC_FILE} > ${SPEC_DIR}monitoring-plugins-git.spec sed -i "s/^%global fromgit.*/%global fromgit 1/" ${SPEC_DIR}monitoring-plugins-git.spec SPEC_FILE="${SPEC_DIR}monitoring-plugins-git.spec" - SRC_RPM="monitoring-plugins-*git.$(echo ${SHA:0:7})*.${platform_id}.src.rpm" + SRC_RPM="monitoring-plugins-*git.${SHA:0:7}*.${platform_id}.src.rpm" fi + mkdir -p "${SRCRPM_DIR}" "${RPM_DIR}" #rpmbuild --undefine=_disable_source_fetch --define "_sourcedir ${SOURCE_DIR}" -ba ${SPEC_FILE} -dnf -y --setopt="tsflags=nodocs" install rpmdevtools && spectool -g -C ${SOURCE_DIR} ${SPEC_FILE} && \ -mock --dnf --clean --spec ${SPEC_FILE} --sources=${SOURCE_DIR} --result=${SRCRPM_DIR} --build || { cat ${SRCRPM_DIR}/{root,build}.log; exit 1; } -mock --dnf --clean --sources=${SOURCE_DIR} --result=${RPM_DIR} --rebuild ${SRCRPM_DIR}/${SRC_RPM} || { cat ${RPM_DIR}/{root,build}.log; exit 1; } +dnf -y --setopt="tsflags=nodocs" install rpmdevtools && \ + spectool -g -C ${SOURCE_DIR} ${SPEC_FILE} && \ + { mock --dnf --clean --spec ${SPEC_FILE} --sources=${SOURCE_DIR} --result=${SRCRPM_DIR} --build || \ + { cat ${SRCRPM_DIR}/{root,build}.log; exit 1; } } + +mock --dnf --clean --sources=${SOURCE_DIR} --result=${RPM_DIR} --rebuild "${SRCRPM_DIR}/${SRC_RPM}" || \ + { cat ${RPM_DIR}/{root,build}.log; exit 1; } + ls -la ${SOURCE_DIR} ${SRCRPM_DIR} ${RPM_DIR} -- cgit v1.2.3-74-g34f1 From 78246e904ddfc9c0a88e9f47797dc38c1693abbb Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Fri, 25 Oct 2024 12:30:19 +0200 Subject: prepare_debian.sh: Fix typo --- .github/prepare_debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github') diff --git a/.github/prepare_debian.sh b/.github/prepare_debian.sh index c38d241e..3640e500 100755 --- a/.github/prepare_debian.sh +++ b/.github/prepare_debian.sh @@ -127,5 +127,5 @@ sed "/NP_HOST_TLS_CERT/s/.*/'NP_HOST_TLS_CERT' => '$(hostname)',/" -i /src/.gith # create some test files to lower inodes for i in $(seq 10); do - touch /media/ramdisk2/test.$1 + touch /media/ramdisk2/test.$i done -- cgit v1.2.3-74-g34f1 From 54162dbaf689d560656e3eb6c3313840ebc0513a Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Fri, 25 Oct 2024 12:52:32 +0200 Subject: mock.sh: remove some quotting to allow pathname expansion again --- .github/mock.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github') diff --git a/.github/mock.sh b/.github/mock.sh index 0b913644..87543ce8 100755 --- a/.github/mock.sh +++ b/.github/mock.sh @@ -58,7 +58,7 @@ dnf -y --setopt="tsflags=nodocs" install rpmdevtools && \ { mock --dnf --clean --spec ${SPEC_FILE} --sources=${SOURCE_DIR} --result=${SRCRPM_DIR} --build || \ { cat ${SRCRPM_DIR}/{root,build}.log; exit 1; } } -mock --dnf --clean --sources=${SOURCE_DIR} --result=${RPM_DIR} --rebuild "${SRCRPM_DIR}/${SRC_RPM}" || \ +mock --dnf --clean --sources=${SOURCE_DIR} --result=${RPM_DIR} --rebuild "${SRCRPM_DIR}"/${SRC_RPM} || \ { cat ${RPM_DIR}/{root,build}.log; exit 1; } ls -la ${SOURCE_DIR} ${SRCRPM_DIR} ${RPM_DIR} -- cgit v1.2.3-74-g34f1