From 86f3f26e2abca739fdae50f18412968990043dd9 Mon Sep 17 00:00:00 2001 From: Anupong Hompan Date: Mon, 20 Oct 2025 12:21:18 +0700 Subject: [PATCH] update Jenkinsfile --- Jenkinsfile | 48 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7cf468f..3d708f0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -19,25 +19,48 @@ pipeline { agent any steps { sh ''' - set -e + set -euo pipefail install_deps() { if command -v apt-get >/dev/null 2>&1; then export DEBIAN_FRONTEND=noninteractive - apt-get update -y - # ICU + common .NET native deps + helpers + apt-get update + # Common native deps for .NET + tools apt-get install -y --no-install-recommends \ - libicu libkrb5-3 zlib1g libstdc++6 ca-certificates curl unzip - # Fallback in case the meta "libicu" name doesn't exist on this distro + libkrb5-3 zlib1g libstdc++6 ca-certificates curl unzip jq + + # Java (for OWASP Dependency-Check) + # prefer 17 headless; fall back to default-jre-headless + (apt-get install -y --no-install-recommends openjdk-17-jre-headless) || \ + (apt-get install -y --no-install-recommends default-jre-headless) || true + + # ---- ICU on Debian/Ubuntu ---- + # 1) try meta/dev names (older releases) + apt-get install -y --no-install-recommends libicu || true apt-get install -y --no-install-recommends libicu-dev || true + + # 2) if still missing, detect versioned package (e.g., libicu74 on trixie) + if ! ldconfig -p 2>/dev/null | grep -qi 'libicu'; then + PKG="$(apt-cache search -n '^libicu[0-9]+$' | awk '{print $1}' | sort -V | tail -n1 || true)" + if [ -n "${PKG:-}" ]; then + echo "Installing detected ICU package: $PKG" + apt-get install -y --no-install-recommends "$PKG" + fi + fi + + # 3) final sanity + if ! ldconfig -p 2>/dev/null | grep -qi 'libicu'; then + echo "WARN: ICU not found after install attempts (will rely on invariant mode if needed)" + fi + elif command -v dnf >/dev/null 2>&1; then - dnf install -y libicu krb5-libs zlib libstdc++ ca-certificates curl unzip + dnf install -y libicu krb5-libs zlib libstdc++ ca-certificates curl unzip java-17-openjdk-headless jq || true elif command -v yum >/dev/null 2>&1; then - yum install -y libicu krb5-libs zlib libstdc++ ca-certificates curl unzip + yum install -y libicu krb5-libs zlib libstdc++ ca-certificates curl unzip java-17-openjdk-headless jq || true elif command -v apk >/dev/null 2>&1; then - apk add --no-cache icu-libs krb5-libs zlib libstdc++ ca-certificates curl unzip + apk add --no-cache icu-libs krb5-libs zlib libstdc++ ca-certificates curl unzip openjdk17-jre-headless jq || true else - echo "Unsupported package manager. Please install ICU manually." + echo "Unsupported package manager. Please install ICU + Java manually." exit 1 fi } @@ -61,6 +84,13 @@ pipeline { bash dotnet-install.sh --channel 9.0 --install-dir "$HOME/.dotnet" fi export PATH="$HOME/.dotnet:$PATH" + + # If ICU still missing (e.g., no libicu*.so found), enable invariant mode as a fallback + if ! ldconfig -p 2>/dev/null | grep -qi 'libicu'; then + export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 + echo "NOTE: Running .NET in globalization invariant mode (ICU not found)" + fi + dotnet --info ''' }