summaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2024-10-26 06:56:22 +0200
committerGitHub <noreply@github.com>2024-10-26 06:56:22 +0200
commit87eb2e1e0c8f39d9525c4823f9528bc6ad018dc6 (patch)
tree757afcbbf771aa3cf4f17fc13415098cf78efa75 /.github
parentc7de721c4fb575e4f73e7f6f928dcad81cf269a0 (diff)
parent54162dbaf689d560656e3eb6c3313840ebc0513a (diff)
downloadmonitoring-plugins-87eb2e1.tar.gz
Merge pull request #2031 from RincewindsHat/fix/test_improvements
Improve readability and reliability of test prepare scripts
Diffstat (limited to '.github')
-rwxr-xr-x.github/mock.sh26
-rwxr-xr-x.github/prepare_debian.sh4
2 files changed, 22 insertions, 8 deletions
diff --git a/.github/mock.sh b/.github/mock.sh
index 7fbe6903..87543ce8 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,27 @@ 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#rpmbuild --undefine=_disable_source_fetch --define "_sourcedir ${SOURCE_DIR}" -ba ${SPEC_FILE}
47dnf -y --setopt="tsflags=nodocs" install rpmdevtools && spectool -g -C ${SOURCE_DIR} ${SPEC_FILE} && \ 56dnf -y --setopt="tsflags=nodocs" install rpmdevtools && \
48mock --dnf --clean --spec ${SPEC_FILE} --sources=${SOURCE_DIR} --result=${SRCRPM_DIR} --build || { cat ${SRCRPM_DIR}/{root,build}.log; exit 1; } 57 spectool -g -C ${SOURCE_DIR} ${SPEC_FILE} && \
49mock --dnf --clean --sources=${SOURCE_DIR} --result=${RPM_DIR} --rebuild ${SRCRPM_DIR}/${SRC_RPM} || { cat ${RPM_DIR}/{root,build}.log; exit 1; } 58 { mock --dnf --clean --spec ${SPEC_FILE} --sources=${SOURCE_DIR} --result=${SRCRPM_DIR} --build || \
59 { cat ${SRCRPM_DIR}/{root,build}.log; exit 1; } }
60
61mock --dnf --clean --sources=${SOURCE_DIR} --result=${RPM_DIR} --rebuild "${SRCRPM_DIR}"/${SRC_RPM} || \
62 { cat ${RPM_DIR}/{root,build}.log; exit 1; }
63
50ls -la ${SOURCE_DIR} ${SRCRPM_DIR} ${RPM_DIR} 64ls -la ${SOURCE_DIR} ${SRCRPM_DIR} ${RPM_DIR}
diff --git a/.github/prepare_debian.sh b/.github/prepare_debian.sh
index 3f4674a2..3640e500 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
@@ -127,5 +127,5 @@ sed "/NP_HOST_TLS_CERT/s/.*/'NP_HOST_TLS_CERT' => '$(hostname)',/" -i /src/.gith
127 127
128# create some test files to lower inodes 128# create some test files to lower inodes
129for i in $(seq 10); do 129for i in $(seq 10); do
130 touch /media/ramdisk2/test.$1 130 touch /media/ramdisk2/test.$i
131done 131done