fix(retention) set pushtime and pulltime for untagged (#11786)

Signed-off-by: Ziming Zhang <zziming@vmware.com>
This commit is contained in:
Ziming 2020-04-28 19:20:46 +08:00 committed by GitHub
parent 4324f0d2c8
commit 56609a8026
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 6 deletions

View File

@ -17,13 +17,11 @@ package dep
import (
"errors"
"fmt"
"github.com/goharbor/harbor/src/lib/selector"
"net/http"
"time"
"github.com/goharbor/harbor/src/common/http/modifier/auth"
"github.com/goharbor/harbor/src/jobservice/config"
"github.com/goharbor/harbor/src/lib/selector"
"github.com/goharbor/harbor/src/pkg/clients/core"
"net/http"
)
// DefaultClient for the retention
@ -109,8 +107,8 @@ func (bc *basicClient) GetCandidates(repository *selector.Repository) ([]*select
labels = append(labels, label.Name)
}
tags := make([]string, 0)
var lastPulledTime time.Time
var lastPushedTime time.Time
lastPulledTime := art.PullTime
lastPushedTime := art.PushTime
for _, t := range art.Tags {
tags = append(tags, t.Name)
if t.PullTime.After(lastPulledTime) {