Skip to content

Conversation

wy65701436
Copy link
Contributor

Fixes #22257

Add support for SKIP_LOG_AUDIT_DATABASE env to control audit log database storage during Harbor initialization.

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.

Copy link

codecov bot commented Oct 11, 2025

Codecov Report

❌ Patch coverage is 15.94203% with 58 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.84%. Comparing base (c8c11b4) to head (57515ae).
⚠️ Report is 576 commits behind head on main.

Files with missing lines Patch % Lines
src/core/main.go 0.00% 30 Missing ⚠️
src/pkg/config/db/dao/dao.go 0.00% 11 Missing ⚠️
src/pkg/config/db/db.go 0.00% 11 Missing ⚠️
src/pkg/config/db/cache.go 0.00% 2 Missing ⚠️
src/pkg/config/inmemory/manager.go 0.00% 2 Missing ⚠️
src/pkg/config/rest/rest.go 0.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main   #22452       +/-   ##
===========================================
+ Coverage   45.36%   65.84%   +20.47%     
===========================================
  Files         244     1073      +829     
  Lines       13333   116105   +102772     
  Branches     2719     2931      +212     
===========================================
+ Hits         6049    76447    +70398     
- Misses       6983    35421    +28438     
- Partials      301     4237     +3936     
Flag Coverage Δ
unittests 65.84% <15.94%> (+20.47%) ⬆️

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

Files with missing lines Coverage Δ
src/lib/config/config.go 86.04% <ø> (ø)
src/pkg/config/manager.go 46.09% <100.00%> (ø)
src/pkg/config/store/store.go 65.62% <100.00%> (ø)
src/pkg/config/db/cache.go 59.25% <0.00%> (ø)
src/pkg/config/inmemory/manager.go 63.63% <0.00%> (ø)
src/pkg/config/rest/rest.go 61.90% <0.00%> (ø)
src/pkg/config/db/dao/dao.go 44.23% <0.00%> (ø)
src/pkg/config/db/db.go 44.23% <0.00%> (ø)
src/core/main.go 0.00% <0.00%> (ø)

... and 978 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.

Fixes goharbor#22257

Add support for SKIP_LOG_AUDIT_DATABASE env to control audit log database storage during Harbor initialization.

Signed-off-by: wang yan <[email protected]>

// Allow user to disable writing audit log to db by env while initialize
if err := initSkipAuditDBbyEnv(ctx); err != nil {
log.Errorf("Failed to initialize SkipAuditDB by ENV: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Return error and fail fast would be better if the user sets an invalid value.

// Save - save config item into config driver
Save(ctx context.Context, cfg map[string]any) error
// Get - get config item from config driver
Get(ctx context.Context, key string) (map[string]any, error)
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually GetFromDriver will be delegate to Get, consider use GetFromDriver as the name to make it more readable.
method name Get is too general, and maybe misused in future, use the same name GetFromDriver would be better.

Copy link
Contributor

@MinerYang MinerYang left a comment

Choose a reason for hiding this comment

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

lgtm

@wy65701436 wy65701436 enabled auto-merge (squash) October 17, 2025 03:24
@wy65701436 wy65701436 merged commit 6e15beb into goharbor:main Oct 17, 2025
12 checks passed
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.

Disable writing to audit log writing to DB by default

6 participants