@ -209,9 +209,13 @@ func (r *Resolver) Resolve(reqs []*chart.Dependency, repoNames map[string]string
// HashReq generates a hash of the dependencies.
//
// This should be used only to compare against another hash generated by this
// function.
// function. Per-dependency content digests are excluded; the top-level lock
// digest tracks Chart.yaml constraints and resolved metadata only.
func HashReq ( req , lock [ ] * chart . Dependency ) ( string , error ) {
data , err := json . Marshal ( [ 2 ] [ ] * chart . Dependency { req , lock } )
data , err := json . Marshal ( [ 2 ] [ ] * chart . Dependency {
dependenciesForMetadataHash ( req ) ,
dependenciesForMetadataHash ( lock ) ,
} )
if err != nil {
return "" , err
}
@ -219,6 +223,23 @@ func HashReq(req, lock []*chart.Dependency) (string, error) {
return "sha256:" + s , err
}
// dependenciesForMetadataHash returns a copy of deps with content digests cleared.
func dependenciesForMetadataHash ( deps [ ] * chart . Dependency ) [ ] * chart . Dependency {
if len ( deps ) == 0 {
return nil
}
out := make ( [ ] * chart . Dependency , len ( deps ) )
for i , d := range deps {
if d == nil {
continue
}
cp := * d
cp . Digest = ""
out [ i ] = & cp
}
return out
}
// HashV2Req generates a hash of requirements generated in Helm v2.
//
// This should be used only to compare against another hash generated by the