Skip to content

Commit

Permalink
Merge branch 'main' into default-page
Browse files Browse the repository at this point in the history
  • Loading branch information
bupd authored Feb 19, 2025
2 parents dccdc6b + 4565907 commit bf49756
Show file tree
Hide file tree
Showing 27 changed files with 734 additions and 92 deletions.
12 changes: 10 additions & 2 deletions api/v2.0/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4486,7 +4486,7 @@ paths:
description: |
The purge job's schedule, it is a json object. |
The sample format is |
{"parameters":{"audit_retention_hour":168,"dry_run":true, "include_operations":"create,delete,pull"},"schedule":{"type":"Hourly","cron":"0 0 * * * *"}} |
{"parameters":{"audit_retention_hour":168,"dry_run":true,"include_event_types":"create_artifact,delete_artifact,pull_artifact"},"schedule":{"type":"Hourly","cron":"0 0 * * * *"}} |
the include_operation should be a comma separated string, e.g. create,delete,pull, if it is empty, no operation will be purged.
tags:
- purge
Expand Down Expand Up @@ -4516,7 +4516,7 @@ paths:
description: |
The purge job's schedule, it is a json object. |
The sample format is |
{"parameters":{"audit_retention_hour":168,"dry_run":true, "include_operations":"create,delete,pull"},"schedule":{"type":"Hourly","cron":"0 0 * * * *"}} |
{"parameters":{"audit_retention_hour":168,"dry_run":true,"include_event_types":"create_artifact,delete_artifact,pull_artifact"},"schedule":{"type":"Hourly","cron":"0 0 * * * *"}} |
the include_operation should be a comma separated string, e.g. create,delete,pull, if it is empty, no operation will be purged.
tags:
- purge
Expand Down Expand Up @@ -9101,6 +9101,9 @@ definitions:
banner_message:
$ref: '#/definitions/StringConfigItem'
description: The banner message for the UI.It is the stringified result of the banner message object
disabled_audit_log_event_types:
$ref: '#/definitions/StringConfigItem'
description: The audit log event types to skip to log in database
Configurations:
type: object
properties:
Expand Down Expand Up @@ -9379,6 +9382,11 @@ definitions:
description: The banner message for the UI.It is the stringified result of the banner message object
x-omitempty: true
x-isnullable: true
disabled_audit_log_event_types:
type: string
description: the list to disable log audit event types.
x-omitempty: true
x-isnullable: true
StringConfigItem:
type: object
properties:
Expand Down
6 changes: 3 additions & 3 deletions src/common/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ const (
// 24h.
DefaultCacheExpireHours = 24

PurgeAuditIncludeOperations = "include_operations"
PurgeAuditIncludeEventTypes = "include_event_types"
PurgeAuditDryRun = "dry_run"
PurgeAuditRetentionHour = "audit_retention_hour"
// AuditLogForwardEndpoint indicate to forward the audit log to an endpoint
Expand All @@ -220,8 +220,8 @@ const (
// ScannerSkipUpdatePullTime
ScannerSkipUpdatePullTime = "scanner_skip_update_pulltime"

// AuditLogEventsDisabled
AuditLogEventsDisabled = "audit_log_events_disabled"
// AuditLogEventsDisabled ...
AuditLogEventsDisabled = "disabled_audit_log_event_types"

// SessionTimeout defines the web session timeout
SessionTimeout = "session_timeout"
Expand Down
2 changes: 1 addition & 1 deletion src/controller/purge/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (c *controller) Start(ctx context.Context, policy JobPolicy, trigger string

para[common.PurgeAuditDryRun] = policy.DryRun
para[common.PurgeAuditRetentionHour] = policy.RetentionHour
para[common.PurgeAuditIncludeOperations] = policy.IncludeOperations
para[common.PurgeAuditIncludeEventTypes] = policy.IncludeEventTypes

execID, err := c.exeMgr.Create(ctx, job.PurgeAuditVendorType, -1, trigger, para)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion src/controller/purge/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type JobPolicy struct {
Trigger *Trigger `json:"trigger"`
DryRun bool `json:"dryrun"`
RetentionHour int `json:"retention_hour"`
IncludeOperations string `json:"include_operations"`
IncludeEventTypes string `json:"include_event_types"`
ExtraAttrs map[string]interface{} `json:"extra_attrs"`
}

Expand Down
2 changes: 2 additions & 0 deletions src/core/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ import (
_ "github.com/goharbor/harbor/src/pkg/accessory/model/sbom"
_ "github.com/goharbor/harbor/src/pkg/accessory/model/subject"
"github.com/goharbor/harbor/src/pkg/audit"
_ "github.com/goharbor/harbor/src/pkg/auditext/event/config"
_ "github.com/goharbor/harbor/src/pkg/auditext/event/login"
_ "github.com/goharbor/harbor/src/pkg/auditext/event/user"
dbCfg "github.com/goharbor/harbor/src/pkg/config/db"
_ "github.com/goharbor/harbor/src/pkg/config/inmemory"
"github.com/goharbor/harbor/src/pkg/notification"
Expand Down
28 changes: 14 additions & 14 deletions src/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,24 @@ require (
github.com/stretchr/testify v1.10.0
github.com/tencentcloud/tencentcloud-sdk-go v3.0.233+incompatible
github.com/vmihailenco/msgpack/v5 v5.4.1
github.com/volcengine/volcengine-go-sdk v1.0.177
github.com/volcengine/volcengine-go-sdk v1.0.180
go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.59.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0
go.opentelemetry.io/otel v1.34.0
go.opentelemetry.io/otel/exporters/jaeger v1.0.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0
go.opentelemetry.io/otel/sdk v1.34.0
go.opentelemetry.io/otel/trace v1.34.0
go.uber.org/ratelimit v0.3.1
golang.org/x/crypto v0.31.0
golang.org/x/net v0.33.0
golang.org/x/crypto v0.32.0
golang.org/x/net v0.34.0
golang.org/x/oauth2 v0.25.0
golang.org/x/sync v0.10.0
golang.org/x/text v0.21.0
golang.org/x/time v0.9.0
gopkg.in/h2non/gock.v1 v1.1.2
gopkg.in/yaml.v2 v2.4.0
helm.sh/helm/v3 v3.16.2
helm.sh/helm/v3 v3.17.0
k8s.io/api v0.32.1
k8s.io/apimachinery v0.32.1
k8s.io/client-go v0.32.1
Expand All @@ -81,7 +81,7 @@ require (
require github.com/prometheus/client_model v0.6.1

require (
cloud.google.com/go/compute/metadata v0.5.0 // indirect
cloud.google.com/go/compute/metadata v0.5.2 // indirect
github.com/Azure/azure-sdk-for-go v37.2.0+incompatible // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.27 // indirect
Expand Down Expand Up @@ -119,7 +119,7 @@ require (
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/gorilla/securecookie v1.1.2 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1 // indirect
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
Expand Down Expand Up @@ -171,21 +171,21 @@ require (
github.com/x448/float16 v0.8.4 // indirect
go.mongodb.org/mongo-driver v1.14.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 // indirect
go.opentelemetry.io/otel/metric v1.34.0 // indirect
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
go.opentelemetry.io/proto/otlp v1.5.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/term v0.27.0 // indirect
golang.org/x/term v0.28.0 // indirect
google.golang.org/api v0.171.0 // indirect
google.golang.org/cloud v0.0.0-20151119220103-975617b05ea8 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect
google.golang.org/grpc v1.67.1 // indirect
google.golang.org/protobuf v1.35.1 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect
google.golang.org/grpc v1.69.4 // indirect
google.golang.org/protobuf v1.36.3 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit bf49756

Please sign in to comment.