mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-25 19:56:09 +01:00
Not submit scan all job when core container starts
Fixes #6115 As for the change in migration sql file, in 1.7 we'll switch to jobservice for scheduling "scan all" job. To avoid inconsistency, this item will be reset and user will need to configure the policy again. Signed-off-by: Daniel Jiang <jiangd@vmware.com>
This commit is contained in:
parent
6c033574fa
commit
39b4d011c7
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