From 51b3c9ec7fb4ff13a263ac60d43d0bfd4d4f2322 Mon Sep 17 00:00:00 2001 From: Markus Frei Date: Sat, 25 Jan 2025 16:55:12 +0100 Subject: [PATCH] chore(ci/cd): improve build --- build/debian11/build.sh | 10 +++++++--- build/debian12/build.sh | 10 +++++++--- build/rocky8/build.sh | 10 +++++++--- build/ubuntu2004/build.sh | 10 +++++++--- build/ubuntu2204/build.sh | 10 +++++++--- build/ubuntu2404/build.sh | 10 +++++++--- 6 files changed, 42 insertions(+), 18 deletions(-) diff --git a/build/debian11/build.sh b/build/debian11/build.sh index 36b384cf7..753e1174c 100644 --- a/build/debian11/build.sh +++ b/build/debian11/build.sh @@ -4,13 +4,17 @@ set -e PACKAGE_VERSION="$1" PACKAGE_ITERATION="$2" - if [[ -z "$PACKAGE_VERSION" || -z "$PACKAGE_ITERATION" ]]; then - echo "Usage: $(basename "$0") " + echo "Usage: $(basename "$0") []" echo " PACKAGE_VERSION: Version number starting with a digit (e.g. 2023123101) or 'main' for the latest development version." echo " PACKAGE_ITERATION: Iteration number (e.g. 2) to specify the bugfix level for this package." + echo " CHECK_PLUGIN: Optional. If you only want to compile a specific check plugin, specify its name, for example 'xml'." exit 1 fi +CHECK_PLUGIN="$3" +if [[ -z "$CHECK_PLUGIN" ]]; then + CHECK_PLUGIN='*' +fi CURRENT_DIR="$(dirname "$(realpath "$BASH_SOURCE")")" BUILD_SHARED_DIR="$CURRENT_DIR/../shared" @@ -30,7 +34,7 @@ source /opt/venv/bin/activate python3 --version python3 -m pip install --requirement="$MONITORING_PLUGINS_DIR/requirements.txt" --require-hashes -compile_plugins "$MONITORING_PLUGINS_DIR" +compile_plugins "$MONITORING_PLUGINS_DIR" "$CHECK_PLUGIN" # prepare files for fpm prepare_fpm "$PACKAGE_VERSION" "$PACKAGE_ITERATION" "$MONITORING_PLUGINS_DIR" diff --git a/build/debian12/build.sh b/build/debian12/build.sh index 36b384cf7..753e1174c 100644 --- a/build/debian12/build.sh +++ b/build/debian12/build.sh @@ -4,13 +4,17 @@ set -e PACKAGE_VERSION="$1" PACKAGE_ITERATION="$2" - if [[ -z "$PACKAGE_VERSION" || -z "$PACKAGE_ITERATION" ]]; then - echo "Usage: $(basename "$0") " + echo "Usage: $(basename "$0") []" echo " PACKAGE_VERSION: Version number starting with a digit (e.g. 2023123101) or 'main' for the latest development version." echo " PACKAGE_ITERATION: Iteration number (e.g. 2) to specify the bugfix level for this package." + echo " CHECK_PLUGIN: Optional. If you only want to compile a specific check plugin, specify its name, for example 'xml'." exit 1 fi +CHECK_PLUGIN="$3" +if [[ -z "$CHECK_PLUGIN" ]]; then + CHECK_PLUGIN='*' +fi CURRENT_DIR="$(dirname "$(realpath "$BASH_SOURCE")")" BUILD_SHARED_DIR="$CURRENT_DIR/../shared" @@ -30,7 +34,7 @@ source /opt/venv/bin/activate python3 --version python3 -m pip install --requirement="$MONITORING_PLUGINS_DIR/requirements.txt" --require-hashes -compile_plugins "$MONITORING_PLUGINS_DIR" +compile_plugins "$MONITORING_PLUGINS_DIR" "$CHECK_PLUGIN" # prepare files for fpm prepare_fpm "$PACKAGE_VERSION" "$PACKAGE_ITERATION" "$MONITORING_PLUGINS_DIR" diff --git a/build/rocky8/build.sh b/build/rocky8/build.sh index 7f4367841..1226581d8 100755 --- a/build/rocky8/build.sh +++ b/build/rocky8/build.sh @@ -4,13 +4,17 @@ set -e PACKAGE_VERSION="$1" PACKAGE_ITERATION="$2" - if [[ -z "$PACKAGE_VERSION" || -z "$PACKAGE_ITERATION" ]]; then - echo "Usage: $(basename "$0") " + echo "Usage: $(basename "$0") []" echo " PACKAGE_VERSION: Version number starting with a digit (e.g. 2023123101) or 'main' for the latest development version." echo " PACKAGE_ITERATION: Iteration number (e.g. 2) to specify the bugfix level for this package." + echo " CHECK_PLUGIN: Optional. If you only want to compile a specific check plugin, specify its name, for example 'xml'." exit 1 fi +CHECK_PLUGIN="$3" +if [[ -z "$CHECK_PLUGIN" ]]; then + CHECK_PLUGIN='*' +fi CURRENT_DIR="$(dirname "$(realpath "$BASH_SOURCE")")" BUILD_SHARED_DIR="$CURRENT_DIR/../shared" @@ -30,7 +34,7 @@ source /opt/venv/bin/activate python3 --version python3 -m pip install --requirement="$MONITORING_PLUGINS_DIR/requirements.txt" --require-hashes -compile_plugins "$MONITORING_PLUGINS_DIR" +compile_plugins "$MONITORING_PLUGINS_DIR" "$CHECK_PLUGIN" # RHEL only - compile .te file to .pp for SELinux mkdir /tmp/selinux diff --git a/build/ubuntu2004/build.sh b/build/ubuntu2004/build.sh index b5185aadd..e61e4f166 100644 --- a/build/ubuntu2004/build.sh +++ b/build/ubuntu2004/build.sh @@ -4,13 +4,17 @@ set -e PACKAGE_VERSION="$1" PACKAGE_ITERATION="$2" - if [[ -z "$PACKAGE_VERSION" || -z "$PACKAGE_ITERATION" ]]; then - echo "Usage: $(basename "$0") " + echo "Usage: $(basename "$0") []" echo " PACKAGE_VERSION: Version number starting with a digit (e.g. 2023123101) or 'main' for the latest development version." echo " PACKAGE_ITERATION: Iteration number (e.g. 2) to specify the bugfix level for this package." + echo " CHECK_PLUGIN: Optional. If you only want to compile a specific check plugin, specify its name, for example 'xml'." exit 1 fi +CHECK_PLUGIN="$3" +if [[ -z "$CHECK_PLUGIN" ]]; then + CHECK_PLUGIN='*' +fi CURRENT_DIR="$(dirname "$(realpath "$BASH_SOURCE")")" BUILD_SHARED_DIR="$CURRENT_DIR/../shared" @@ -30,7 +34,7 @@ source /opt/venv/bin/activate python3.9 --version python3.9 -m pip install --requirement="$MONITORING_PLUGINS_DIR/requirements.txt" --require-hashes -compile_plugins "$MONITORING_PLUGINS_DIR" +compile_plugins "$MONITORING_PLUGINS_DIR" "$CHECK_PLUGIN" # prepare files for fpm prepare_fpm "$PACKAGE_VERSION" "$PACKAGE_ITERATION" "$MONITORING_PLUGINS_DIR" diff --git a/build/ubuntu2204/build.sh b/build/ubuntu2204/build.sh index 36b384cf7..753e1174c 100644 --- a/build/ubuntu2204/build.sh +++ b/build/ubuntu2204/build.sh @@ -4,13 +4,17 @@ set -e PACKAGE_VERSION="$1" PACKAGE_ITERATION="$2" - if [[ -z "$PACKAGE_VERSION" || -z "$PACKAGE_ITERATION" ]]; then - echo "Usage: $(basename "$0") " + echo "Usage: $(basename "$0") []" echo " PACKAGE_VERSION: Version number starting with a digit (e.g. 2023123101) or 'main' for the latest development version." echo " PACKAGE_ITERATION: Iteration number (e.g. 2) to specify the bugfix level for this package." + echo " CHECK_PLUGIN: Optional. If you only want to compile a specific check plugin, specify its name, for example 'xml'." exit 1 fi +CHECK_PLUGIN="$3" +if [[ -z "$CHECK_PLUGIN" ]]; then + CHECK_PLUGIN='*' +fi CURRENT_DIR="$(dirname "$(realpath "$BASH_SOURCE")")" BUILD_SHARED_DIR="$CURRENT_DIR/../shared" @@ -30,7 +34,7 @@ source /opt/venv/bin/activate python3 --version python3 -m pip install --requirement="$MONITORING_PLUGINS_DIR/requirements.txt" --require-hashes -compile_plugins "$MONITORING_PLUGINS_DIR" +compile_plugins "$MONITORING_PLUGINS_DIR" "$CHECK_PLUGIN" # prepare files for fpm prepare_fpm "$PACKAGE_VERSION" "$PACKAGE_ITERATION" "$MONITORING_PLUGINS_DIR" diff --git a/build/ubuntu2404/build.sh b/build/ubuntu2404/build.sh index 36b384cf7..753e1174c 100644 --- a/build/ubuntu2404/build.sh +++ b/build/ubuntu2404/build.sh @@ -4,13 +4,17 @@ set -e PACKAGE_VERSION="$1" PACKAGE_ITERATION="$2" - if [[ -z "$PACKAGE_VERSION" || -z "$PACKAGE_ITERATION" ]]; then - echo "Usage: $(basename "$0") " + echo "Usage: $(basename "$0") []" echo " PACKAGE_VERSION: Version number starting with a digit (e.g. 2023123101) or 'main' for the latest development version." echo " PACKAGE_ITERATION: Iteration number (e.g. 2) to specify the bugfix level for this package." + echo " CHECK_PLUGIN: Optional. If you only want to compile a specific check plugin, specify its name, for example 'xml'." exit 1 fi +CHECK_PLUGIN="$3" +if [[ -z "$CHECK_PLUGIN" ]]; then + CHECK_PLUGIN='*' +fi CURRENT_DIR="$(dirname "$(realpath "$BASH_SOURCE")")" BUILD_SHARED_DIR="$CURRENT_DIR/../shared" @@ -30,7 +34,7 @@ source /opt/venv/bin/activate python3 --version python3 -m pip install --requirement="$MONITORING_PLUGINS_DIR/requirements.txt" --require-hashes -compile_plugins "$MONITORING_PLUGINS_DIR" +compile_plugins "$MONITORING_PLUGINS_DIR" "$CHECK_PLUGIN" # prepare files for fpm prepare_fpm "$PACKAGE_VERSION" "$PACKAGE_ITERATION" "$MONITORING_PLUGINS_DIR"