feat: 坐标重命名
All checks were successful
序列化结构检查 / serialization-schema-check (push) Has been skipped

This commit is contained in:
2026-07-15 11:33:24 +08:00
parent 8ef5abc262
commit fd5aab5e7f
14 changed files with 102 additions and 103 deletions

View File

@@ -17,11 +17,11 @@ import java.util.concurrent.Callable;
/**
* 命令行入口退出码0 通过 / 1 阻断 / 2 执行错误
*/
@Command(name = "cache-schema-checker",
@Command(name = "serialization-schema-checker",
mixinStandardHelpOptions = true,
version = "cache-schema-checker 1.0.0",
description = "检测两次提交间缓存 value 序列化结构变更并通过企微机器人通知。")
public class CacheSchemaCheckerMain implements Callable<Integer> {
version = "serialization-schema-checker 1.0.0",
description = "检测两次提交间缓存/MQ 等 value 序列化结构变更并通过企微机器人通知。")
public class SerializationSchemaCheckerMain implements Callable<Integer> {
@Option(names = "--config", required = true, description = "业务仓库检测配置文件路径")
private Path configPath;
@@ -56,12 +56,12 @@ public class CacheSchemaCheckerMain implements Callable<Integer> {
CheckerConfig config = ConfigLoader.load(configPath);
if (!config.isEnabled()) {
System.out.println("[cache-schema-checker] 总开关 enabled=false跳过检测。");
System.out.println("[serialization-schema-checker] 总开关 enabled=false跳过检测。");
return 0;
}
if (oldSha == null || oldSha.trim().isEmpty()) {
System.out.println("[cache-schema-checker] 无对比基准提交,跳过检测。");
System.out.println("[serialization-schema-checker] 无对比基准提交,跳过检测。");
return 0;
}
@@ -75,7 +75,6 @@ public class CacheSchemaCheckerMain implements Callable<Integer> {
report.setRepository(repository != null ? repository : root.getFileName().toString());
ReportBuilder builder = new ReportBuilder(config.getNotify().getTitlePrefix());
// CI字段明细 + 完整企微 Markdown
System.out.println(builder.toConsole(report));
boolean shouldNotify = config.getNotify().isEnabled()
@@ -84,24 +83,24 @@ public class CacheSchemaCheckerMain implements Callable<Integer> {
String webhook = config.getNotify().getWebhookUrl();
List<String> messages = builder.toWeComMessages(report);
int ok = new WeComNotifier().sendMarkdownMessages(webhook, messages);
System.out.println("[cache-schema-checker] 企微通知发送: "
System.out.println("[serialization-schema-checker] 企微通知发送: "
+ ok + "/" + messages.size()
+ (messages.size() > 1 ? "(已按 key 拆分)" : ""));
}
if (report.isBlocked()) {
System.out.println("[cache-schema-checker] block 模式命中流水线将被阻断exit 1");
System.out.println("[serialization-schema-checker] block 模式命中流水线将被阻断exit 1");
}
return report.getExitCode();
} catch (Exception e) {
System.err.println("[cache-schema-checker] 执行错误: " + e.getMessage());
System.err.println("[serialization-schema-checker] 执行错误: " + e.getMessage());
e.printStackTrace();
return 2;
}
}
public static void main(String[] args) {
int exitCode = new CommandLine(new CacheSchemaCheckerMain()).execute(args);
int exitCode = new CommandLine(new SerializationSchemaCheckerMain()).execute(args);
System.exit(exitCode);
}
}

View File

@@ -41,7 +41,7 @@ public class CheckerConfig {
/** 企微机器人 Webhook 完整 URL */
private String webhookUrl = "";
private boolean notifyOnClean = false;
private String titlePrefix = "[缓存结构变更]";
private String titlePrefix = "[序列化结构变更]";
public boolean isEnabled() {
return enabled;

View File

@@ -87,7 +87,7 @@ public final class ConfigLoader {
n.setEnabled(bool(notify, "enabled", true));
n.setWebhookUrl(resolveWebhookUrl(notify));
n.setNotifyOnClean(bool(notify, "notify_on_clean", false));
n.setTitlePrefix(str(notify, "title_prefix", "[缓存结构变更]"));
n.setTitlePrefix(str(notify, "title_prefix", "[序列化结构变更]"));
Map<String, Object> ignore = asMap(map.get("ignore"));
CheckerConfig.Ignore ig = config.getIgnore();

View File

@@ -28,7 +28,7 @@ public class ReportBuilder {
private final String titlePrefix;
public ReportBuilder(String titlePrefix) {
this.titlePrefix = titlePrefix == null ? "[缓存结构变更]" : titlePrefix;
this.titlePrefix = titlePrefix == null ? "[序列化结构变更]" : titlePrefix;
}
/**
@@ -63,7 +63,7 @@ public class ReportBuilder {
String header = buildHeader(report);
List<String> bodies = buildKeyBodies(report);
if (bodies.isEmpty()) {
return Collections.singletonList(header + "未检测到缓存序列化结构变更。\n");
return Collections.singletonList(header + "未检测到序列化结构变更。\n");
}
StringBuilder combined = new StringBuilder(header);
@@ -182,7 +182,7 @@ public class ReportBuilder {
public String toConsole(CheckReport report) {
StringBuilder sb = new StringBuilder();
if (!report.hasChanges()) {
sb.append("未检测到缓存序列化结构变更。\n");
sb.append("未检测到序列化结构变更。\n");
return sb.toString();
}

View File

@@ -1,4 +1,4 @@
# cache-schema-checker 内置默认配置
# serialization-schema-checker 内置默认配置
# 业务仓库通过 --config 指定的配置会与本文件深度合并(业务配置优先)。
# 总开关false 时不执行检测、不发通知、流水线直接通过
@@ -19,7 +19,7 @@ notify:
enabled: true
webhook_url: ""
notify_on_clean: false
title_prefix: "[缓存结构变更]"
title_prefix: "[序列化结构变更]"
# 忽略规则
ignore: