mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 10:15:35 +01:00
Merge pull request #8451 from ywk253100/190729_retention_task
Add property "repository" to retention task
This commit is contained in:
commit
7fd06edccf
@ -118,6 +118,7 @@ create table retention_task
|
||||
(
|
||||
id SERIAL NOT NULL,
|
||||
execution_id integer,
|
||||
repository varchar(255),
|
||||
job_id varchar(64),
|
||||
status varchar(32),
|
||||
start_time timestamp default CURRENT_TIMESTAMP,
|
||||
|
@ -57,6 +57,7 @@ type RetentionExecution struct {
|
||||
type RetentionTask struct {
|
||||
ID int64 `orm:"pk;auto;column(id)"`
|
||||
ExecutionID int64 `orm:"column(execution_id)"`
|
||||
Repository string `orm:"column(repository)"`
|
||||
JobID string `orm:"column(job_id)"`
|
||||
Status string `orm:"column(status)"`
|
||||
StartTime time.Time `orm:"column(start_time)"`
|
||||
|
@ -189,6 +189,7 @@ func (l *launcher) Launch(ply *policy.Metadata, executionID int64, isDryRun bool
|
||||
for repo, p := range repositoryRules {
|
||||
taskID, err := l.retentionMgr.CreateTask(&Task{
|
||||
ExecutionID: executionID,
|
||||
Repository: repo.Name,
|
||||
StartTime: now,
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -169,6 +169,7 @@ func (d *DefaultManager) CreateTask(task *Task) (int64, error) {
|
||||
}
|
||||
t := &models.RetentionTask{
|
||||
ExecutionID: task.ExecutionID,
|
||||
Repository: task.Repository,
|
||||
JobID: task.JobID,
|
||||
Status: task.Status,
|
||||
StartTime: task.StartTime,
|
||||
@ -191,6 +192,7 @@ func (d *DefaultManager) ListTasks(query ...*q.TaskQuery) ([]*Task, error) {
|
||||
tasks = append(tasks, &Task{
|
||||
ID: t.ID,
|
||||
ExecutionID: t.ExecutionID,
|
||||
Repository: t.Repository,
|
||||
JobID: t.JobID,
|
||||
Status: t.Status,
|
||||
StartTime: t.StartTime,
|
||||
@ -211,6 +213,7 @@ func (d *DefaultManager) UpdateTask(task *Task, cols ...string) error {
|
||||
return dao.UpdateTask(&models.RetentionTask{
|
||||
ID: task.ID,
|
||||
ExecutionID: task.ExecutionID,
|
||||
Repository: task.Repository,
|
||||
JobID: task.JobID,
|
||||
Status: task.Status,
|
||||
StartTime: task.StartTime,
|
||||
@ -230,6 +233,7 @@ func (d *DefaultManager) GetTask(taskID int64) (*Task, error) {
|
||||
return &Task{
|
||||
ID: task.ID,
|
||||
ExecutionID: task.ExecutionID,
|
||||
Repository: task.Repository,
|
||||
JobID: task.JobID,
|
||||
Status: task.Status,
|
||||
StartTime: task.StartTime,
|
||||
|
@ -51,6 +51,7 @@ type Execution struct {
|
||||
type Task struct {
|
||||
ID int64 `json:"id"`
|
||||
ExecutionID int64 `json:"execution_id"`
|
||||
Repository string `json:"repository"`
|
||||
JobID string `json:"job_id"`
|
||||
Status string `json:"status"`
|
||||
StartTime time.Time `json:"start_time"`
|
||||
|
Loading…
Reference in New Issue
Block a user