summaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
Diffstat (limited to '.github')
-rw-r--r--.github/NPTest.cache4
-rwxr-xr-x.github/mock.sh31
-rw-r--r--.github/monitoring-plugins.spec31
-rw-r--r--.github/os_detect.sh10
-rwxr-xr-x.github/prepare_debian.sh11
-rw-r--r--.github/workflows/codeql-analysis.yml20
-rw-r--r--.github/workflows/spellcheck.yml3
-rw-r--r--.github/workflows/test-next.yml90
-rw-r--r--.github/workflows/test.yml20
9 files changed, 171 insertions, 49 deletions
diff --git a/.github/NPTest.cache b/.github/NPTest.cache
index d488d1b9..6b463e74 100644
--- a/.github/NPTest.cache
+++ b/.github/NPTest.cache
@@ -38,8 +38,8 @@
38 'NP_MYSQL_LOGIN_DETAILS' => '-u root -d test', 38 'NP_MYSQL_LOGIN_DETAILS' => '-u root -d test',
39 'NP_MYSQL_SERVER' => 'localhost', 39 'NP_MYSQL_SERVER' => 'localhost',
40 'NP_MYSQL_SOCKET' => '/var/run/mysqld/mysqld.sock', 40 'NP_MYSQL_SOCKET' => '/var/run/mysqld/mysqld.sock',
41 'NP_MYSQL_WITH_SLAVE' => '', 41 'NP_MYSQL_WITH_REPLICA' => '',
42 'NP_MYSQL_WITH_SLAVE_LOGIN' => '', 42 'NP_MYSQL_WITH_REPLICA_LOGIN' => '',
43 'NP_NO_NTP_SERVICE' => 'localhost', 43 'NP_NO_NTP_SERVICE' => 'localhost',
44 'NP_PORT_TCP_PROXY' => '3128', 44 'NP_PORT_TCP_PROXY' => '3128',
45 'NP_SMB_SHARE' => '', 45 'NP_SMB_SHARE' => '',
diff --git a/.github/mock.sh b/.github/mock.sh
index 7fbe6903..8f84756c 100755
--- a/.github/mock.sh
+++ b/.github/mock.sh
@@ -2,6 +2,8 @@
2 2
3set -x 3set -x
4 4
5set -euo pipefail
6
5export DEBIAN_FRONTEND=noninteractive 7export DEBIAN_FRONTEND=noninteractive
6 8
7BASE_PATH="/src" 9BASE_PATH="/src"
@@ -18,7 +20,11 @@ SPEC_FILE="${SPEC_DIR}monitoring-plugins.spec"
18cd ${BASE_PATH} 20cd ${BASE_PATH}
19 21
20dnf -y --setopt="tsflags=nodocs" update && \ 22dnf -y --setopt="tsflags=nodocs" update && \
21 if [ ${distro_id} != "fedora" ]; then dnf -y --setopt="tsflags=nodocs" install epel-release; else platform_id="$(echo ${platform_id} | sed s/^f/fc/)"; fi && \ 23 if [ "${distro_id}" != "fedora" ]; then
24 dnf -y --setopt="tsflags=nodocs" install epel-release;
25 else
26 platform_id="$(echo "${platform_id}" | sed s/^f/fc/)";
27 fi && \
22 case ${distro_id} in 28 case ${distro_id} in
23 ol) 29 ol)
24 case ${platform_id} in 30 case ${platform_id} in
@@ -32,19 +38,30 @@ dnf -y --setopt="tsflags=nodocs" update && \
32 ;; 38 ;;
33 esac 39 esac
34 dnf -y --setopt="tsflags=nodocs" install mock rpm-build git-core && \ 40 dnf -y --setopt="tsflags=nodocs" install mock rpm-build git-core && \
35 usermod -a -G mock $(whoami) 41 usermod -a -G mock "$(whoami)"
42
36SRC_RPM="monitoring-plugins-*-1.${platform_id}.src.rpm" 43SRC_RPM="monitoring-plugins-*-1.${platform_id}.src.rpm"
44
37if command -v git > /dev/null 2>&1; then 45if command -v git > /dev/null 2>&1; then
38 git config --global --add safe.directory ${BASE_PATH} 46 git config --global --add safe.directory ${BASE_PATH}
39 SHA="$(git rev-parse HEAD)" 47 SHA="$(git rev-parse HEAD)"
40 sed "s/^%global commit.*/%global commit ${SHA}/" ${SPEC_FILE} > ${SPEC_DIR}monitoring-plugins-git.spec 48 sed "s/^%global commit.*/%global commit ${SHA}/" ${SPEC_FILE} > ${SPEC_DIR}monitoring-plugins-git.spec
41 sed -i "s/^%global fromgit.*/%global fromgit 1/" ${SPEC_DIR}monitoring-plugins-git.spec 49 sed -i "s/^%global fromgit.*/%global fromgit 1/" ${SPEC_DIR}monitoring-plugins-git.spec
42 SPEC_FILE="${SPEC_DIR}monitoring-plugins-git.spec" 50 SPEC_FILE="${SPEC_DIR}monitoring-plugins-git.spec"
43 SRC_RPM="monitoring-plugins-*git.$(echo ${SHA:0:7})*.${platform_id}.src.rpm" 51 SRC_RPM="monitoring-plugins-*git.${SHA:0:7}*.${platform_id}.src.rpm"
44fi 52fi
53
45mkdir -p "${SRCRPM_DIR}" "${RPM_DIR}" 54mkdir -p "${SRCRPM_DIR}" "${RPM_DIR}"
46#rpmbuild --undefine=_disable_source_fetch --define "_sourcedir ${SOURCE_DIR}" -ba ${SPEC_FILE} 55
47dnf -y --setopt="tsflags=nodocs" install rpmdevtools && spectool -g -C ${SOURCE_DIR} ${SPEC_FILE} && \ 56# Run mock below
48mock --dnf --clean --spec ${SPEC_FILE} --sources=${SOURCE_DIR} --result=${SRCRPM_DIR} --build || { cat ${SRCRPM_DIR}/{root,build}.log; exit 1; } 57# No idea what happens here to be honest
49mock --dnf --clean --sources=${SOURCE_DIR} --result=${RPM_DIR} --rebuild ${SRCRPM_DIR}/${SRC_RPM} || { cat ${RPM_DIR}/{root,build}.log; exit 1; } 58# mock seems to run more containers to build the package
59dnf -y --setopt="tsflags=nodocs" install rpmdevtools && \
60 spectool -g -C ${SOURCE_DIR} ${SPEC_FILE} && \
61 mock --init && \
62 { mock --no-clean --spec ${SPEC_FILE} --sources=${SOURCE_DIR} --result=${SRCRPM_DIR} --buildsrpm || \
63 { cat ${SRCRPM_DIR}/{root,build}.log; exit 1; } } && \
64 { mock --no-clean --sources=${SOURCE_DIR} --result=${RPM_DIR} --rebuild "${SRCRPM_DIR}"/${SRC_RPM} || \
65 { cat ${RPM_DIR}/{root,build}.log; exit 1; } }
66
50ls -la ${SOURCE_DIR} ${SRCRPM_DIR} ${RPM_DIR} 67ls -la ${SOURCE_DIR} ${SRCRPM_DIR} ${RPM_DIR}
diff --git a/.github/monitoring-plugins.spec b/.github/monitoring-plugins.spec
index 5cae3e59..ce22606b 100644
--- a/.github/monitoring-plugins.spec
+++ b/.github/monitoring-plugins.spec
@@ -88,6 +88,9 @@ BuildRequires: postgresql-devel
88# check_radius 88# check_radius
89BuildRequires: radcli-devel 89BuildRequires: radcli-devel
90 90
91# check_snmp
92BuildRequires: net-snmp-devel
93
91%description 94%description
92Common files for Monitoring Plugins 95Common files for Monitoring Plugins
93 96
@@ -191,9 +194,7 @@ Requires: %{name}-nt
191Requires: %{name}-ntp 194Requires: %{name}-ntp
192Requires: %{name}-ntp_peer 195Requires: %{name}-ntp_peer
193Requires: %{name}-ntp_time 196Requires: %{name}-ntp_time
194Requires: %{name}-nwstat
195Requires: %{name}-oracle 197Requires: %{name}-oracle
196Requires: %{name}-overcr
197Requires: %{name}-pgsql 198Requires: %{name}-pgsql
198Requires: %{name}-ping 199Requires: %{name}-ping
199Requires: %{name}-procs 200Requires: %{name}-procs
@@ -703,19 +704,6 @@ Provides check_ntp_time of the Monitoring Plugins.
703 704
704 705
705 706
706# check_nwstat
707%package nwstat
708Summary: Monitoring Plugins - check_nwstat
709Requires: %{name} = %{version}-%{release}
710
711%description nwstat
712Provides check_nwstat of the Monitoring Plugins.
713
714%files nwstat
715%{plugindir}/check_nwstat
716
717
718
719# check_oracle 707# check_oracle
720%package oracle 708%package oracle
721Summary: Monitoring Plugins - check_oracle 709Summary: Monitoring Plugins - check_oracle
@@ -729,19 +717,6 @@ Provides check_oracle of the Monitoring Plugins.
729 717
730 718
731 719
732# check_overcr
733%package overcr
734Summary: Monitoring Plugins - check_overcr
735Requires: %{name} = %{version}-%{release}
736
737%description overcr
738Provides check_overcr of the Monitoring Plugins.
739
740%files overcr
741%{plugindir}/check_overcr
742
743
744
745# check_pgsql 720# check_pgsql
746%package pgsql 721%package pgsql
747Summary: Monitoring Plugins - check_pgsql 722Summary: Monitoring Plugins - check_pgsql
diff --git a/.github/os_detect.sh b/.github/os_detect.sh
index ee9c145d..3c5956de 100644
--- a/.github/os_detect.sh
+++ b/.github/os_detect.sh
@@ -1,10 +1,17 @@
1#!/bin/sh -e 1#!/bin/sh -e
2
3. /etc/os-release
4
2# workaround for really bare-bones Archlinux containers: 5# workaround for really bare-bones Archlinux containers:
3if [ -x "$(command -v pacman)" ]; then 6if [ -x "$(command -v pacman)" ]; then
4 pacman --noconfirm -Sy 7 pacman --noconfirm -Sy
5 pacman --noconfirm -S grep gawk sed 8 pacman --noconfirm -S grep gawk sed
6fi 9fi
7 10
11if [ ${ID} == "fedora" -a ${VERSION_ID} -gt 41 ]; then
12 dnf install -y gawk
13fi
14
8os_release_file= 15os_release_file=
9if [ -s "/etc/os-release" ]; then 16if [ -s "/etc/os-release" ]; then
10 os_release_file="/etc/os-release" 17 os_release_file="/etc/os-release"
@@ -15,4 +22,7 @@ else
15 return 1 22 return 1
16fi 23fi
17export distro_id=$(grep '^ID=' $os_release_file|awk -F = '{print $2}'|sed 's/\"//g') 24export distro_id=$(grep '^ID=' $os_release_file|awk -F = '{print $2}'|sed 's/\"//g')
25export version_id=$(grep '^VERSION_ID=' $os_release_file|awk -F = '{print $2}'|sed 's/\"//g')
18export platform_id=$(grep '^PLATFORM_ID=' /etc/os-release|awk -F = '{print $2}'|sed 's/\"//g'| cut -d":" -f2) 26export platform_id=$(grep '^PLATFORM_ID=' /etc/os-release|awk -F = '{print $2}'|sed 's/\"//g'| cut -d":" -f2)
27# Fedora dropped PLATFORM_ID: https://fedoraproject.org/wiki/Changes/Drop_PLATFORM_ID?#Drop_PLATFORM_ID
28if [ -z $platform_id ]; then export platform_id=$(echo ${distro_id:0:1}${version_id}); fi
diff --git a/.github/prepare_debian.sh b/.github/prepare_debian.sh
index 3f4674a2..cffe98c5 100755
--- a/.github/prepare_debian.sh
+++ b/.github/prepare_debian.sh
@@ -1,7 +1,7 @@
1#!/bin/bash 1#!/bin/bash
2 2
3set -x 3set -x
4set -e 4set -euo pipefail
5 5
6export DEBIAN_FRONTEND=noninteractive 6export DEBIAN_FRONTEND=noninteractive
7 7
@@ -24,6 +24,7 @@ apt-get -y install perl \
24 libpq-dev \ 24 libpq-dev \
25 libradcli-dev \ 25 libradcli-dev \
26 libnet-snmp-perl \ 26 libnet-snmp-perl \
27 libsnmp-dev \
27 procps \ 28 procps \
28 libdbi0-dev \ 29 libdbi0-dev \
29 libdbd-sqlite3 \ 30 libdbd-sqlite3 \
@@ -59,9 +60,11 @@ apt-get -y install perl \
59 mariadb-server \ 60 mariadb-server \
60 mariadb-client \ 61 mariadb-client \
61 libmariadb-dev \ 62 libmariadb-dev \
63 libmariadb-dev-compat \
62 cron \ 64 cron \
63 iputils-ping \ 65 iputils-ping \
64 iproute2 66 iproute2 \
67 libjson-perl
65 68
66# remove ipv6 interface from hosts 69# remove ipv6 interface from hosts
67sed '/^::1/d' /etc/hosts > /tmp/hosts 70sed '/^::1/d' /etc/hosts > /tmp/hosts
@@ -109,6 +112,8 @@ mkdir -p /var/lib/snmp/mib_indexes
109sed -e 's/^agentaddress.*/agentaddress 127.0.0.1/' -i /etc/snmp/snmpd.conf 112sed -e 's/^agentaddress.*/agentaddress 127.0.0.1/' -i /etc/snmp/snmpd.conf
110service snmpd start 113service snmpd start
111 114
115sed 's/^mibs ://' -i /etc/snmp/snmp.conf
116
112# start cron, will be used by check_nagios 117# start cron, will be used by check_nagios
113cron 118cron
114 119
@@ -127,5 +132,5 @@ sed "/NP_HOST_TLS_CERT/s/.*/'NP_HOST_TLS_CERT' => '$(hostname)',/" -i /src/.gith
127 132
128# create some test files to lower inodes 133# create some test files to lower inodes
129for i in $(seq 10); do 134for i in $(seq 10); do
130 touch /media/ramdisk2/test.$1 135 touch /media/ramdisk2/test.$i
131done 136done
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index c402e0cf..e01aa5fc 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -13,6 +13,7 @@
13name: "CodeQL" 13name: "CodeQL"
14 14
15on: 15on:
16 workflow_dispatch: {}
16 push: 17 push:
17 branches: [master] 18 branches: [master]
18 pull_request: 19 pull_request:
@@ -40,7 +41,7 @@ jobs:
40 41
41 steps: 42 steps:
42 - name: Checkout repository 43 - name: Checkout repository
43 uses: actions/checkout@v4 44 uses: actions/checkout@v5
44 45
45 # Initializes the CodeQL tools for scanning. 46 # Initializes the CodeQL tools for scanning.
46 - name: Initialize CodeQL 47 - name: Initialize CodeQL
@@ -56,9 +57,20 @@ jobs:
56 run: | 57 run: |
57 sudo apt update 58 sudo apt update
58 sudo apt-get install -y --no-install-recommends m4 gettext automake autoconf make build-essential 59 sudo apt-get install -y --no-install-recommends m4 gettext automake autoconf make build-essential
59 sudo apt-get install -y --no-install-recommends perl autotools-dev libdbi-dev libldap2-dev libpq-dev \ 60 sudo apt-get install -y --no-install-recommends perl \
60 libmysqlclient-dev libradcli-dev libkrb5-dev libdbi0-dev \ 61 autotools-dev \
61 libdbd-sqlite3 libssl-dev libcurl4-openssl-dev liburiparser-dev 62 libdbi-dev \
63 libldap2-dev \
64 libpq-dev \
65 libmysqlclient-dev \
66 libradcli-dev \
67 libkrb5-dev \
68 libdbi0-dev \
69 libdbd-sqlite3 \
70 libssl-dev \
71 libcurl4-openssl-dev \
72 liburiparser-dev \
73 libsnmp-dev
62 74
63 - name: Configure build 75 - name: Configure build
64 run: | 76 run: |
diff --git a/.github/workflows/spellcheck.yml b/.github/workflows/spellcheck.yml
index 72f7c7eb..14b82781 100644
--- a/.github/workflows/spellcheck.yml
+++ b/.github/workflows/spellcheck.yml
@@ -2,6 +2,7 @@
2name: Spellcheck 2name: Spellcheck
3 3
4on: 4on:
5 workflow_dispatch: {}
5 # Run for pushes on any branch 6 # Run for pushes on any branch
6 push: 7 push:
7 branches: 8 branches:
@@ -17,7 +18,7 @@ jobs:
17 runs-on: ubuntu-latest 18 runs-on: ubuntu-latest
18 steps: 19 steps:
19 - name: Checkout 20 - name: Checkout
20 uses: actions/checkout@v4 21 uses: actions/checkout@v5
21 - name: Codespell 22 - name: Codespell
22 uses: codespell-project/actions-codespell@v2 23 uses: codespell-project/actions-codespell@v2
23 with: 24 with:
diff --git a/.github/workflows/test-next.yml b/.github/workflows/test-next.yml
new file mode 100644
index 00000000..0e69c251
--- /dev/null
+++ b/.github/workflows/test-next.yml
@@ -0,0 +1,90 @@
1---
2name: Tests Debian:Testing and Fedora:Rawhide
3
4on:
5 workflow_dispatch:
6 inputs:
7 debug_enabled:
8 type: boolean
9 description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
10 required: false
11 default: false
12 push:
13 branches-ignore:
14 - '*'
15 schedule:
16 # Run every week on Monday at 9:00 AM (UTC)
17 - cron: '0 9 * * 1'
18
19jobs:
20 full-test:
21 name: Running unit and integrationt tests
22 runs-on: ubuntu-latest
23 strategy:
24 fail-fast: false
25 matrix:
26 distro:
27 - 'debian:testing'
28 include:
29 - distro: 'debian:testing'
30 prepare: .github/prepare_debian.sh
31 steps:
32 - name: Git clone repository
33 uses: actions/checkout@v5
34 - name: Setup tmate session, see https://github.com/marketplace/actions/debugging-with-tmate
35 uses: mxschmitt/action-tmate@v3
36 if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
37 - name: Run the tests on ${{ matrix.distro }}
38 run: |
39 docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 tmp-vol
40 docker run \
41 -e NPTEST_ACCEPTDEFAULT=1 \
42 -e NPTEST_CACHE="/src/.github/NPTest.cache" \
43 -w /src -v ${PWD}:/src \
44 --tmpfs /media/ramdisk1 \
45 -v /var/run/utmp:/var/run/utmp \
46 --mount source=tmp-vol,destination=/src,target=/media/ramdisk2 \
47 ${{ matrix.distro }} \
48 /bin/sh -c '${{ matrix.prepare }} && \
49 tools/setup && \
50 ./configure --enable-libtap && \
51 make && \
52 make test && \
53 make dist && \
54 tar zxf monitoring-plugins-*.tar.gz && \
55 cd monitoring-plugins-*/ && \
56 ./configure && \
57 make'
58 docker container prune -f
59 docker volume prune -f
60
61 build-test:
62 name: Running rpm build test on ${{ matrix.distro }}
63 runs-on: ubuntu-latest
64 strategy:
65 fail-fast: false
66 matrix:
67 include:
68 - {"distro": "fedora:rawhide", "build": ".github/mock.sh"}
69 steps:
70 - name: Git clone repository
71 uses: actions/checkout@v5
72 - name: Setup tmate session, see https://github.com/marketplace/actions/debugging-with-tmate
73 uses: mxschmitt/action-tmate@v3
74 if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
75 - name: Run the tests on ${{ matrix.distro }}
76 run: |
77 docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 tmp-vol
78 docker run \
79 --privileged=true \
80 -e NPTEST_ACCEPTDEFAULT=1 \
81 -e NPTEST_CACHE="/src/.github/NPTest.cache" \
82 -w /src -v ${PWD}:/src \
83 --tmpfs /media/ramdisk1 \
84 -v /var/run/utmp:/var/run/utmp \
85 --mount source=tmp-vol,destination=/src,target=/media/ramdisk2 \
86 ${{ matrix.distro }} \
87 /bin/sh -c '${{ matrix.build }} && \
88 ls -la'
89 docker container prune -f
90 docker volume prune -f
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 33220d6d..1ac8aaf3 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -2,6 +2,13 @@
2name: Tests 2name: Tests
3 3
4on: 4on:
5 workflow_dispatch:
6 inputs:
7 debug_enabled:
8 type: boolean
9 description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
10 required: false
11 default: false
5 push: 12 push:
6 branches: 13 branches:
7 - '*' 14 - '*'
@@ -21,7 +28,10 @@ jobs:
21 prepare: .github/prepare_debian.sh 28 prepare: .github/prepare_debian.sh
22 steps: 29 steps:
23 - name: Git clone repository 30 - name: Git clone repository
24 uses: actions/checkout@v4 31 uses: actions/checkout@v5
32 - name: Setup tmate session, see https://github.com/marketplace/actions/debugging-with-tmate
33 uses: mxschmitt/action-tmate@v3
34 if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
25 - name: Run the tests on ${{ matrix.distro }} 35 - name: Run the tests on ${{ matrix.distro }}
26 run: | 36 run: |
27 docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 tmp-vol 37 docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 tmp-vol
@@ -35,7 +45,7 @@ jobs:
35 ${{ matrix.distro }} \ 45 ${{ matrix.distro }} \
36 /bin/sh -c '${{ matrix.prepare }} && \ 46 /bin/sh -c '${{ matrix.prepare }} && \
37 tools/setup && \ 47 tools/setup && \
38 ./configure --enable-libtap --with-ipv6=no && \ 48 ./configure --enable-libtap && \
39 make && \ 49 make && \
40 make test && \ 50 make test && \
41 make dist && \ 51 make dist && \
@@ -54,13 +64,15 @@ jobs:
54 matrix: 64 matrix:
55 include: 65 include:
56 - {"distro": "fedora:latest", "build": ".github/mock.sh"} 66 - {"distro": "fedora:latest", "build": ".github/mock.sh"}
57 - {"distro": "fedora:rawhide", "build": ".github/mock.sh"}
58 - {"distro": "rockylinux:8", "build": ".github/mock.sh"} 67 - {"distro": "rockylinux:8", "build": ".github/mock.sh"}
59 - {"distro": "almalinux:9", "build": ".github/mock.sh"} 68 - {"distro": "almalinux:9", "build": ".github/mock.sh"}
60# - {"distro": "oraclelinux:9", "build": ".github/mock.sh"} 69# - {"distro": "oraclelinux:9", "build": ".github/mock.sh"}
61 steps: 70 steps:
62 - name: Git clone repository 71 - name: Git clone repository
63 uses: actions/checkout@v4 72 uses: actions/checkout@v5
73 - name: Setup tmate session, see https://github.com/marketplace/actions/debugging-with-tmate
74 uses: mxschmitt/action-tmate@v3
75 if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
64 - name: Run the tests on ${{ matrix.distro }} 76 - name: Run the tests on ${{ matrix.distro }}
65 run: | 77 run: |
66 docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 tmp-vol 78 docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 tmp-vol