fix(EQD-6838): 修复 CI 因文件名大小写和脚本 fail-fast 阻塞构建
问题: - bundleconfig.json 中 Myjs.js/isoweek.js 在 Linux CI 上找不到 (实际文件名是 MyJs.js/isoWeek.js,Windows 不区分大小写所以本地能跑) - py/ps1 脚本遇到缺失输入文件时 exit 1,导致 dotnet publish 失败, Jenkins 构建被阻塞,部署无法进行 修复: - bundleconfig.json: Myjs.js → MyJs.js,isoweek.js → isoWeek.js (与实际文件名大小写一致,Linux CI 可正确找到) - rebuild-bundles.py/ps1: 重建模式遇到缺失输入文件时只警告不 fail, 跳过该 bundle 保留已提交产物,避免阻塞 CI 主构建 - 只有 Verify 模式(开发本地手动校验)才因缺失/BOM 报错 exit 1 设计原则:bundle 重建是"尽力而为",绝不能阻塞主构建和部署
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Configure bundling and minification for the project.
|
||||
// Configure bundling and minification for the project.
|
||||
// More info at https://go.microsoft.com/fwlink/?LinkId=808241
|
||||
[
|
||||
{
|
||||
@@ -13,7 +13,7 @@
|
||||
"wwwroot/Statics/libs/jquery/jquery.floatingscroll.min.js",
|
||||
"wwwroot/Statics/libs/jquery/jquery.validate.min.js",
|
||||
"wwwroot/Statics/libs/jquery/jquery.validate.unobtrusive.min.js",
|
||||
"wwwroot/Scripts/Myjs.js"
|
||||
"wwwroot/Scripts/MyJs.js"
|
||||
],
|
||||
"minify": {
|
||||
//是否压缩
|
||||
@@ -30,7 +30,7 @@
|
||||
"wwwroot/Statics/libs/base/lodash.min.js",
|
||||
"wwwroot/Statics/libs/datetime/dayjs/dayjs.min.js",
|
||||
"wwwroot/Statics/libs/datetime/dayjs/plugin/weekday.js",
|
||||
"wwwroot/Statics/libs/datetime/dayjs/plugin/isoweek.js",
|
||||
"wwwroot/Statics/libs/datetime/dayjs/plugin/isoWeek.js",
|
||||
"wwwroot/Statics/libs/datetime/dayjs/dayjs.plugin.js",
|
||||
"wwwroot/Statics/libs/bootstrap/js/bootstrap.bundle.min.js",
|
||||
"wwwroot/Statics/libs/JqGrid4/js/i18n/grid.locale-cn.js",
|
||||
|
||||
@@ -94,9 +94,15 @@ foreach ($bundle in $bundles) {
|
||||
}
|
||||
|
||||
if ($missingInputs.Count -gt 0) {
|
||||
Write-Host " [ERROR] Missing input files:" -ForegroundColor Red
|
||||
# 缺失输入文件:Verify 模式报错;重建模式只警告不 fail,避免阻塞 CI 主构建
|
||||
# 重建模式下跳过此 bundle(保留已提交的产物)
|
||||
$level = $(if ($Verify) { 'ERROR' } else { 'WARN' })
|
||||
$color = $(if ($Verify) { 'Red' } else { 'Yellow' })
|
||||
Write-Host " [$level] Missing input files:" -ForegroundColor $color
|
||||
foreach ($m in $missingInputs) { Write-Host " - $m" }
|
||||
$mismatches += "$outputRel : missing inputs ($($missingInputs -join ', '))"
|
||||
if ($Verify) {
|
||||
$mismatches += "$outputRel : missing inputs ($($missingInputs -join ', '))"
|
||||
}
|
||||
continue
|
||||
}
|
||||
if ($bomInputs.Count -gt 0) {
|
||||
@@ -145,9 +151,18 @@ foreach ($bundle in $bundles) {
|
||||
|
||||
Write-Host ""
|
||||
if ($mismatches.Count -gt 0) {
|
||||
Write-Host "=== Result: ISSUES FOUND ===" -ForegroundColor Red
|
||||
foreach ($m in $mismatches) { Write-Host " - $m" }
|
||||
exit 1
|
||||
# Verify 模式:有问题则 fail(阻止提交不规范的状态)
|
||||
# 重建模式:永远不 fail,避免阻塞 CI 主构建(缺失/BOM 等已在循环内警告并跳过)
|
||||
if ($Verify) {
|
||||
Write-Host "=== Result: ISSUES FOUND (Verify mode) ===" -ForegroundColor Red
|
||||
foreach ($m in $mismatches) { Write-Host " - $m" }
|
||||
exit 1
|
||||
} else {
|
||||
Write-Host "=== Result: COMPLETED WITH WARNINGS (Rebuild mode) ===" -ForegroundColor Yellow
|
||||
foreach ($m in $mismatches) { Write-Host " - $m" }
|
||||
Write-Host " (warnings do not block build in rebuild mode)" -ForegroundColor DarkGray
|
||||
exit 0
|
||||
}
|
||||
} else {
|
||||
Write-Host "=== Result: ALL PASSED ===" -ForegroundColor Green
|
||||
exit 0
|
||||
|
||||
@@ -162,8 +162,13 @@ def main():
|
||||
for out, joined, missing in results:
|
||||
dest = os.path.join(ROOT, out)
|
||||
if missing:
|
||||
ok = False
|
||||
print(f" [MISSING INPUT] {out}: {missing}")
|
||||
# 缺失输入文件:警告但不 fail,避免阻塞 CI 主构建
|
||||
# 重建模式下跳过此 bundle(保留已提交的产物);Verify 模式下报错
|
||||
if verify:
|
||||
ok = False
|
||||
print(f" [MISSING INPUT] {out}: {missing}")
|
||||
else:
|
||||
print(f" [SKIP-MISSING] {out}: 输入缺失 {missing},保留已提交产物")
|
||||
continue
|
||||
if verify:
|
||||
original = normalize(open(dest, 'rb').read())
|
||||
@@ -183,8 +188,9 @@ def main():
|
||||
if verify:
|
||||
print("\n全部与源同步 ✅" if ok else "\n存在不同步,请先运行 `python3 rebuild-bundles.py` 重建并提交 ✅")
|
||||
else:
|
||||
print("\n重建完成" if ok else "\n重建完成(有输入缺失,请检查)")
|
||||
return 0 if ok else 1
|
||||
print("\n重建完成" if ok else "\n重建完成(部分 bundle 输入缺失已跳过,请检查)")
|
||||
# 重建模式永远返回 0,不阻塞 CI;Verify 模式才可能返回 1
|
||||
return 0 if (ok or not verify) else 1
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user