Skip to content

Commit

Permalink
fix(metadb): populate image pushTimestamp if it's 0 value
Browse files Browse the repository at this point in the history
in the case of an already existing meta db without pushTimestamp field
its value would be 0 until image is updated, check for zero values and update them
with time.Now() so that retention logic won't remove them.

Signed-off-by: Petu Eusebiu <[email protected]>
  • Loading branch information
eusebiu-constantin-petu-dbk committed Nov 8, 2023
1 parent 7f52f58 commit 0dabc3c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/meta/boltdb/boltdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ func (bdw *BoltDB) SetRepoReference(ctx context.Context, repo string, reference
PushTimestamp: timestamppb.Now(),
PushedBy: userid,
}
} else if protoRepoMeta.Statistics[imageMeta.Digest.String()].PushTimestamp.AsTime().IsZero() {
protoRepoMeta.Statistics[imageMeta.Digest.String()].PushTimestamp = timestamppb.Now()
}

if _, ok := protoRepoMeta.Signatures[imageMeta.Digest.String()]; !ok {
Expand Down

0 comments on commit 0dabc3c

Please sign in to comment.