维护持续集成:增加Kingbase JDBC依赖预检与初始化流程

This commit is contained in:
wangzhibiao committed 2026-09-14 16:48:27 +08:00
1 parent 7c792c6718
commit 126147c966
5 files changed
+160

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
set -euo pipefail
readonly EXPECTED_SHA256="346d5602477ed472b19c5e25729fff5a58b1d83cec56162a56ac4b86d9546c32"
readonly INSTALLED_JAR="${HOME}/.m2/repository/com/kingbase/kingbase8/8.6.0/kingbase8-8.6.0.jar"
sha256_file() {
if command -v sha256sum >/dev/null 2>&1; then
sha256sum "$1" | awk '{print $1}'
elif command -v shasum >/dev/null 2>&1; then
shasum -a 256 "$1" | awk '{print $1}'
else
echo "No SHA256 utility is available; install sha256sum or shasum." >&2
return 1
fi
}
if [[ ! -f "${INSTALLED_JAR}" ]]; then
echo "Kingbase JDBC 8.6.0 is not provisioned." >&2
echo "Run scripts/bootstrap/install-kingbase-jdbc.sh" >&2
echo "with KINGBASE_JDBC_JAR pointing to the authorized vendor driver." >&2
exit 1
fi
installed_sha256="$(sha256_file "${INSTALLED_JAR}")"
if [[ "${installed_sha256}" != "${EXPECTED_SHA256}" ]]; then
echo "Kingbase JDBC 8.6.0 checksum mismatch." >&2
exit 1
fi
echo "Kingbase JDBC 8.6.0 preflight PASS."
+56
View File
@@ -0,0 +1,56 @@
#!/usr/bin/env bash
set -euo pipefail
readonly EXPECTED_SHA256="346d5602477ed472b19c5e25729fff5a58b1d83cec56162a56ac4b86d9546c32"
readonly MAVEN_REPOSITORY="${HOME}/.m2/repository"
readonly INSTALLED_JAR="${MAVEN_REPOSITORY}/com/kingbase/kingbase8/8.6.0/kingbase8-8.6.0.jar"
sha256_file() {
if command -v sha256sum >/dev/null 2>&1; then
sha256sum "$1" | awk '{print $1}'
elif command -v shasum >/dev/null 2>&1; then
shasum -a 256 "$1" | awk '{print $1}'
else
echo "No SHA256 utility is available; install sha256sum or shasum." >&2
return 1
fi
}
if [[ -z "${KINGBASE_JDBC_JAR:-}" ]]; then
echo "KINGBASE_JDBC_JAR is not set." >&2
echo "Set it to the absolute path of the authorized Kingbase JDBC 8.6.0 vendor driver." >&2
exit 1
fi
if [[ ! -f "${KINGBASE_JDBC_JAR}" ]]; then
echo "KINGBASE_JDBC_JAR does not point to an existing regular file." >&2
exit 1
fi
source_sha256="$(sha256_file "${KINGBASE_JDBC_JAR}")"
if [[ "${source_sha256}" != "${EXPECTED_SHA256}" ]]; then
echo "Kingbase JDBC 8.6.0 source checksum mismatch." >&2
exit 1
fi
mvn install:install-file \
-Dfile="${KINGBASE_JDBC_JAR}" \
-DgroupId=com.kingbase \
-DartifactId=kingbase8 \
-Dversion=8.6.0 \
-Dpackaging=jar \
-DgeneratePom=true \
-Dmaven.repo.local="${MAVEN_REPOSITORY}"
if [[ ! -f "${INSTALLED_JAR}" ]]; then
echo "Kingbase JDBC 8.6.0 installation failed: local Maven artifact is missing." >&2
exit 1
fi
installed_sha256="$(sha256_file "${INSTALLED_JAR}")"
if [[ "${installed_sha256}" != "${EXPECTED_SHA256}" ]]; then
echo "Kingbase JDBC 8.6.0 installed artifact checksum mismatch." >&2
exit 1
fi
echo "Kingbase JDBC 8.6.0 provisioning PASS."