update Jenkinsfile

This commit is contained in:
Anupong Hompan 2025-10-20 12:21:18 +07:00
parent 5be87a71e2
commit 86f3f26e2a

48
Jenkinsfile vendored
View File

@ -19,25 +19,48 @@ pipeline {
agent any agent any
steps { steps {
sh ''' sh '''
set -e set -euo pipefail
install_deps() { install_deps() {
if command -v apt-get >/dev/null 2>&1; then if command -v apt-get >/dev/null 2>&1; then
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
apt-get update -y apt-get update
# ICU + common .NET native deps + helpers # Common native deps for .NET + tools
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
libicu libkrb5-3 zlib1g libstdc++6 ca-certificates curl unzip libkrb5-3 zlib1g libstdc++6 ca-certificates curl unzip jq
# Fallback in case the meta "libicu" name doesn't exist on this distro
# 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 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 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 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 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 else
echo "Unsupported package manager. Please install ICU manually." echo "Unsupported package manager. Please install ICU + Java manually."
exit 1 exit 1
fi fi
} }
@ -61,6 +84,13 @@ pipeline {
bash dotnet-install.sh --channel 9.0 --install-dir "$HOME/.dotnet" bash dotnet-install.sh --channel 9.0 --install-dir "$HOME/.dotnet"
fi fi
export PATH="$HOME/.dotnet:$PATH" 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 dotnet --info
''' '''
} }