Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: sync delete mode #398

Merged
merged 6 commits into from
Feb 10, 2023
Merged

feat: sync delete mode #398

merged 6 commits into from
Feb 10, 2023

Conversation

elrrrrrrr
Copy link
Member

为了避免部分 npm 包误封、误删,导致生产环境影响,新增 syncDeleteMode 配置,允许自定义同步策略

  • 新增 syncDeleteMode : 'ignore' | 'block' | 'delete'
    • delete: 目前默认值,同步删包事件
    • ignore: 忽略 upstream 所有删包事件
    • block: 不做物理删除,只新增 block 记录,不允许访问,除非管理员手动恢复并更新 syncPackageBlockList
  • npm-security-holder 场景也判断为删包事件
  • 更新原有删包流程,统一处理,调整部分日志输出

New syncDeleteMode to allow custom syncing policy to avoid some npm packages being blocked or deleted by mistake.

  • Add syncDeleteMode : 'ignore' | 'block' | 'delete'
    • delete: by default, sync delete events
    • ignore: ignore all upstream delete events
    • block: only add block records, cant access unless the administrator manually restores and update syncPackageBlockList.
  • npm-security-holder event is also determined to be a delete event
  • Update the original packet deletion process, update log output by the way

Translated with www.DeepL.com/Translator (free version)

@codecov
Copy link

codecov bot commented Feb 9, 2023

Codecov Report

Merging #398 (5f3e69b) into master (db8995a) will decrease coverage by 0.19%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #398      +/-   ##
==========================================
- Coverage   97.61%   97.42%   -0.19%     
==========================================
  Files         152      152              
  Lines       13193    13271      +78     
  Branches     1710     1718       +8     
==========================================
+ Hits        12878    12929      +51     
- Misses        315      342      +27     
Impacted Files Coverage Δ
app/common/constants.ts 100.00% <100.00%> (ø)
app/core/service/PackageSyncerService.ts 99.28% <100.00%> (-0.07%) ⬇️
app/infra/NFSClientAdapter.ts 86.58% <100.00%> (-8.54%) ⬇️
config/config.default.ts 87.64% <100.00%> (-8.39%) ⬇️
app/core/service/TaskService.ts 97.77% <0.00%> (-1.67%) ⬇️
app/core/service/PackageManagerService.ts 97.53% <0.00%> (-0.12%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@fengmk2 fengmk2 changed the title Feat sync delete mode feat: sync delete mode Feb 9, 2023
@elrrrrrrr elrrrrrrr force-pushed the feat-sync-delete-mode branch from d909143 to d16008a Compare February 10, 2023 02:51
@elrrrrrrr elrrrrrrr requested a review from fengmk2 February 10, 2023 03:09
@fengmk2
Copy link
Member

fengmk2 commented Feb 10, 2023

@elrrrrrrr CI 挂了。

@elrrrrrrr elrrrrrrr changed the title feat: sync delete mode WIP: feat: sync delete mode Feb 10, 2023
@elrrrrrrr elrrrrrrr force-pushed the feat-sync-delete-mode branch from 78d1c4c to 5f3e69b Compare February 10, 2023 04:03
@elrrrrrrr elrrrrrrr changed the title WIP: feat: sync delete mode feat: sync delete mode Feb 10, 2023
@fengmk2 fengmk2 added the enhancement New feature or request label Feb 10, 2023
@fengmk2 fengmk2 merged commit 27af0be into master Feb 10, 2023
@fengmk2 fengmk2 deleted the feat-sync-delete-mode branch February 10, 2023 13:31
fengmk2 pushed a commit that referenced this pull request Feb 10, 2023
[skip ci]

## [3.4.0](v3.3.2...v3.4.0) (2023-02-10)

### Features

* sync delete mode ([#398](#398)) ([27af0be](27af0be))
@github-actions
Copy link

🎉 This PR is included in version 3.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants