diff --git a/src/core/main.go b/src/core/main.go index 3f4b4783a..1b00d8941 100644 --- a/src/core/main.go +++ b/src/core/main.go @@ -109,10 +109,10 @@ func main() { log.Fatalf("failed to load config: %v", err) } - // init the scheduler - scheduler.Init() // init the jobservice client job.Init() + // init the scheduler + scheduler.Init() password, err := config.InitialAdminPassword() if err != nil { diff --git a/src/jobservice/runtime/bootstrap.go b/src/jobservice/runtime/bootstrap.go index cde0dfb76..46545d839 100644 --- a/src/jobservice/runtime/bootstrap.go +++ b/src/jobservice/runtime/bootstrap.go @@ -23,6 +23,8 @@ import ( "syscall" "time" + "github.com/goharbor/harbor/src/pkg/scheduler" + "github.com/goharbor/harbor/src/jobservice/api" "github.com/goharbor/harbor/src/jobservice/common/utils" "github.com/goharbor/harbor/src/jobservice/config" @@ -239,12 +241,13 @@ func (bs *Bootstrap) loadAndRunRedisWorkerPool( // Only for debugging and testing purpose job.SampleJob: (*sample.Job)(nil), // Functional jobs - job.ImageScanJob: (*scan.ClairJob)(nil), - job.ImageScanAllJob: (*scan.All)(nil), - job.ImageGC: (*gc.GarbageCollector)(nil), - job.Replication: (*replication.Replication)(nil), - job.ReplicationScheduler: (*replication.Scheduler)(nil), - job.Retention: (*retention.Job)(nil), + job.ImageScanJob: (*scan.ClairJob)(nil), + job.ImageScanAllJob: (*scan.All)(nil), + job.ImageGC: (*gc.GarbageCollector)(nil), + job.Replication: (*replication.Replication)(nil), + job.ReplicationScheduler: (*replication.Scheduler)(nil), + job.Retention: (*retention.Job)(nil), + scheduler.JobNameScheduler: (*scheduler.PeriodicJob)(nil), }); err != nil { // exit return nil, err diff --git a/src/pkg/retention/launcher.go b/src/pkg/retention/launcher.go index 2d72865cf..ccec50663 100644 --- a/src/pkg/retention/launcher.go +++ b/src/pkg/retention/launcher.go @@ -92,8 +92,8 @@ type launcher struct { } type jobData struct { - repository *res.Repository - policy *lwp.Metadata + repository res.Repository + policy lwp.Metadata taskID int64 } @@ -197,8 +197,8 @@ func (l *launcher) Launch(ply *policy.Metadata, executionID int64, isDryRun bool return 0, launcherError(err) } jobDatas = append(jobDatas, &jobData{ - repository: &repo, - policy: p, + repository: repo, + policy: *p, taskID: taskID, }) }