mirror of https://github.com/artifacthub/hub.git
Exclude generated time when calculating repo digest (#1254)
Signed-off-by: Sergio Castaño Arteaga <tegioz@icloud.com>
This commit is contained in:
parent
3a3ce6e277
commit
a633b6482a
|
|
@ -50,9 +50,7 @@ func (l *HelmIndexLoader) LoadIndex(r *hub.Repository) (*helmrepo.IndexFile, str
|
|||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
hash := sha256.Sum256(indexBytes)
|
||||
digest := hex.EncodeToString(hash[:])
|
||||
return indexFile, digest, nil
|
||||
return indexFile, getDigest(indexBytes), nil
|
||||
}
|
||||
|
||||
// downloadIndexFile downloads a Helm repository's index file.
|
||||
|
|
@ -89,3 +87,14 @@ func loadIndexFile(indexBytes []byte) (*helmrepo.IndexFile, error) {
|
|||
indexFile.SortEntries()
|
||||
return indexFile, nil
|
||||
}
|
||||
|
||||
// getDigest returns the digest of a Helm repository's index file.
|
||||
func getDigest(indexBytes []byte) string {
|
||||
indexFile := &helmrepo.IndexFile{}
|
||||
_ = yaml.UnmarshalStrict(indexBytes, indexFile)
|
||||
indexFile.Generated = time.Time{}
|
||||
indexBytes, _ = yaml.Marshal(indexFile)
|
||||
hash := sha256.Sum256(indexBytes)
|
||||
digest := hex.EncodeToString(hash[:])
|
||||
return digest
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue