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:
stonezdj(Daojun Zhang) 2022-11-28 17:45:26 +08:00 committed by GitHub
parent 80999f28ee
commit 402363d50b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 24 deletions

View File

@ -9447,9 +9447,6 @@ definitions:
description: The start time of the worker
x-nullable: true
x-omitempty: true
args:
type: string
description: The args of the worker
check_in:
type: string
description: the checkin of the running job in the worker
@ -9503,12 +9500,6 @@ definitions:
cron:
type: string
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:
type: string
format: date-time

View File

@ -32,7 +32,6 @@ type Worker struct {
JobName string `json:"job_name"`
JobID string `json:"job_id"`
StartedAt int64 `json:"start_at"`
Args string `json:"args"`
CheckIn string `json:"check_in"`
CheckInAt int64 `json:"check_in_at"`
}

View File

@ -16,13 +16,11 @@ package handler
import (
"context"
"encoding/json"
"fmt"
"strings"
"time"
"github.com/goharbor/harbor/src/lib/errors"
"github.com/goharbor/harbor/src/lib/log"
"github.com/goharbor/harbor/src/pkg/scheduler"
"github.com/go-openapi/runtime/middleware"
@ -100,7 +98,6 @@ func toWorkerResponse(wks []*jm.Worker) []*models.Worker {
JobName: w.JobName,
JobID: w.JobID,
PoolID: w.PoolID,
Args: w.Args,
StartAt: startAtTime,
CheckinAt: checkInAtTime,
})
@ -135,22 +132,11 @@ func covertTime(t int64) strfmt.DateTime {
func toScheduleResponse(schs []*scheduler.Schedule) []*models.ScheduleTask {
result := make([]*models.ScheduleTask, 0)
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{
ID: s.ID,
VendorType: s.VendorType,
VendorID: s.VendorID,
ExtraAttrs: string(extraAttr),
Cron: s.CRON,
CronType: s.CRONType,
UpdateTime: strfmt.DateTime(s.UpdateTime),
})
}