Skip to content

Comments

add tag deletion option for gc#22382

Merged
wy65701436 merged 4 commits intogoharbor:mainfrom
wy65701436:gc-delete-option
Sep 29, 2025
Merged

add tag deletion option for gc#22382
wy65701436 merged 4 commits intogoharbor:mainfrom
wy65701436:gc-delete-option

Conversation

@wy65701436
Copy link
Contributor

As proposed in the GC performance enhancement, Harbor will provide an option in the garbage collection job to determine whether tag files should be removed from the backend storage. By default, this option will be enabled (true) to align with the previous behavior. For performance considerations, users can disable tag deletion by unchecking this option.

Proposal: goharbor/community#265

Thank you for contributing to Harbor!

Comprehensive Summary of your change

Issue being fixed

Fixes #(issue)

Please indicate you've done the following:

  • Well Written Title and Summary of the PR
  • Label the PR as needed. "release-note/ignore-for-release, release-note/new-feature, release-note/update, release-note/enhancement, release-note/community, release-note/breaking-change, release-note/docs, release-note/infra, release-note/deprecation"
  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Made sure tests are passing and test coverage is added if needed.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed in website repository.

@codecov
Copy link

codecov bot commented Sep 23, 2025

Codecov Report

❌ Patch coverage is 25.00000% with 33 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.89%. Comparing base (c8c11b4) to head (782d158).
⚠️ Report is 571 commits behind head on main.

Files with missing lines Patch % Lines
src/jobservice/job/impl/gc/garbage_collection.go 18.75% 26 Missing ⚠️
src/server/v2.0/handler/gc.go 0.00% 6 Missing ⚠️
...t-side-nav/clearing-job/gc-page/gc/gc.component.ts 66.66% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main   #22382       +/-   ##
===========================================
+ Coverage   45.36%   65.89%   +20.52%     
===========================================
  Files         244     1072      +828     
  Lines       13333   115950   +102617     
  Branches     2719     2927      +208     
===========================================
+ Hits         6049    76401    +70352     
- Misses       6983    35317    +28334     
- Partials      301     4232     +3931     
Flag Coverage Δ
unittests 65.89% <25.00%> (+20.52%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/controller/gc/controller.go 73.42% <100.00%> (ø)
...t-side-nav/clearing-job/gc-page/gc/gc.component.ts 62.19% <66.66%> (+0.16%) ⬆️
src/server/v2.0/handler/gc.go 2.33% <0.00%> (ø)
src/jobservice/job/impl/gc/garbage_collection.go 45.84% <18.75%> (ø)

... and 982 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

As proposed in the GC performance enhancement, Harbor will provide an option in the garbage collection job to determine whether tag files should be removed from the backend storage. By default, this option will be enabled (true) to align with the previous behavior. For performance considerations, users can disable tag deletion by unchecking this option.

Proposal: goharbor/community#265

Signed-off-by: wang yan <yan-yw.wang@broadcom.com>
Signed-off-by: wang yan <yan-yw.wang@broadcom.com>
Copy link
Member

@chlins chlins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@stonezdj stonezdj requested a review from Copilot September 25, 2025 06:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new "delete_tag" option to Harbor's garbage collection (GC) functionality to control whether tag files should be removed from backend storage. By default, this option is enabled to maintain backward compatibility. This enhancement provides performance optimization by allowing users to disable tag deletion when not needed.

  • Adds a new delete_tag parameter to GC configuration with default value true
  • Updates UI components and API handlers to support the new option
  • Extends internationalization support for the new feature across multiple languages

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/server/v2.0/handler/gc.go Adds delete_tag parameter handling to GC API endpoints
src/portal/src/i18n/lang/*.json Adds translations for DELETE_TAG label in multiple languages
src/portal/src/app/base/left-side-nav/clearing-job/gc-page/gc/gc.component.* Implements UI toggle for delete_tag option
src/jobservice/job/impl/gc/garbage_collection.go Adds delete_tag logic to GC job implementation
src/controller/gc/*.go Updates GC controller and model to support delete_tag parameter
src/jobservice/job/impl/gc/garbage_collection_test.go Adds test coverage for delete_tag functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@goharbor goharbor deleted a comment from Copilot AI Sep 25, 2025
Copy link
Contributor

@bupd bupd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please check and confirm. if the delete_tag param is true by default.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested it but from a fresh deployment by default the params are falsy.

delete_tag: should be true. instead of false by default.

Image

Signed-off-by: wang yan <yan-yw.wang@broadcom.com>
@wy65701436 wy65701436 enabled auto-merge (squash) September 29, 2025 05:28
@wy65701436 wy65701436 merged commit 1a7eb31 into goharbor:main Sep 29, 2025
12 checks passed
OrlinVasilev pushed a commit to OrlinVasilev/harbor that referenced this pull request Oct 29, 2025
* add tag deletion option for gc

As proposed in the GC performance enhancement, Harbor will provide an option in the garbage collection job to determine whether tag files should be removed from the backend storage. By default, this option will be enabled (true) to align with the previous behavior. For performance considerations, users can disable tag deletion by unchecking this option.

Proposal: goharbor/community#265

Signed-off-by: wang yan <yan-yw.wang@broadcom.com>

* resolve comments

Signed-off-by: wang yan <yan-yw.wang@broadcom.com>

* fix ut

Signed-off-by: wang yan <yan-yw.wang@broadcom.com>

---------

Signed-off-by: wang yan <yan-yw.wang@broadcom.com>
Co-authored-by: wang yan <yan-yw.wang@broadcom.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants