feat: 1、流水线总开关配置 2、删除p0p1p2级别阻断
All checks were successful
Redis序列化结构检查 / redis-schema-check (push) Has been skipped

This commit is contained in:
2026-07-14 10:58:05 +08:00
parent 7a8ca7ce0b
commit 114b053733
10 changed files with 74 additions and 68 deletions

View File

@@ -330,16 +330,7 @@ public class SchemaCheckAnalyzer {
report.getChanges().addAll(changes);
report.getKeyChanges().addAll(keyChanges.values());
boolean blocked = false;
if (config.isBlockMode()) {
Set<String> blockSev = new HashSet<>(config.getBlockSeverities());
for (SchemaChange c : changes) {
if (blockSev.contains(c.getSeverity().name())) {
blocked = true;
break;
}
}
}
boolean blocked = config.isBlockMode() && !changes.isEmpty();
report.setBlocked(blocked);
report.setExitCode(blocked ? 1 : 0);
return report;

View File

@@ -55,6 +55,11 @@ public class RedisSchemaCheckerMain implements Callable<Integer> {
try {
CheckerConfig config = ConfigLoader.load(configPath);
if (!config.isEnabled()) {
System.out.println("[redis-schema-checker] 总开关 enabled=false跳过检测。");
return 0;
}
if (oldSha == null || oldSha.trim().isEmpty()) {
System.out.println("[redis-schema-checker] 无对比基准提交,跳过检测。");
return 0;

View File

@@ -10,11 +10,12 @@ import java.util.Map;
*/
public class CheckerConfig {
/** 总开关false 时跳过检测与通知(流水线 exit 0 */
private boolean enabled = true;
/** notify | block */
private String mode = "notify";
private List<String> blockSeverities = new ArrayList<>();
private boolean scanTestSources = false;
private List<String> sourceRoots = new ArrayList<>();
@@ -231,6 +232,14 @@ public class CheckerConfig {
}
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public String getMode() {
return mode;
}
@@ -239,14 +248,6 @@ public class CheckerConfig {
this.mode = mode;
}
public List<String> getBlockSeverities() {
return blockSeverities;
}
public void setBlockSeverities(List<String> blockSeverities) {
this.blockSeverities = blockSeverities;
}
public boolean isScanTestSources() {
return scanTestSources;
}

View File

@@ -75,8 +75,8 @@ public final class ConfigLoader {
private static CheckerConfig bind(Map<String, Object> map) {
CheckerConfig config = new CheckerConfig();
config.setEnabled(bool(map, "enabled", true));
config.setMode(str(map, "mode", "notify"));
config.setBlockSeverities(strList(map.get("block_severities")));
config.setScanTestSources(bool(map, "scan_test_sources", false));
config.setSourceRoots(strList(map.get("source_roots")));
config.setIncludeModules(strList(map.get("include_modules")));