chore(infra): archive obsolete scripts, dynamically copy Dockerfile migrations, and harden Node 24 test:all
This commit is contained in:
parent
29ebb3c41d
commit
d7288f3f06
102
Dockerfile
102
Dockerfile
@ -95,54 +95,10 @@ RUN if ! printf '%s\n' "$VCS_REF" | grep -Eq '^[0-9a-f]{40}$'; then \
|
||||
RUN test -s "/app/public/brand/header-logo.png" && \
|
||||
test -s "/app/public/brand/login-logo.png" && \
|
||||
test -s "/app/public/brand/favicon.png" && \
|
||||
node -e "const sharp=require('sharp'); Promise.all(['header-logo.png','login-logo.png','favicon.png'].map((name)=>sharp('/app/public/brand/'+name,{failOn:'error',limitInputPixels:25000000,animated:false}).rotate().toBuffer())).then(()=>console.log('builder brand image decode smoke passed')).catch((error)=>{console.error(error);process.exit(1)})" && \
|
||||
test -f "/app/prisma/migrations/20251118000000_add_upload_id_to_materials/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260811_add_video_transcode_lease/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260811_update_brand_logo_defaults/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260812_add_product_package_upload_job_lease/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260812_align_material_upload_idempotency_index/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260813_add_material_custody_department/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260813_add_organization_units_and_employment_state/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260813_add_user_employee_binding/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260817_add_material_is_incomplete_shell/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260819_add_user_permission_inherit/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260820_add_permission_group_members/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260820_unique_permission_group_department/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260820_add_ding_workflow_snapshots/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260824_expand_ding_workflow_insights/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260826_add_ding_workflow_demand_type/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260827_add_ding_workflow_detail_fields/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260826_add_pack_video_early_access/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260828_add_pack_item_can_edit_assets/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260828_add_task_detail_change_approvals/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260829_add_recoverable_api_key_secret/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260831_add_private_task_detail/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260902_add_employee_roster_history/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260903_add_work_review_brand/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260908_add_brand_knowledge/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260909_expand_brand_knowledge_upload/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260914_add_brand_knowledge_engagement/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260914_expand_brand_knowledge_download_count/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260914_expand_brand_knowledge_preview_slices/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260915_add_brand_knowledge_soft_delete/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260918_add_performance_conversion_sync/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260923_add_certificate_report_metadata/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20260924_add_certificate_tested_on/migration.sql"
|
||||
RUN test -f "/app/prisma/migrations/20261008_permission_group_department_identity/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20261008_team_function_configs/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20261009_material_purge_outbox/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20261009_material_purge_reference_indexes/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20261012_ai_model_registry/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20261013_ai_model_capabilities/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20261013_ai_model_verifications/migration.sql"
|
||||
node -e "const sharp=require('sharp'); Promise.all(['header-logo.png','login-logo.png','favicon.png'].map((name)=>sharp('/app/public/brand/'+name,{failOn:'error',limitInputPixels:25000000,animated:false}).rotate().toBuffer())).then(()=>console.log('builder brand image decode smoke passed')).catch((error)=>{console.error(error);process.exit(1)})"
|
||||
|
||||
RUN test -f "/app/prisma/migrations/20261106160000_salary_personnel_grade/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20261028090000_salary_position_configuration/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20261126120000_salary_performance_versions/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20261130120000_desktop_material_deliveries/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20261201140000_xiaoyi_listing_status/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20261201190000_desktop_client_feedbacks/migration.sql" && \
|
||||
test -f "/app/prisma/migrations/20261202090000_performance_survey_attachments/migration.sql"
|
||||
# 动态校验所有 prisma/migrations 子目录均包含非空 migration.sql,避免手工清单漏项或漂移。
|
||||
RUN node -e "const fs=require('fs'),path=require('path'); const dir='/app/prisma/migrations'; const entries=fs.readdirSync(dir,{withFileTypes:true}).filter(d=>d.isDirectory()); if(entries.length===0) throw new Error('No prisma migrations found'); for(const entry of entries){ const sql=path.join(dir,entry.name,'migration.sql'); const st=fs.statSync(sql); if(!st.isFile()||st.size===0) throw new Error('Missing or empty migration.sql in '+entry.name); } console.log('Verified '+entries.length+' prisma migrations');"
|
||||
|
||||
# 这两个动态路由负责兜底访问本地上传文件;如果它们在构建上下文里丢失,
|
||||
# 线上音频/视频就会直接 404。这里提前失败,避免再把缺路由的镜像发出去。
|
||||
@ -279,57 +235,9 @@ COPY --from=builder --chown=root:root /app/node_modules/@ioredis ./node_modules/
|
||||
COPY --from=builder --chown=root:root /app/node_modules/@aws-sdk ./node_modules/@aws-sdk
|
||||
COPY --from=builder --chown=root:root /app/node_modules/@smithy ./node_modules/@smithy
|
||||
|
||||
# 复制运行时 schema,以及切流前只读校验所需的精确 migration;仍不复制 engine-cache。
|
||||
# 复制运行时 schema 与全部 migration(动态对齐 prisma/migrations,避免手工清单漏项);仍不复制 engine-cache。
|
||||
COPY --from=builder --chown=root:root /app/prisma/schema.prisma ./prisma/schema.prisma
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20251118000000_add_upload_id_to_materials ./prisma/migrations/20251118000000_add_upload_id_to_materials
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260811_add_video_transcode_lease ./prisma/migrations/20260811_add_video_transcode_lease
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260811_update_brand_logo_defaults ./prisma/migrations/20260811_update_brand_logo_defaults
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260812_add_product_package_upload_job_lease ./prisma/migrations/20260812_add_product_package_upload_job_lease
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260812_align_material_upload_idempotency_index ./prisma/migrations/20260812_align_material_upload_idempotency_index
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260813_add_material_custody_department ./prisma/migrations/20260813_add_material_custody_department
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260813_add_organization_units_and_employment_state ./prisma/migrations/20260813_add_organization_units_and_employment_state
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260813_add_user_employee_binding ./prisma/migrations/20260813_add_user_employee_binding
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260817_add_material_is_incomplete_shell ./prisma/migrations/20260817_add_material_is_incomplete_shell
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260819_add_user_permission_inherit ./prisma/migrations/20260819_add_user_permission_inherit
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260820_add_permission_group_members ./prisma/migrations/20260820_add_permission_group_members
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260820_unique_permission_group_department ./prisma/migrations/20260820_unique_permission_group_department
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260820_add_ding_workflow_snapshots ./prisma/migrations/20260820_add_ding_workflow_snapshots
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260824_expand_ding_workflow_insights ./prisma/migrations/20260824_expand_ding_workflow_insights
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260826_add_ding_workflow_demand_type ./prisma/migrations/20260826_add_ding_workflow_demand_type
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260827_add_ding_workflow_detail_fields ./prisma/migrations/20260827_add_ding_workflow_detail_fields
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260826_add_pack_video_early_access ./prisma/migrations/20260826_add_pack_video_early_access
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260828_add_pack_item_can_edit_assets ./prisma/migrations/20260828_add_pack_item_can_edit_assets
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260828_add_task_detail_change_approvals ./prisma/migrations/20260828_add_task_detail_change_approvals
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260829_add_recoverable_api_key_secret ./prisma/migrations/20260829_add_recoverable_api_key_secret
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260831_add_private_task_detail ./prisma/migrations/20260831_add_private_task_detail
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260902_add_employee_roster_history ./prisma/migrations/20260902_add_employee_roster_history
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260903_add_work_review_brand ./prisma/migrations/20260903_add_work_review_brand
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260908_add_brand_knowledge ./prisma/migrations/20260908_add_brand_knowledge
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260909_expand_brand_knowledge_upload ./prisma/migrations/20260909_expand_brand_knowledge_upload
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260914_add_brand_knowledge_engagement ./prisma/migrations/20260914_add_brand_knowledge_engagement
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260914_expand_brand_knowledge_download_count ./prisma/migrations/20260914_expand_brand_knowledge_download_count
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260914_expand_brand_knowledge_preview_slices ./prisma/migrations/20260914_expand_brand_knowledge_preview_slices
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260915_add_brand_knowledge_soft_delete ./prisma/migrations/20260915_add_brand_knowledge_soft_delete
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260918_add_performance_conversion_sync ./prisma/migrations/20260918_add_performance_conversion_sync
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260923_add_certificate_report_metadata ./prisma/migrations/20260923_add_certificate_report_metadata
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20260924_add_certificate_tested_on ./prisma/migrations/20260924_add_certificate_tested_on
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20261012_detail_generator ./prisma/migrations/20261012_detail_generator
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20261012_ai_model_registry ./prisma/migrations/20261012_ai_model_registry
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20261013_ai_model_capabilities ./prisma/migrations/20261013_ai_model_capabilities
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20261013_ai_model_verifications ./prisma/migrations/20261013_ai_model_verifications
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20261020090000_desktop_client_workspace ./prisma/migrations/20261020090000_desktop_client_workspace
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20261020120000_desktop_creation_tasks ./prisma/migrations/20261020120000_desktop_creation_tasks
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20261020150000_desktop_project_deletion ./prisma/migrations/20261020150000_desktop_project_deletion
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20261023130000_personnel_salary_base ./prisma/migrations/20261023130000_personnel_salary_base
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20261028090000_salary_position_configuration ./prisma/migrations/20261028090000_salary_position_configuration
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20261106160000_salary_personnel_grade ./prisma/migrations/20261106160000_salary_personnel_grade
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20261106110000_material_access_scope ./prisma/migrations/20261106110000_material_access_scope
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20261112154000_task_detail_zip_cleanup ./prisma/migrations/20261112154000_task_detail_zip_cleanup
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20261126120000_salary_performance_versions ./prisma/migrations/20261126120000_salary_performance_versions
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20261130120000_desktop_material_deliveries ./prisma/migrations/20261130120000_desktop_material_deliveries
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20261201140000_xiaoyi_listing_status ./prisma/migrations/20261201140000_xiaoyi_listing_status
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20261201190000_desktop_client_feedbacks ./prisma/migrations/20261201190000_desktop_client_feedbacks
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations/20261202090000_performance_survey_attachments ./prisma/migrations/20261202090000_performance_survey_attachments
|
||||
COPY --from=builder --chown=root:root /app/prisma/migrations ./prisma/migrations
|
||||
COPY --from=builder --chown=root:root /app/lib ./lib
|
||||
COPY --from=builder --chown=root:root /app/scripts/public-traffic-rollup-from-nginx.py ./scripts/public-traffic-rollup-from-nginx.py
|
||||
COPY --from=builder --chown=root:root /app/scripts/collapse-performance-survey-template-versions.mjs ./scripts/collapse-performance-survey-template-versions.mjs
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
"typecheck": "tsc --noEmit",
|
||||
"test": "jest",
|
||||
"test:all": "node scripts/test-all.mjs",
|
||||
"verify:node24": "node scripts/test-all.mjs",
|
||||
"test:scripts": "node --test --test-concurrency=4 scripts/*.test.mjs scripts/*.test.cjs",
|
||||
"test:agent": "npm --prefix apps/detail-agent-pi test",
|
||||
"test:whitelabel": "node --test apps/detail-agent-pi/test/whitelabel.test.mjs",
|
||||
|
||||
@ -207,11 +207,4 @@ CI 使用仓库变量 `XIAOYI_KB_CONTRACT_SOURCE` 和 `XIAOYI_KB_CONTRACT_RELEAS
|
||||
|
||||
## 8. 一次性诊断归档
|
||||
|
||||
在仓库的命令、工作流、文档、应用、库代码和其他脚本中逐个核对文件名及调用路径。下列脚本只用于历史排查,已移入 [archive/](./archive/)。
|
||||
|
||||
| 脚本 | 原用途 |
|
||||
| --- | --- |
|
||||
| [analyze-missing-assets.ts](./archive/analyze-missing-assets.ts) | 盘点早期任务详情缺失的素材资产记录 |
|
||||
| [audit-flower-mismatch.ts](./archive/audit-flower-mismatch.ts) | 只读排查花名与职级串档 |
|
||||
| [check-materials-status.ts](./archive/check-materials-status.ts) | 检查任务详情素材旧链路迁移前后的状态 |
|
||||
| [find-audio-materials.ts](./archive/find-audio-materials.ts) | 对照旧本地上传目录定位音频素材 |
|
||||
在仓库的命令、工作流、文档、应用、库代码和其他脚本中逐个核对文件名及调用路径。历史排查脚本及已被 SPU 台账替代的旧 SKU 导入脚本已统一移入 [archive/](./archive/),完整索引见 [scripts/archive/README.md](./archive/README.md)。
|
||||
|
||||
43
scripts/archive/README.md
Normal file
43
scripts/archive/README.md
Normal file
@ -0,0 +1,43 @@
|
||||
# 历史一次性脚本归档索引
|
||||
|
||||
本目录存放已退役或被新入口替代的历史一次性脚本(保留完整 Git 历史),不再作为现行生产运维或构建入口使用。
|
||||
|
||||
## 1. 早期诊断与一次性修复脚本
|
||||
|
||||
| 脚本 | 原用途 | 归档说明 |
|
||||
| --- | --- | --- |
|
||||
| `analyze-missing-assets.ts` | 盘点早期任务详情缺失的素材资产记录 | 历史只读排查脚本 |
|
||||
| `analyze-network-window.ps1` | 早期本机/内网窗口网络诊断 | 一次性 PowerShell 诊断脚本 |
|
||||
| `audit-flower-mismatch.ts` | 只读排查花名与职级串档 | 历史只读排查脚本 |
|
||||
| `check-materials-status.ts` | 检查任务详情素材旧链路迁移前后的状态 | 历史只读排查脚本 |
|
||||
| `check-source-files-status.ts` | 检查素材源文件状态 | 历史一次性排查脚本 |
|
||||
| `cleanup-shadow-test-materials.ts` | 清理影子环境测试素材 | 历史一次性清理脚本 |
|
||||
| `cleanup-video-transcode-progress.js` | 清理早期视频转码进度记录 | 历史一次性清理脚本 |
|
||||
| `delete-material.ps1` | 按 ID 手工删除素材 | 历史一次性运维脚本 |
|
||||
| `find-audio-materials.ts` | 对照旧本地上传目录定位音频素材 | 历史只读排查脚本 |
|
||||
| `find-user-by-name.ts` | 按姓名检索用户记录 | 历史一次性查询脚本 |
|
||||
| `fix-video-zip-ext.js` | 修复早期视频压缩包扩展名异常 | 历史一次性修复脚本 |
|
||||
| `init-super-admins.ts` | 早期超级管理员初始化引导 | 历史一次性初始化脚本 |
|
||||
| `query-material-detail.ps1` | 早期素材详情 PowerShell 查询 | 历史一次性查询脚本 |
|
||||
| `query-system-stats.ts` | 早期系统统计信息查询 | 历史一次性查询脚本 |
|
||||
| `seed-work-review-local-test.ts` | 作品过稿看板早期本地测试造数 | 历史本地测试脚本 |
|
||||
|
||||
## 2. 旧 SKU 锚点历史素材扫描与导入脚本
|
||||
|
||||
以下脚本属于早期基于 SKU CSV/SQLite 的历史素材扫描链路,已被 `scripts/scan_spu_ledger.py` 与 `scripts/export_spu_ledger.py`(SPU 台账方案)替代(参见 [scripts/README.md](../README.md)):
|
||||
|
||||
| 脚本 | 原用途 |
|
||||
| --- | --- |
|
||||
| `add_windows_path_to_sku_exports.js` | 为旧 SKU 导出表补充 Windows 路径列 |
|
||||
| `build_import_records_from_package_candidates.py` | 从旧包候选集生成导入记录 |
|
||||
| `build-history-import-retry-files.ts` | 生成旧历史导入重试清单 |
|
||||
| `discover_needs_review_package_candidates.py` | 发现旧流程中需人工复核的包候选 |
|
||||
| `export_sku_folder_db.py` | 从旧 SKU SQLite 库导出数据 |
|
||||
| `export-history-import-scan-summary.js` | 导出旧历史导入扫描汇总 |
|
||||
| `filter_needs_review_dry_run_records.py` | 过滤旧 dry-run 复核记录 |
|
||||
| `filter_sku_export_zero_rows.js` | 过滤旧 SKU 导出中的零行记录 |
|
||||
| `query_sku_folder_db.py` | 查询旧 SKU SQLite 库 |
|
||||
| `remove_sku_rows_by_windows_prefix.js` | 按 Windows 路径前缀移除旧 SKU 行 |
|
||||
| `review_needs_review_spu_groups.py` | 复核旧流程 SPU 分组记录 |
|
||||
| `scan_sku_folders_to_sqlite.py` | 扫描文件夹生成旧 SKU SQLite 库 |
|
||||
| `scan-history-from-sku-csv.ts` | 从旧 SKU CSV 扫描历史素材 |
|
||||
@ -679,9 +679,11 @@ test('AI model cutover gate checks every migration and rejects missing, mistyped
|
||||
|
||||
test('AI registry migration files are present in builder and immutable runner verification scope', () => {
|
||||
const dockerfile = readFileSync(new URL('../Dockerfile', import.meta.url), 'utf8')
|
||||
assert.ok(dockerfile.includes("const dir='/app/prisma/migrations'"))
|
||||
assert.ok(dockerfile.includes('COPY --from=builder --chown=root:root /app/prisma/migrations ./prisma/migrations'))
|
||||
for (const migration of ['20261012_ai_model_registry', '20261013_ai_model_capabilities', '20261013_ai_model_verifications']) {
|
||||
assert.ok(dockerfile.includes(`test -f "/app/prisma/migrations/${migration}/migration.sql"`))
|
||||
assert.ok(dockerfile.includes(`COPY --from=builder --chown=root:root /app/prisma/migrations/${migration} ./prisma/migrations/${migration}`))
|
||||
const migrationSql = readFileSync(new URL(`../prisma/migrations/${migration}/migration.sql`, import.meta.url), 'utf8')
|
||||
assert.ok(migrationSql.trim().length > 0)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@ -1012,8 +1012,10 @@ test('container supply chain and migrator image are immutable while SOP keeps co
|
||||
assert.ok(dockerIgnore.lastIndexOf('!scripts/maintain-salary-performance-versions.ts') > scriptsExcludeIndex)
|
||||
assert.match(migrator, /COPY --from=builder --chown=root:root \/app\/scripts\/maintain-salary-performance-versions\.ts/)
|
||||
const performanceMigration = 'prisma/migrations/20261126120000_salary_performance_versions'
|
||||
assert.ok(dockerfile.slice(runnerStart).includes(`COPY --from=builder --chown=root:root /app/${performanceMigration} ./${performanceMigration}`))
|
||||
assert.match(dockerfile, /20260812_align_material_upload_idempotency_index/)
|
||||
assert.ok(dockerfile.includes("const dir='/app/prisma/migrations'"))
|
||||
assert.ok(dockerfile.slice(runnerStart).includes('COPY --from=builder --chown=root:root /app/prisma/migrations ./prisma/migrations'))
|
||||
assert.ok((await readFile(new URL(`../${performanceMigration}/migration.sql`, import.meta.url), 'utf8')).trim().length > 0)
|
||||
assert.ok((await readFile(new URL('../prisma/migrations/20260812_align_material_upload_idempotency_index/migration.sql', import.meta.url), 'utf8')).trim().length > 0)
|
||||
assert.match(migratorSource, /'20260812_align_material_upload_idempotency_index'/)
|
||||
for (const migrationName of [
|
||||
'20260813_add_material_custody_department',
|
||||
@ -1040,11 +1042,11 @@ test('container supply chain and migrator image are immutable while SOP keeps co
|
||||
'20260923_add_certificate_report_metadata',
|
||||
'20260924_add_certificate_tested_on',
|
||||
]) {
|
||||
assert.match(dockerfile, new RegExp(migrationName))
|
||||
assert.ok((await readFile(new URL(`../prisma/migrations/${migrationName}/migration.sql`, import.meta.url), 'utf8')).trim().length > 0)
|
||||
assert.match(migratorSource, new RegExp(`'${migrationName}'`))
|
||||
assert.ok(sop.includes('`' + migrationName + '`'))
|
||||
}
|
||||
assert.match(dockerfile, /20260829_add_recoverable_api_key_secret/)
|
||||
assert.ok((await readFile(new URL('../prisma/migrations/20260829_add_recoverable_api_key_secret/migration.sql', import.meta.url), 'utf8')).trim().length > 0)
|
||||
assert.match(migratorSource, /'20260829_add_recoverable_api_key_secret'/)
|
||||
assert.match(deploymentSource, /'20260829_add_recoverable_api_key_secret'/)
|
||||
assert.ok(sop.includes('`20260829_add_recoverable_api_key_secret`'))
|
||||
|
||||
@ -1,11 +1,25 @@
|
||||
import { spawnSync } from 'node:child_process'
|
||||
|
||||
const majorVersion = Number.parseInt(process.versions.node.split('.')[0] ?? '', 10)
|
||||
if (!Number.isFinite(majorVersion) || majorVersion < 24) {
|
||||
console.error(`test:all requires Node 24+, got ${process.version}`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const npmCommand = process.env.npm_execpath
|
||||
? process.execPath
|
||||
: (process.platform === 'win32' ? 'npm.cmd' : 'npm')
|
||||
|
||||
for (const args of [
|
||||
['run', 'test', '--', '--maxWorkers=2'],
|
||||
['run', 'test:scripts'],
|
||||
['run', 'test:agent'],
|
||||
]) {
|
||||
const result = spawnSync(process.execPath, [process.env.npm_execpath, ...args], { stdio: 'inherit' })
|
||||
const spawnArgs = process.env.npm_execpath ? [process.env.npm_execpath, ...args] : args
|
||||
const result = spawnSync(npmCommand, spawnArgs, {
|
||||
stdio: 'inherit',
|
||||
shell: !process.env.npm_execpath && process.platform === 'win32',
|
||||
})
|
||||
if (result.error) throw result.error
|
||||
if (result.signal) {
|
||||
process.exitCode = 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user