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 2, 2023
1 parent 9074f84 commit bfd38c4
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 @@ -212,6 +212,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()

Check warning on line 216 in pkg/meta/boltdb/boltdb.go

View check run for this annotation

Codecov / codecov/patch

pkg/meta/boltdb/boltdb.go#L216

Added line #L216 was not covered by tests
}

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

0 comments on commit bfd38c4

Please sign in to comment.