diff options
Diffstat (limited to '.github')
-rw-r--r-- | .github/NPTest.cache | 4 | ||||
-rwxr-xr-x | .github/mock.sh | 31 | ||||
-rw-r--r-- | .github/monitoring-plugins.spec | 28 | ||||
-rw-r--r-- | .github/os_detect.sh | 7 | ||||
-rwxr-xr-x | .github/prepare_debian.sh | 8 | ||||
-rw-r--r-- | .github/workflows/test-next.yml | 78 | ||||
-rw-r--r-- | .github/workflows/test.yml | 3 |
7 files changed, 117 insertions, 42 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 | ||
3 | set -x | 3 | set -x |
4 | 4 | ||
5 | set -euo pipefail | ||
6 | |||
5 | export DEBIAN_FRONTEND=noninteractive | 7 | export DEBIAN_FRONTEND=noninteractive |
6 | 8 | ||
7 | BASE_PATH="/src" | 9 | BASE_PATH="/src" |
@@ -18,7 +20,11 @@ SPEC_FILE="${SPEC_DIR}monitoring-plugins.spec" | |||
18 | cd ${BASE_PATH} | 20 | cd ${BASE_PATH} |
19 | 21 | ||
20 | dnf -y --setopt="tsflags=nodocs" update && \ | 22 | dnf -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 | |||
36 | SRC_RPM="monitoring-plugins-*-1.${platform_id}.src.rpm" | 43 | SRC_RPM="monitoring-plugins-*-1.${platform_id}.src.rpm" |
44 | |||
37 | if command -v git > /dev/null 2>&1; then | 45 | if 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" |
44 | fi | 52 | fi |
53 | |||
45 | mkdir -p "${SRCRPM_DIR}" "${RPM_DIR}" | 54 | mkdir -p "${SRCRPM_DIR}" "${RPM_DIR}" |
46 | #rpmbuild --undefine=_disable_source_fetch --define "_sourcedir ${SOURCE_DIR}" -ba ${SPEC_FILE} | 55 | |
47 | dnf -y --setopt="tsflags=nodocs" install rpmdevtools && spectool -g -C ${SOURCE_DIR} ${SPEC_FILE} && \ | 56 | # Run mock below |
48 | mock --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 |
49 | mock --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 |
59 | dnf -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 | |||
50 | ls -la ${SOURCE_DIR} ${SRCRPM_DIR} ${RPM_DIR} | 67 | ls -la ${SOURCE_DIR} ${SRCRPM_DIR} ${RPM_DIR} |
diff --git a/.github/monitoring-plugins.spec b/.github/monitoring-plugins.spec index 5cae3e59..10799128 100644 --- a/.github/monitoring-plugins.spec +++ b/.github/monitoring-plugins.spec | |||
@@ -191,9 +191,7 @@ Requires: %{name}-nt | |||
191 | Requires: %{name}-ntp | 191 | Requires: %{name}-ntp |
192 | Requires: %{name}-ntp_peer | 192 | Requires: %{name}-ntp_peer |
193 | Requires: %{name}-ntp_time | 193 | Requires: %{name}-ntp_time |
194 | Requires: %{name}-nwstat | ||
195 | Requires: %{name}-oracle | 194 | Requires: %{name}-oracle |
196 | Requires: %{name}-overcr | ||
197 | Requires: %{name}-pgsql | 195 | Requires: %{name}-pgsql |
198 | Requires: %{name}-ping | 196 | Requires: %{name}-ping |
199 | Requires: %{name}-procs | 197 | Requires: %{name}-procs |
@@ -703,19 +701,6 @@ Provides check_ntp_time of the Monitoring Plugins. | |||
703 | 701 | ||
704 | 702 | ||
705 | 703 | ||
706 | # check_nwstat | ||
707 | %package nwstat | ||
708 | Summary: Monitoring Plugins - check_nwstat | ||
709 | Requires: %{name} = %{version}-%{release} | ||
710 | |||
711 | %description nwstat | ||
712 | Provides check_nwstat of the Monitoring Plugins. | ||
713 | |||
714 | %files nwstat | ||
715 | %{plugindir}/check_nwstat | ||
716 | |||
717 | |||
718 | |||
719 | # check_oracle | 704 | # check_oracle |
720 | %package oracle | 705 | %package oracle |
721 | Summary: Monitoring Plugins - check_oracle | 706 | Summary: Monitoring Plugins - check_oracle |
@@ -729,19 +714,6 @@ Provides check_oracle of the Monitoring Plugins. | |||
729 | 714 | ||
730 | 715 | ||
731 | 716 | ||
732 | # check_overcr | ||
733 | %package overcr | ||
734 | Summary: Monitoring Plugins - check_overcr | ||
735 | Requires: %{name} = %{version}-%{release} | ||
736 | |||
737 | %description overcr | ||
738 | Provides check_overcr of the Monitoring Plugins. | ||
739 | |||
740 | %files overcr | ||
741 | %{plugindir}/check_overcr | ||
742 | |||
743 | |||
744 | |||
745 | # check_pgsql | 717 | # check_pgsql |
746 | %package pgsql | 718 | %package pgsql |
747 | Summary: Monitoring Plugins - check_pgsql | 719 | Summary: Monitoring Plugins - check_pgsql |
diff --git a/.github/os_detect.sh b/.github/os_detect.sh index ee9c145d..47c762d3 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: |
3 | if [ -x "$(command -v pacman)" ]; then | 6 | if [ -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 |
6 | fi | 9 | fi |
7 | 10 | ||
11 | if [ ${ID} == "fedora" -a ${VERSION_ID} -gt 41 ]; then | ||
12 | dnf install -y gawk | ||
13 | fi | ||
14 | |||
8 | os_release_file= | 15 | os_release_file= |
9 | if [ -s "/etc/os-release" ]; then | 16 | if [ -s "/etc/os-release" ]; then |
10 | os_release_file="/etc/os-release" | 17 | os_release_file="/etc/os-release" |
diff --git a/.github/prepare_debian.sh b/.github/prepare_debian.sh index 3f4674a2..f7b6cf9f 100755 --- a/.github/prepare_debian.sh +++ b/.github/prepare_debian.sh | |||
@@ -1,7 +1,7 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | set -x | 3 | set -x |
4 | set -e | 4 | set -euo pipefail |
5 | 5 | ||
6 | export DEBIAN_FRONTEND=noninteractive | 6 | export DEBIAN_FRONTEND=noninteractive |
7 | 7 | ||
@@ -59,9 +59,11 @@ apt-get -y install perl \ | |||
59 | mariadb-server \ | 59 | mariadb-server \ |
60 | mariadb-client \ | 60 | mariadb-client \ |
61 | libmariadb-dev \ | 61 | libmariadb-dev \ |
62 | libmariadb-dev-compat \ | ||
62 | cron \ | 63 | cron \ |
63 | iputils-ping \ | 64 | iputils-ping \ |
64 | iproute2 | 65 | iproute2 \ |
66 | libjson-perl | ||
65 | 67 | ||
66 | # remove ipv6 interface from hosts | 68 | # remove ipv6 interface from hosts |
67 | sed '/^::1/d' /etc/hosts > /tmp/hosts | 69 | sed '/^::1/d' /etc/hosts > /tmp/hosts |
@@ -127,5 +129,5 @@ sed "/NP_HOST_TLS_CERT/s/.*/'NP_HOST_TLS_CERT' => '$(hostname)',/" -i /src/.gith | |||
127 | 129 | ||
128 | # create some test files to lower inodes | 130 | # create some test files to lower inodes |
129 | for i in $(seq 10); do | 131 | for i in $(seq 10); do |
130 | touch /media/ramdisk2/test.$1 | 132 | touch /media/ramdisk2/test.$i |
131 | done | 133 | done |
diff --git a/.github/workflows/test-next.yml b/.github/workflows/test-next.yml new file mode 100644 index 00000000..fd59e85d --- /dev/null +++ b/.github/workflows/test-next.yml | |||
@@ -0,0 +1,78 @@ | |||
1 | --- | ||
2 | name: Tests Debian:Testing and Fedora:Rawhide | ||
3 | |||
4 | on: | ||
5 | workflow_dispatch: {} | ||
6 | push: | ||
7 | branches-ignore: | ||
8 | - '*' | ||
9 | schedule: | ||
10 | # Run every week on Monday at 9:00 AM (UTC) | ||
11 | - cron: '0 9 * * 1' | ||
12 | |||
13 | jobs: | ||
14 | full-test: | ||
15 | name: Running unit and integrationt tests | ||
16 | runs-on: ubuntu-latest | ||
17 | strategy: | ||
18 | fail-fast: false | ||
19 | matrix: | ||
20 | distro: | ||
21 | - 'debian:testing' | ||
22 | include: | ||
23 | - distro: 'debian:testing' | ||
24 | prepare: .github/prepare_debian.sh | ||
25 | steps: | ||
26 | - name: Git clone repository | ||
27 | uses: actions/checkout@v4 | ||
28 | - name: Run the tests on ${{ matrix.distro }} | ||
29 | run: | | ||
30 | docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 tmp-vol | ||
31 | docker run \ | ||
32 | -e NPTEST_ACCEPTDEFAULT=1 \ | ||
33 | -e NPTEST_CACHE="/src/.github/NPTest.cache" \ | ||
34 | -w /src -v ${PWD}:/src \ | ||
35 | --tmpfs /media/ramdisk1 \ | ||
36 | -v /var/run/utmp:/var/run/utmp \ | ||
37 | --mount source=tmp-vol,destination=/src,target=/media/ramdisk2 \ | ||
38 | ${{ matrix.distro }} \ | ||
39 | /bin/sh -c '${{ matrix.prepare }} && \ | ||
40 | tools/setup && \ | ||
41 | ./configure --enable-libtap && \ | ||
42 | make && \ | ||
43 | make test && \ | ||
44 | make dist && \ | ||
45 | tar zxf monitoring-plugins-*.tar.gz && \ | ||
46 | cd monitoring-plugins-*/ && \ | ||
47 | ./configure && \ | ||
48 | make' | ||
49 | docker container prune -f | ||
50 | docker volume prune -f | ||
51 | |||
52 | build-test: | ||
53 | name: Running rpm build test on ${{ matrix.distro }} | ||
54 | runs-on: ubuntu-latest | ||
55 | strategy: | ||
56 | fail-fast: false | ||
57 | matrix: | ||
58 | include: | ||
59 | - {"distro": "fedora:rawhide", "build": ".github/mock.sh"} | ||
60 | steps: | ||
61 | - name: Git clone repository | ||
62 | uses: actions/checkout@v4 | ||
63 | - name: Run the tests on ${{ matrix.distro }} | ||
64 | run: | | ||
65 | docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 tmp-vol | ||
66 | docker run \ | ||
67 | --privileged=true \ | ||
68 | -e NPTEST_ACCEPTDEFAULT=1 \ | ||
69 | -e NPTEST_CACHE="/src/.github/NPTest.cache" \ | ||
70 | -w /src -v ${PWD}:/src \ | ||
71 | --tmpfs /media/ramdisk1 \ | ||
72 | -v /var/run/utmp:/var/run/utmp \ | ||
73 | --mount source=tmp-vol,destination=/src,target=/media/ramdisk2 \ | ||
74 | ${{ matrix.distro }} \ | ||
75 | /bin/sh -c '${{ matrix.build }} && \ | ||
76 | ls -la' | ||
77 | docker container prune -f | ||
78 | docker volume prune -f | ||
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 33220d6d..ce0ec547 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml | |||
@@ -35,7 +35,7 @@ jobs: | |||
35 | ${{ matrix.distro }} \ | 35 | ${{ matrix.distro }} \ |
36 | /bin/sh -c '${{ matrix.prepare }} && \ | 36 | /bin/sh -c '${{ matrix.prepare }} && \ |
37 | tools/setup && \ | 37 | tools/setup && \ |
38 | ./configure --enable-libtap --with-ipv6=no && \ | 38 | ./configure --enable-libtap && \ |
39 | make && \ | 39 | make && \ |
40 | make test && \ | 40 | make test && \ |
41 | make dist && \ | 41 | make dist && \ |
@@ -54,7 +54,6 @@ jobs: | |||
54 | matrix: | 54 | matrix: |
55 | include: | 55 | include: |
56 | - {"distro": "fedora:latest", "build": ".github/mock.sh"} | 56 | - {"distro": "fedora:latest", "build": ".github/mock.sh"} |
57 | - {"distro": "fedora:rawhide", "build": ".github/mock.sh"} | ||
58 | - {"distro": "rockylinux:8", "build": ".github/mock.sh"} | 57 | - {"distro": "rockylinux:8", "build": ".github/mock.sh"} |
59 | - {"distro": "almalinux:9", "build": ".github/mock.sh"} | 58 | - {"distro": "almalinux:9", "build": ".github/mock.sh"} |
60 | # - {"distro": "oraclelinux:9", "build": ".github/mock.sh"} | 59 | # - {"distro": "oraclelinux:9", "build": ".github/mock.sh"} |