Skip to content

Cache Manifest: duplicate entries in a manifest ? Is a sha an identifier ? #4398

@azr

Description

@azr

Hello there, I'm currently trying to deeply understand what's in a cache manifest and I have a bunch of questions, feel free to just redirect me to a blog post or something, I couldn't find any that would answer these.

1/ In some builds a cache manifest can have more than one layer with the same digest, but I see that the code treats those as a single, same thing; for example in here :

allLayers[m.Digest] = v1.DescriptorProviderPair{
Descriptor: m,
Provider: ci.provider,
}

Here are some questions:

  • Can a layer be identified by its blob (digest) ? Or should it rather be identified by its full path eg: $parent_digests + $digest ?
  • what gives a digest ?
  • if two digests are identical, can we only assume that the operation was the same ?
  • Could duplicate digests cause some issues down the line ?
  • Would it be a correct thing to sort of rewrite a manifest and merge the duplicate entries together ? ( it feels like no because then we would end up with an incorrect result and sometimes the result would be an invalid loopey dag )

2/ Same paragraph and same questions but for cache records instead of layers. A cache manifest can have more than one records with a similar digest.

3/ cacheManager.Query

  • What will a cacheManager.Query actually lookup ? A digest ? but if the digest can be duplicate, won't that operation be incorrect then ? Or will it rather ask for the full path leading there ?

  • I also saw that upon loading a cache manifest, the loaded digests are randomized here :

var id string
if len(it.links) == 0 {
id = it.dgst.String()
} else {
id = identity.NewID()
}

When the cache item has links. But, would it be possible to rename things before saving the manifest ? So as to have each entry be a unique one ?

Thanks :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions