diff --git a/ancestry.go b/ancestry.go index db609406..0e6ce4e9 100644 --- a/ancestry.go +++ b/ancestry.go @@ -278,7 +278,13 @@ func IsAncestryCached(store database.Datastore, name string, layerHashes []strin } if found { - log.WithField("ancestry.Name", name).Debug("found cached ancestry") + if len(database.DiffDetectors(EnabledDetectors(), ancestry.By)) == 0 { + log.WithField("ancestry.Name", name).Debug("found cached ancestry") + } else { + log.WithField("ancestry.Name", name).Debug("found outdated ancestry cache") + } + } else { + log.WithField("ancestry.Name", name).Debug("ancestry not cached") } return found && len(database.DiffDetectors(EnabledDetectors(), ancestry.By)) == 0, nil diff --git a/api/v3/rpc.go b/api/v3/rpc.go index 34a9d0d3..27abe352 100644 --- a/api/v3/rpc.go +++ b/api/v3/rpc.go @@ -17,8 +17,6 @@ package v3 import ( "fmt" - "github.com/coreos/clair/ext/imagefmt" - "golang.org/x/net/context" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -26,6 +24,7 @@ import ( "github.com/coreos/clair" pb "github.com/coreos/clair/api/v3/clairpb" "github.com/coreos/clair/database" + "github.com/coreos/clair/ext/imagefmt" "github.com/coreos/clair/pkg/commonerr" "github.com/coreos/clair/pkg/pagination" ) @@ -61,7 +60,6 @@ func (s *StatusServer) GetStatus(ctx context.Context, req *pb.GetStatusRequest) // PostAncestry implements posting an ancestry via the Clair gRPC service. func (s *AncestryServer) PostAncestry(ctx context.Context, req *pb.PostAncestryRequest) (*pb.PostAncestryResponse, error) { - // validate request blobFormat := req.GetFormat() if !imagefmt.IsSupported(blobFormat) { return nil, status.Error(codes.InvalidArgument, "image blob format is not supported") @@ -72,7 +70,7 @@ func (s *AncestryServer) PostAncestry(ctx context.Context, req *pb.PostAncestryR return nil, status.Error(codes.Internal, err.Error()) } - // check if the ancestry is already processed, if not we build the ancestry again. + // check if the ancestry is already processed; if not we build the ancestry again. layerHashes := make([]string, len(req.Layers)) for i, layer := range req.Layers { layerHashes[i] = layer.GetHash()