mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-23 18:55:18 +01:00
Merge pull request #6126 from reasonerjt/no-scanall-bootstrap
Not submit scan all job when core container starts
This commit is contained in:
commit
591e3df9c5
2
make/migrations/postgresql/0002_1.7.0_schema.up.sql
Normal file
2
make/migrations/postgresql/0002_1.7.0_schema.up.sql
Normal file
@ -0,0 +1,2 @@
|
||||
ALTER TABLE properties ALTER COLUMN v TYPE varchar(1024);
|
||||
DELETE FROM properties where k='scan_all_policy';
|
@ -1 +0,0 @@
|
||||
ALTER TABLE properties ALTER COLUMN v TYPE varchar(1024);
|
@ -131,8 +131,5 @@ const (
|
||||
|
||||
// DefaultScanAllPolicy ...
|
||||
var DefaultScanAllPolicy = ScanAllPolicy{
|
||||
Type: ScanAllDaily,
|
||||
Parm: map[string]interface{}{
|
||||
ScanAllDailyTime: 0,
|
||||
},
|
||||
Type: ScanAllNone,
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ func TestConfig(t *testing.T) {
|
||||
t.Errorf("unexpected mode: %s != %s", mode, "db_auth")
|
||||
}
|
||||
|
||||
if s := ScanAllPolicy(); s.Type != "daily" {
|
||||
if s := ScanAllPolicy(); s.Type != "none" {
|
||||
t.Errorf("unexpected scan all policy %v", s)
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,6 @@ import (
|
||||
"encoding/gob"
|
||||
"fmt"
|
||||
"os"
|
||||
"reflect"
|
||||
"strconv"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
@ -122,22 +121,6 @@ func main() {
|
||||
if err := dao.InitClairDB(clairDB); err != nil {
|
||||
log.Fatalf("failed to initialize clair database: %v", err)
|
||||
}
|
||||
// Get policy configuration.
|
||||
scanAllPolicy := config.ScanAllPolicy()
|
||||
if scanAllPolicy.Type == notifier.PolicyTypeDaily {
|
||||
dailyTime := 0
|
||||
if t, ok := scanAllPolicy.Parm["daily_time"]; ok {
|
||||
if reflect.TypeOf(t).Kind() == reflect.Int {
|
||||
dailyTime = t.(int)
|
||||
}
|
||||
}
|
||||
|
||||
// Send notification to handle first policy change.
|
||||
if err = notifier.Publish(notifier.ScanAllPolicyTopic,
|
||||
notifier.ScanPolicyNotification{Type: scanAllPolicy.Type, DailyTime: (int64)(dailyTime)}); err != nil {
|
||||
log.Errorf("failed to publish scan all policy topic: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if err := core.Init(); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user