This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
# ============================================================
|
||||
# 缓存序列化结构变更检测 — 业务仓库配置
|
||||
# 序列化结构变更检测 — 业务仓库配置
|
||||
# ============================================================
|
||||
# 说明:
|
||||
# - 本配置文件为业务覆盖配置,会与 jar 内 default-config.yaml 深度合并
|
||||
# - 未声明的项沿用工具内置默认值(忽略规则、检测模式等)
|
||||
# - 当前实现以 Redis 写入检测为主,后续可扩展其他缓存
|
||||
# - 当前以 Redis 缓存写入检测为主;MQ(RocketMQ/Kafka)方案见 docs/MQ序列化结构检测方案.md
|
||||
|
||||
# 总开关 true-执行检测 false-跳过检测(流水线直接通过,不发通知)
|
||||
enabled: true
|
||||
@@ -17,7 +17,7 @@ notify:
|
||||
enabled: true
|
||||
webhook_url: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=fa14f0b3-e01a-40f6-96bd-e18beb94e85e
|
||||
notify_on_clean: false
|
||||
title_prefix: "【缓存结构变更】"
|
||||
title_prefix: "【序列化结构变更】"
|
||||
|
||||
# 观察期:先只扫描 jnpf-tenant 模块,稳定后改为 include_modules: []
|
||||
include_modules:
|
||||
@@ -1,17 +1,17 @@
|
||||
name: 缓存序列化结构检查
|
||||
run-name: ${{ gitea.actor }}的缓存结构检查
|
||||
name: 序列化结构检查
|
||||
run-name: ${{ gitea.actor }}的序列化结构检查
|
||||
|
||||
on:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
# cache-schema-checker 私库坐标:com.codechecker:cache-schema-checker:1.0.0
|
||||
CACHE_SCHEMA_CHECKER_VERSION: "1.0.0"
|
||||
CACHE_SCHEMA_CHECKER_REPO_URL: "http://192.168.3.25:18081/nexus/repository/maven-releases"
|
||||
# serialization-schema-checker 私库坐标:com.codechecker:serialization-schema-checker:1.0.0
|
||||
SERIALIZATION_SCHEMA_CHECKER_VERSION: "1.0.0"
|
||||
SERIALIZATION_SCHEMA_CHECKER_REPO_URL: "http://192.168.3.25:18081/nexus/repository/maven-releases"
|
||||
|
||||
jobs:
|
||||
cache-schema-check:
|
||||
serialization-schema-check:
|
||||
if: ${{ gitea.ref != 'refs/heads/pre' && gitea.ref != 'refs/heads/dev' && gitea.ref != 'refs/heads/master-2.0' }}
|
||||
runs-on: jdk11
|
||||
steps:
|
||||
@@ -27,30 +27,30 @@ jobs:
|
||||
git clone --depth 1 --single-branch --branch "${BRANCH}" "${REPO_URL}" .
|
||||
git checkout -B "${BRANCH}" "${NEW_SHA}"
|
||||
|
||||
echo "${NEW_SHA}" > /tmp/cache-schema-new-sha.txt
|
||||
echo "${NEW_SHA}" > /tmp/serialization-schema-new-sha.txt
|
||||
|
||||
- name: 检查配置文件
|
||||
run: |
|
||||
if [ ! -f .gitea/config/cache-schema-check-config.yaml ]; then
|
||||
echo "错误: 缺少 .gitea/config/cache-schema-check-config.yaml"
|
||||
if [ ! -f .gitea/config/serialization-schema-check-config.yaml ]; then
|
||||
echo "错误: 缺少 .gitea/config/serialization-schema-check-config.yaml"
|
||||
exit 1
|
||||
fi
|
||||
# 顶层总开关 enabled: false 时跳过后续步骤(与 notify.enabled 区分,仅匹配行首)
|
||||
if grep -Eq '^enabled:[[:space:]]*false([[:space:]]|#|$)' .gitea/config/cache-schema-check-config.yaml; then
|
||||
echo "总开关 enabled=false,跳过缓存结构检查"
|
||||
touch /tmp/cache-schema-check.skip
|
||||
if grep -Eq '^enabled:[[:space:]]*false([[:space:]]|#|$)' .gitea/config/serialization-schema-check-config.yaml; then
|
||||
echo "总开关 enabled=false,跳过序列化结构检查"
|
||||
touch /tmp/serialization-schema-check.skip
|
||||
fi
|
||||
|
||||
- name: 从 Nexus 私库下载 cache-schema-checker
|
||||
- name: 从 Nexus 私库下载 serialization-schema-checker
|
||||
run: |
|
||||
if [ -f /tmp/cache-schema-check.skip ]; then
|
||||
if [ -f /tmp/serialization-schema-check.skip ]; then
|
||||
echo "总开关已关闭,跳过下载"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
GROUP_PATH="com/codechecker/cache-schema-checker"
|
||||
JAR_NAME="cache-schema-checker-${CACHE_SCHEMA_CHECKER_VERSION}.jar"
|
||||
JAR_URL="${CACHE_SCHEMA_CHECKER_REPO_URL}/${GROUP_PATH}/${CACHE_SCHEMA_CHECKER_VERSION}/${JAR_NAME}"
|
||||
GROUP_PATH="com/codechecker/serialization-schema-checker"
|
||||
JAR_NAME="serialization-schema-checker-${SERIALIZATION_SCHEMA_CHECKER_VERSION}.jar"
|
||||
JAR_URL="${SERIALIZATION_SCHEMA_CHECKER_REPO_URL}/${GROUP_PATH}/${SERIALIZATION_SCHEMA_CHECKER_VERSION}/${JAR_NAME}"
|
||||
JAR_PATH="/tmp/${JAR_NAME}"
|
||||
|
||||
echo "下载: ${JAR_URL}"
|
||||
@@ -72,25 +72,25 @@ jobs:
|
||||
|
||||
- name: 验证 JDK
|
||||
run: |
|
||||
if [ -f /tmp/cache-schema-check.skip ]; then
|
||||
if [ -f /tmp/serialization-schema-check.skip ]; then
|
||||
echo "总开关已关闭,跳过"
|
||||
exit 0
|
||||
fi
|
||||
echo "Java: $(java -version 2>&1 | head -1)"
|
||||
|
||||
- name: 执行缓存序列化结构检测
|
||||
- name: 执行序列化结构检测
|
||||
env:
|
||||
# push 前 tip;新分支首次 push 时为全 0。workflow_dispatch 可能为空,下方会回退。
|
||||
PUSH_BEFORE: ${{ gitea.event.before }}
|
||||
# push 事件携带的 commits 列表(JSON);用于准确统计 commit 数(不受浅克隆影响)
|
||||
PUSH_COMMITS_JSON: ${{ toJson(gitea.event.commits) }}
|
||||
run: |
|
||||
if [ -f /tmp/cache-schema-check.skip ]; then
|
||||
if [ -f /tmp/serialization-schema-check.skip ]; then
|
||||
echo "总开关已关闭,跳过检测"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
NEW_SHA=$(cat /tmp/cache-schema-new-sha.txt)
|
||||
NEW_SHA=$(cat /tmp/serialization-schema-new-sha.txt)
|
||||
OLD_SHA="${PUSH_BEFORE}"
|
||||
|
||||
# 新分支首次 push(before 全 0)→ 跳过
|
||||
@@ -199,8 +199,8 @@ jobs:
|
||||
|
||||
COMMIT_TIME=$(git log -1 --format=%cd --date=format:'%Y-%m-%d %H:%M:%S' "${NEW_SHA}")
|
||||
|
||||
java -jar "/tmp/cache-schema-checker-${CACHE_SCHEMA_CHECKER_VERSION}.jar" \
|
||||
--config .gitea/config/cache-schema-check-config.yaml \
|
||||
java -jar "/tmp/serialization-schema-checker-${SERIALIZATION_SCHEMA_CHECKER_VERSION}.jar" \
|
||||
--config .gitea/config/serialization-schema-check-config.yaml \
|
||||
--repo-root . \
|
||||
--old-sha "$OLD_SHA" \
|
||||
--new-sha "$NEW_SHA" \
|
||||
Reference in New Issue
Block a user