mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-01 04:21:36 +01:00
Merge pull request #8456 from ywk253100/190729_scheduler
Register the scheduler job and fix bugs
This commit is contained in:
commit
a5c31d7160
@ -109,10 +109,10 @@ func main() {
|
|||||||
log.Fatalf("failed to load config: %v", err)
|
log.Fatalf("failed to load config: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// init the scheduler
|
|
||||||
scheduler.Init()
|
|
||||||
// init the jobservice client
|
// init the jobservice client
|
||||||
job.Init()
|
job.Init()
|
||||||
|
// init the scheduler
|
||||||
|
scheduler.Init()
|
||||||
|
|
||||||
password, err := config.InitialAdminPassword()
|
password, err := config.InitialAdminPassword()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -23,6 +23,8 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/goharbor/harbor/src/pkg/scheduler"
|
||||||
|
|
||||||
"github.com/goharbor/harbor/src/jobservice/api"
|
"github.com/goharbor/harbor/src/jobservice/api"
|
||||||
"github.com/goharbor/harbor/src/jobservice/common/utils"
|
"github.com/goharbor/harbor/src/jobservice/common/utils"
|
||||||
"github.com/goharbor/harbor/src/jobservice/config"
|
"github.com/goharbor/harbor/src/jobservice/config"
|
||||||
@ -239,12 +241,13 @@ func (bs *Bootstrap) loadAndRunRedisWorkerPool(
|
|||||||
// Only for debugging and testing purpose
|
// Only for debugging and testing purpose
|
||||||
job.SampleJob: (*sample.Job)(nil),
|
job.SampleJob: (*sample.Job)(nil),
|
||||||
// Functional jobs
|
// Functional jobs
|
||||||
job.ImageScanJob: (*scan.ClairJob)(nil),
|
job.ImageScanJob: (*scan.ClairJob)(nil),
|
||||||
job.ImageScanAllJob: (*scan.All)(nil),
|
job.ImageScanAllJob: (*scan.All)(nil),
|
||||||
job.ImageGC: (*gc.GarbageCollector)(nil),
|
job.ImageGC: (*gc.GarbageCollector)(nil),
|
||||||
job.Replication: (*replication.Replication)(nil),
|
job.Replication: (*replication.Replication)(nil),
|
||||||
job.ReplicationScheduler: (*replication.Scheduler)(nil),
|
job.ReplicationScheduler: (*replication.Scheduler)(nil),
|
||||||
job.Retention: (*retention.Job)(nil),
|
job.Retention: (*retention.Job)(nil),
|
||||||
|
scheduler.JobNameScheduler: (*scheduler.PeriodicJob)(nil),
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
// exit
|
// exit
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -92,8 +92,8 @@ type launcher struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type jobData struct {
|
type jobData struct {
|
||||||
repository *res.Repository
|
repository res.Repository
|
||||||
policy *lwp.Metadata
|
policy lwp.Metadata
|
||||||
taskID int64
|
taskID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,8 +197,8 @@ func (l *launcher) Launch(ply *policy.Metadata, executionID int64, isDryRun bool
|
|||||||
return 0, launcherError(err)
|
return 0, launcherError(err)
|
||||||
}
|
}
|
||||||
jobDatas = append(jobDatas, &jobData{
|
jobDatas = append(jobDatas, &jobData{
|
||||||
repository: &repo,
|
repository: repo,
|
||||||
policy: p,
|
policy: *p,
|
||||||
taskID: taskID,
|
taskID: taskID,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user