mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-18 14:47:38 +01:00
Fix delete repository event issue (#11722)
In the delete repository scenario, the repository has already been removed from the DB, the repository cannot be retrived. Just let the creation time as empty. Signed-off-by: wang yan <wangyan@vmware.com>
This commit is contained in:
parent
c28f6bd6ff
commit
8d5fc4c752
@ -115,9 +115,10 @@ func (a *Handler) constructArtifactPayload(event *event.ArtifactEvent) (*model.P
|
|||||||
repoRecord, err := repository.Mgr.GetByName(ctx, repoName)
|
repoRecord, err := repository.Mgr.GetByName(ctx, repoName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("failed to get repository with name %s: %v", repoName, err)
|
log.Errorf("failed to get repository with name %s: %v", repoName, err)
|
||||||
return nil, err
|
} else {
|
||||||
|
// for the delete repository event, it cannot get the repo info here, just let the creation time be empty.
|
||||||
|
payload.EventData.Repository.DateCreated = repoRecord.CreationTime.Unix()
|
||||||
}
|
}
|
||||||
payload.EventData.Repository.DateCreated = repoRecord.CreationTime.Unix()
|
|
||||||
|
|
||||||
var reference string
|
var reference string
|
||||||
if len(event.Tags) == 0 {
|
if len(event.Tags) == 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user