mirror of https://github.com/goharbor/harbor.git
Remove job parameters and schedule extra attribute (#17878)
Remove job parameters from job Remove extra attribute and cron type from schedule fixes #17866 Signed-off-by: stonezdj <daojunz@vmware.com> Signed-off-by: stonezdj <daojunz@vmware.com>
This commit is contained in:
parent
80999f28ee
commit
402363d50b
|
@ -9447,9 +9447,6 @@ definitions:
|
||||||
description: The start time of the worker
|
description: The start time of the worker
|
||||||
x-nullable: true
|
x-nullable: true
|
||||||
x-omitempty: true
|
x-omitempty: true
|
||||||
args:
|
|
||||||
type: string
|
|
||||||
description: The args of the worker
|
|
||||||
check_in:
|
check_in:
|
||||||
type: string
|
type: string
|
||||||
description: the checkin of the running job in the worker
|
description: the checkin of the running job in the worker
|
||||||
|
@ -9503,12 +9500,6 @@ definitions:
|
||||||
cron:
|
cron:
|
||||||
type: string
|
type: string
|
||||||
description: the cron of the current schedule task
|
description: the cron of the current schedule task
|
||||||
cron_type:
|
|
||||||
type: string
|
|
||||||
description: the cron type of the current schedule task
|
|
||||||
extra_attrs:
|
|
||||||
type: string
|
|
||||||
description: the extra attributes
|
|
||||||
update_time:
|
update_time:
|
||||||
type: string
|
type: string
|
||||||
format: date-time
|
format: date-time
|
||||||
|
|
|
@ -32,7 +32,6 @@ type Worker struct {
|
||||||
JobName string `json:"job_name"`
|
JobName string `json:"job_name"`
|
||||||
JobID string `json:"job_id"`
|
JobID string `json:"job_id"`
|
||||||
StartedAt int64 `json:"start_at"`
|
StartedAt int64 `json:"start_at"`
|
||||||
Args string `json:"args"`
|
|
||||||
CheckIn string `json:"check_in"`
|
CheckIn string `json:"check_in"`
|
||||||
CheckInAt int64 `json:"check_in_at"`
|
CheckInAt int64 `json:"check_in_at"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,13 +16,11 @@ package handler
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/goharbor/harbor/src/lib/errors"
|
"github.com/goharbor/harbor/src/lib/errors"
|
||||||
"github.com/goharbor/harbor/src/lib/log"
|
|
||||||
"github.com/goharbor/harbor/src/pkg/scheduler"
|
"github.com/goharbor/harbor/src/pkg/scheduler"
|
||||||
|
|
||||||
"github.com/go-openapi/runtime/middleware"
|
"github.com/go-openapi/runtime/middleware"
|
||||||
|
@ -100,7 +98,6 @@ func toWorkerResponse(wks []*jm.Worker) []*models.Worker {
|
||||||
JobName: w.JobName,
|
JobName: w.JobName,
|
||||||
JobID: w.JobID,
|
JobID: w.JobID,
|
||||||
PoolID: w.PoolID,
|
PoolID: w.PoolID,
|
||||||
Args: w.Args,
|
|
||||||
StartAt: startAtTime,
|
StartAt: startAtTime,
|
||||||
CheckinAt: checkInAtTime,
|
CheckinAt: checkInAtTime,
|
||||||
})
|
})
|
||||||
|
@ -135,22 +132,11 @@ func covertTime(t int64) strfmt.DateTime {
|
||||||
func toScheduleResponse(schs []*scheduler.Schedule) []*models.ScheduleTask {
|
func toScheduleResponse(schs []*scheduler.Schedule) []*models.ScheduleTask {
|
||||||
result := make([]*models.ScheduleTask, 0)
|
result := make([]*models.ScheduleTask, 0)
|
||||||
for _, s := range schs {
|
for _, s := range schs {
|
||||||
extraAttr := []byte("")
|
|
||||||
if s.ExtraAttrs != nil {
|
|
||||||
extra, err := json.Marshal(s.ExtraAttrs)
|
|
||||||
if err != nil {
|
|
||||||
log.Warningf("failed to extract extra attribute, error %v", err)
|
|
||||||
} else {
|
|
||||||
extraAttr = extra
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result = append(result, &models.ScheduleTask{
|
result = append(result, &models.ScheduleTask{
|
||||||
ID: s.ID,
|
ID: s.ID,
|
||||||
VendorType: s.VendorType,
|
VendorType: s.VendorType,
|
||||||
VendorID: s.VendorID,
|
VendorID: s.VendorID,
|
||||||
ExtraAttrs: string(extraAttr),
|
|
||||||
Cron: s.CRON,
|
Cron: s.CRON,
|
||||||
CronType: s.CRONType,
|
|
||||||
UpdateTime: strfmt.DateTime(s.UpdateTime),
|
UpdateTime: strfmt.DateTime(s.UpdateTime),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue